Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get to work on zsh + iterm2 (macos) #23

Open
ericreis opened this issue Jul 10, 2018 · 12 comments
Open

Can't get to work on zsh + iterm2 (macos) #23

ericreis opened this issue Jul 10, 2018 · 12 comments

Comments

@ericreis
Copy link

ericreis commented Jul 10, 2018

Hi,

I am having some problems installing this theme in vim. I have already done everything in the readme, including the base16 part and I can't get it to work inside vim. It is working fine in iterm (which I didn't want to, I only wanted when inside vim), as you can see in the pictures below.

image

image

Could you help me find where I am failing?

Here is my .vimrc

" Use Vim settings, rather then Vi settings. This setting must be as early as
" possible, as it has side effects.
set nocompatible

:set term=screen-256color

" NERDTree Config
map <C-\> :NERDTreeToggle<CR>
let g:NERDTreeWinSize=25
let g:nerdtree_tabs_smart_startup_focus=1
let g:nerdtree_tabs_open_on_console_startup=1
let g:nerdtree_tabs_synchronize_view=1
let g:nerdtree_tabs_startup_cd=1

" CtrlP
let g:ctrlp_show_hidden = 1
let g:ctrlp_dotfiles = 1

" Leader - ( Spacebar )
let mapleader = " "
set backspace=2   " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile    " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler         " show the cursor position all the time
set showcmd       " display incomplete command
set incsearch     " do incremental searching
set laststatus=2  " Always display the status line
set autowrite     " Automatically :write before running commands
set autoread      " Reload files changted outside vim

"Allow usage of mouse in iTerm
set mouse=a
set ttymouse=xterm2

" case insensitive searching (unless specified)
set ignorecase
set smartcase

" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab

" Display extra whitespace
set list listchars=tab:»·,trail:·,nbsp:·

" Make it obvious where 80 characters is
set textwidth=80
set colorcolumn=+1

" Numbers
set number
set numberwidth=5

" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright

" Auto resize Vim splits to active split
set winwidth=84
set winheight=5
set winminheight=5
set winheight=999

"HTML Editing
set matchpairs+=<:>

" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'

" ================ Scrolling ========================

set scrolloff=8         "Start scrolling when we're 8 lines away from margins
set sidescrolloff=15
set sidescroll=1

"Toggle relative numbering, and set to absolute on loss of focus or insert mode
set rnu
function! ToggleNumbersOn()
    set nu!
    set rnu
endfunction
function! ToggleRelativeOn()
    set rnu!
    set nu
endfunction
autocmd FocusLost * call ToggleRelativeOn()
autocmd FocusGained * call ToggleRelativeOn()
autocmd InsertEnter * call ToggleRelativeOn()
autocmd InsertLeave * call ToggleRelativeOn()

" Quicker window movement
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-h> <C-w>h
noremap <C-l> <C-w>l

" Opens the last file
map <Leader><Tab> :e#<cr>

" Set spellfile to location that is guaranteed to exist, can be symlinked to
" Dropbox or kept in Git and managed outside of thoughtbot/dotfiles using rcm.
set spellfile=$HOME/.vim-spell-en.utf-8.add

" Always use vertical diffs
set diffopt+=vertical

" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
  syntax on
endif

" Load up all of our plugins
if filereadable(expand("~/.vimrc.bundles"))
  source ~/.vimrc.bundles
endif

filetype plugin indent on

""" SYSTEM CLIPBOARD COPY & PASTE SUPPORT
set pastetoggle=<F2> "F2 before pasting to preserve indentation
"
"Copy paste to/from clipboard
vnoremap <C-c> "+y
map <silent><Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>"
map <silent><Leader><S-p> :set paste<CR>O<esc>"*]p:set nopaste<cr>"
map <silent><C-v> :set paste<CR>o<esc>"*]p:set nopaste<cr>"

""" MORE AWESOME HOTKEYS
"
"
" Run the q macro
nnoremap <leader>q @q
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>

" bind \ (backward slash) to grep shortcut
command! -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
nnoremap \ :Ag<SPACE>

"Map Ctrl + S to save in any mode
noremap <silent> <C-S>          :update<CR>
vnoremap <silent> <C-S>         <C-C>:update<CR>
inoremap <silent> <C-S>         <C-O>:update<CR>
" Also map leader + s
map <leader>s <C-S>

" zoom a vim pane, <C-w>= to re-balance
nnoremap <leader>- :wincmd _<cr>:wincmd \|<cr>
nnoremap <leader>= :wincmd =<cr>

" resize panes
nnoremap <silent> <Right> :vertical resize +5<cr>
nnoremap <silent> <Left> :vertical resize -5<cr>
nnoremap <silent> <Up> :resize +5<cr>
nnoremap <silent> <Down> :resize -5<cr>

inoremap <Tab> <c-r>=InsertTabWrapper()<cr>
inoremap <S-Tab> <c-n>

" Move panes
map <leader>h <c-w>x <C-w>h
map <leader>l <c-w><c-x> <C-w>l

" Remap LastBuf to Shift-Ctrl-T
map <c-s-t> :LastBuf<CR>
map <leader>t :LastBuf<CR>

" Closes buffer with Space-q
map <leader>q :q<CR>

" Opens a blank vsplit with Space-n
map <leader>n :vnew<CR>

" Switch between the last two files
"nnoremap <leader><leader> <c-^>

" automatically rebalance windows on vim resize
autocmd VimResized * :wincmd =

" Ag.vim always searching on project root
let g:ag_working_path_mode="r"

set timeoutlen=1000 ttimeoutlen=0

And here is my .vimrc.bundles

if &compatible
  set nocompatible
end

  filetype off
  set rtp+=~/.vim/bundle/Vundle.vim/
  call vundle#begin()

  Plugin 'gmarik/Vundle.vim'
  Plugin 'tpope/vim-bundler'

  """ Utility stuff
  "
  Plugin 'christoomey/vim-tmux-navigator'
  Plugin 'vim-scripts/ctags.vim'
  Plugin 'scrooloose/nerdtree'
  Plugin 'jistr/vim-nerdtree-tabs'
  Plugin 'ctrlpvim/ctrlp.vim'
  Plugin 'tpope/vim-repeat'
  Plugin 'tpope/vim-surround'
  Plugin 'rking/ag.vim'
  Plugin 'terryma/vim-multiple-cursors'
  Plugin 'iurimadeira/lastbuf.vim'
  Plugin 'chr4/nginx.vim'

  """ Language related stuff
  Plugin 'fatih/vim-go'

  """ Autocompletion
  if has('nvim')
    Plugin 'shougo/deoplete.nvim'
    let g:deoplete#enable_at_startup = 1
    inoremap <expr><C-j> pumvisible() ? "\<C-n>" : "\<Down>"
    inoremap <expr><C-k> pumvisible() ? "\<C-p>" : "\<Up>"
    inoremap <expr><C-l> pumvisible() ? "\<C-y>" : "\<C-l>"
  else
    Plugin 'ervandew/supertab'
    Plugin 'valloric/youcompleteme'
  end

  """ VimWiki
  Plugin 'vimwiki/vimwiki'

  """ Highlighting, syntax, etc for various Languages

  """ Theme / Pretty stuff
  Plugin 'flazz/vim-colorschemes'
  Plugin 'bling/vim-airline' "Awesome looking meta at bottom
  Plugin 'vim-airline/vim-airline-themes'
  Plugin 'kristijanhusak/vim-hybrid-material'

call vundle#end()
filetype on

""" PLUGIN RELATED TWEAKS
"

" THEME
syntax enable
let g:airline_powerline_fonts = 1
set background=dark
colorscheme hybrid_material

" *gotham256
" **evening
" seoul256
" wombat256
" flatcolor
" **colorsbox-greenish
" *materialbox
" *luna-term
" *lucius
" *onedark
" *termschool
" *molokai
" *tomorrow
" *tomorrow_night
" *tomorrow_night_bright
" **tomorrow_night_eighties
" *jellybeans
" jelleybeans
" **triplejelly
" **gruvbox
" **badwolf
" **spacegray
" apprentice
" neonwave
" alduin
" muon
" cobalt2

"tmux integration
let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 1

nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>

map <C-n> :NERDTreeToggle<cr>
nnoremap <C-t> :call ToggleRelativeOn()<cr>

" Index ctags from any project
map <Leader>ct :!ctags -R .<CR>

" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
  " Use Ag over Grep
  set grepprg=ag\ --nogroup\ --nocolor

  " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
  let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'

  " ag is fast enough that CtrlP doesn't need to cache
  let g:ctrlp_use_caching = 0
endif

" Vimwiki stuff
" Set Vim Wiki to my Dropbox directory
let g:vimwiki_list = [{'path':'$HOME/Dropbox/vimwiki'}]"

" mapping for Vimwiki
:autocmd FileType vimwiki map <leader>wj :VimwikiMakeDiaryNote<cr>"
map <Leader>wb :e ~/Dropbox/vimwiki/Backlog.wiki<CR>

" Increase performance
set cursorline!
set lazyredraw
set ttyfast

" Multicursor config
let g:multi_cursor_next_key='<C-N>'
let g:multi_cursor_prev_key='<C-P>'
let g:multi_cursor_skip_key='<C-X>'
let g:multi_cursor_quit_key='<Esc>'
@kristijanhusak
Copy link
Owner

Are you using vim8?
If you are, try adding this to your vimrc:

let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"

@ericreis
Copy link
Author

Yeah, I am using vim8:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jul 26 2017 19:10:24)
Included patches: 1-503, 505-642
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    -mouse_sgr       +tag_old_static
-arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           -mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     -termguicolors
-browse          -footer          +multi_byte      +terminfo
+builtin_terms   +fork()          +multi_lang      +termresponse
+byte_offset     -gettext         -mzscheme        +textobjects
+channel         -hangul_input    +netbeans_intg   +timers
+cindent         +iconv           +num64           +title
-clientserver    +insert_expand   +packages        -toolbar
-clipboard       +job             +path_extra      +user_commands
+cmdline_compl   +jumplist        -perl            +vertsplit
+cmdline_hist    -keymap          +persistent_undo +virtualedit
+cmdline_info    +lambda          +postscript      +visual
+comments        -langmap         +printer         +visualextra
-conceal         +libcall         -profile         +viminfo
+cryptv          +linebreak       +python/dyn      +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             -rightleft       +writebackup
+diff            +menu            +ruby/dyn        -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xpm
-emacs_tags      -mouseshape      +startuptime     -xsmp
+eval            -mouse_dec       +statusline      -xterm_clipboard
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_save
+extra_search    -mouse_jsbterm   +syntax
-farsi           -mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa

Nothing changed when I added those lines.

@ericreis ericreis changed the title Can get to work on zsh + iterm2 (macos) Can' get to work on zsh + iterm2 (macos) Jul 10, 2018
@ericreis ericreis changed the title Can' get to work on zsh + iterm2 (macos) Can't get to work on zsh + iterm2 (macos) Jul 10, 2018
@kristijanhusak
Copy link
Owner

The only problem is background, right?

@ericreis
Copy link
Author

No, i think the whole colorscheme isn't working properly, at least compared to the material theme on my vscode.

@kristijanhusak
Copy link
Owner

I don't think it would match with colorscheme from different editor, but it should match the screenshots in the readme.
Try uninstalling base16 stuff, and also add this beside the code i mentioned:

set termguicolors

I see that you are using semi-transparent background on terminal, so that can also potentially cause some confusion.

@ericreis
Copy link
Author

I didn't understand the part of uninstalling base16 stuff? Isn't this necessary for vim?

@ericreis
Copy link
Author

Tried adding the set termguicolors line, but nothing changed. I am still feeling it's kinda odd. Could you write this python example code and take a screenshot?

@kristijanhusak
Copy link
Owner

base16 is necessary only if you don't have vim8 and true colors support, but you should have it with iterm and vim8.
Can you try temporarily disable terminal transparency and see how it looks?

@ericreis
Copy link
Author

For the transparency I have added the line, and now the transparency works:

let g:hybrid_transparent_background = 1

I have removed the base16 and disabled transparency and it looks like this:

image

I have managed to get the background color working when I added the following line and had the iterm color preset on.

g:hybrid_custom_term_colors = 1

image

The problem with this is that I don't want to have that color pallete for all my terminal, just inside vim. Futhermore, I think the syntax highlighting is still broken somehow (based on code examples that I have found on the internet). Can you share a screenshot of your vim with this python example code:

import itertools

class Foo:
    def __init__(self, x, y):
        self.x = x
        self.y = y

def iter_primes():
    # an iterator of all numbers between 2 and +infinity
    numbers = itertools.count(2)

    # generate primes forever
    while True:
        # get the first number from the iterator (always a prime)
        prime = numbers.next()
        yield prime

        # this code iteratively builds up a chain of
        # filters...slightly tricky, but ponder it a bit
        numbers = itertools.ifilter(prime.__rmod__, numbers)

for p in iter_primes():
    if p > 1000:
        break
    print p

@sayatul
Copy link

sayatul commented Mar 29, 2019

@sayatul
Copy link

sayatul commented Mar 29, 2019

image
works fine for gvim though, tried all the above ways

@kristijanhusak
Copy link
Owner

@sayatul what's your environment? OS, terminal, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants