Skip to content

Instantly share code, notes, and snippets.

@thiagomoretto
Last active December 15, 2015 02:24
Show Gist options
  • Save thiagomoretto/bb93d9f4a8c79e40799b to your computer and use it in GitHub Desktop.
Save thiagomoretto/bb93d9f4a8c79e40799b to your computer and use it in GitHub Desktop.
vim+iTerm
macm Window.Select\ Next\ Tab key=<nop>
nmap <D-}> :bnext<CR>
macm Window.Select\ Previous\ Tab key=<nop>
nmap <D-{> :bprev<CR>
map <D-\|> :blast <CR>
map <D-+> :BufExplorer<CR>
map <D-S-BS> :bdelete<CR>
macm File.Save key=<nop>
imap <D-s> <ESC>:w<CR> " insert mode
nmap <D-s> :w<CR> " normal mode
macm File.Close key=<nop>
nmap <D-w> :call Bclose()<CR>
macm File.New\ Tab key=<nop>
imap <D-t> <ESC>:enew<CR>
nmap <D-t> :enew<CR>
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" Plugins
Plugin 'tpope/vim-fugitive'
Plugin 'bling/vim-airline'
Plugin 'airblade/vim-gitgutter'
Plugin 'easymotion/vim-easymotion'
Plugin 'scrooloose/nerdtree'
Bundle 'jistr/vim-nerdtree-tabs'
Plugin 'scrooloose/nerdcommenter'
Plugin 'flazz/vim-colorschemes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'kien/ctrlp.vim'
Plugin 'majutsushi/tagbar'
" Plugin 'fholgado/minibufexpl.vim'
Plugin 'ervandew/supertab'
Plugin 'tpope/vim-surround'
Plugin 'mileszs/ack.vim'
Plugin 'DavidEGx/ctrlp-smarttabs'
Plugin 'xolox/vim-easytags'
Plugin 'xolox/vim-misc'
" Python
Plugin 'nvie/vim-flake8'
Plugin 'hdima/python-syntax'
call vundle#end()
filetype plugin indent on
" airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
set laststatus=2
" flake8
let g:flake8_show_in_gutter = 1
let g:flake8_show_in_file = 1
" python
let python_highlight_all = 1
" theme
set background=dark
" easymotion
nmap s <Plug>(easymotion-s)
let g:EasyMotion_smartcase = 1
" ctrlp
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn|pyc|class)$'
let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
" vim
filetype plugin on
syntax on
set tabstop=4 shiftwidth=4 expandtab
set backspace=indent,eol,start
set mouse=a
set ts=2
set expandtab
set nu
set ai
set si
" tagbar
nmap <F8> :TagbarToggle<CR>
" nerdtree
let NERDTreeIgnore = ['\.pyc$']
" ctrlp smarttabs
let g:ctrlp_extensions = ['smarttabs']
nnoremap <F3> :CtrlPSmartTabs<CR>
" airline tabline
set hidden
let g:airline#extensions#tabline#buffer_idx_mode = 1
nmap <leader>' :enew<cr>
nmap <leader>] :bnext<CR>
nmap <leader>[ :bprevious<CR>
nnoremap <F11> :bprevious<CR>
nnoremap <F12> :bnext<CR>
nnoremap <C-,> :bprevious<CR>
nnoremap <C-.> :bnext<CR>
" Close the current buffer and move to the previous one
" This replicates the idea of closing a tab
nmap <leader>bq :bp <BAR> bd #<CR>
" Show all open buffers and their status
nmap <leader>bl :ls<CR>
" ipdb
cnoreabbrev ipdbclear g/ipdb/d
" quote a word
nnoremap qw :silent! normal mpea'<Esc>bi'<Esc>`pl
" double quote a word
nnoremap qd :silent! normal mpea"<Esc>bi"<Esc>`pl
" remove quotes from a word
nnoremap wq :silent! normal mpeld bhd `ph<CR>
nnoremap pw :silent! normal mpea)<Esc>bi(<Esc>`pl
nnoremap [w :silent! normal mpea]<Esc>bi[<Esc>`pl
" for command mode
nnoremap <S-Tab> <<
" " for insert mode
inoremap <S-Tab> <C-d>
if has("gui_running")
let s:uname = system("uname")
if s:uname == "Darwin\n"
set guifont=Meslo\ LG\ M\ DZ\ Regular\ for\ Powerline:h14
endif
set guioptions-=r " Remove scrollbars
set guioptions-=R " Remove scrollbars
set guioptions-=l " Remove scrollbars
set guioptions-=L " Remove scrollbars
set guioptions-=T " Remove toolbars
" Awesome visual selection maintained when indenting.
vmap <D-]> >gv
vmap <D-[> <gv
" Map Command-# to switch tabs
map <D-0> 0gt
imap <D-0> <Esc>0gt
map <D-1> 1gt
imap <D-1> <Esc>1gt
map <D-2> 2gt
imap <D-2> <Esc>2gt
map <D-3> 3gt
imap <D-3> <Esc>3gt
map <D-4> 4gt
imap <D-4> <Esc>4gt
map <D-5> 5gt
imap <D-5> <Esc>5gt
map <D-6> 6gt
imap <D-6> <Esc>6gt
map <D-7> 7gt
imap <D-7> <Esc>7gt
map <D-8> 8gt
imap <D-8> <Esc>8gt
map <D-9> 9gt
imap <D-9> <Esc>9gt
endif
" from Vimbox
vmap <D-/> <c-_><c-_>
vmap <D-s-/> <c-_>b
nmap <D-/> gc$
vmap <C-c> "y+
" nerdtree
let g:nerdtree_tabs_focus_on_files = 1
let g:nerdtree_tabs_open_on_gui_startup = 0
if has("gui_running")
if has("gui_macvim")
map <D-e> :NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
imap <D-e> <Esc>:NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
vmap <D-e> <Esc>:NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
nmap <D-e> <Esc>:NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
map <D-E> :NERDTreeTabsOpen<Cr>:NERDTreeTabsFind<Cr><c-w><c-w><c-w><c-p>
imap <D-E> <Esc>:NERDTreeTabsOpen<Cr>:NERDTreeTabsFind<Cr><c-w><c-w><c-w><c-p>
vmap <D-E> <Esc>:NERDTreeTabsOpen<Cr>:NERDTreeTabsFind<Cr><c-w><c-w><c-w><c-p>
nmap <D-E> <Esc>:NERDTreeTabsOpen<Cr>:NERDTreeTabsFind<Cr><c-w><c-w><c-w><c-p>
endif
if has("gui_win32")
map <F11> :NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
imap <F11> <Esc>:NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
vmap <F11> <Esc>:NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
nmap <F11> <Esc>:NERDTreeTabsToggle<Cr><c-w><c-w><c-w><c-p>
endif
endif
" easytags
let g:easytags_async = 1
let g:easytags_auto_highlight = 0
let g:easytags_opts = ['-R', '--language-force=python', '--python-kinds=-i']
" Bclose() {{{2
" delete buffer without closing window
function! Bclose()
let curbufnr = bufnr("%")
let altbufnr = bufnr("#")
if buflisted(altbufnr)
buffer #
else
bnext
endif
if bufnr("%") == curbufnr
new
endif
if buflisted(curbufnr)
execute("bdelete! " . curbufnr)
endif
endfunction
" Added Dec-10
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
" Python-mode
" Activate rope
" Keys:
" K Show python docs
" <Ctrl-Space> Rope autocomplete
" <Ctrl-c>g Rope goto definition
" <Ctrl-c>d Rope show documentation
" <Ctrl-c>f Rope find occurrences
" <Leader>b Set, unset breakpoint (g:pymode_breakpoint enabled)
" [[ Jump on previous class or function (normal, visual, operator modes)
" ]] Jump on next class or function (normal, visual, operator modes)
" [M Jump on previous class or method (normal, visual, operator modes)
" ]M Jump on next class or method (normal, visual, operator modes)
let g:pymode_folding = 0
" lint/checkers
let g:pymode_lint_on_write = 1
let g:pymode_lint_checkers = ['pep8', 'pyflakes']
let g:pymode_lint_cwindow = 0
let g:pymode_lint_message = 1
" doc
let g:pymode_doc = 0
let g:pymode_rope_completion = 1
set completeopt=menu
" If you prefer the Omni-Completion tip window to close when a selection is
" made, these lines close it on movement in insert mode or when leaving
" insert mode
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" python-mode bindings
map <leader>j :RopeGotoDefinition<CR>
map <leader>r :RopeRename<CR>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Ansi 1 Color</key>
<dict>
<key>Blue Component</key>
<real>0.14145714044570923</real>
<key>Green Component</key>
<real>0.10840655118227005</real>
<key>Red Component</key>
<real>0.81926977634429932</real>
</dict>
<key>Ansi 10 Color</key>
<dict>
<key>Blue Component</key>
<real>0.38298487663269043</real>
<key>Green Component</key>
<real>0.35665956139564514</real>
<key>Red Component</key>
<real>0.27671992778778076</real>
</dict>
<key>Ansi 11 Color</key>
<dict>
<key>Blue Component</key>
<real>0.43850564956665039</real>
<key>Green Component</key>
<real>0.40717673301696777</real>
<key>Red Component</key>
<real>0.32436618208885193</real>
</dict>
<key>Ansi 12 Color</key>
<dict>
<key>Blue Component</key>
<real>0.51685798168182373</real>
<key>Green Component</key>
<real>0.50962930917739868</real>
<key>Red Component</key>
<real>0.44058024883270264</real>
</dict>
<key>Ansi 13 Color</key>
<dict>
<key>Blue Component</key>
<real>0.72908437252044678</real>
<key>Green Component</key>
<real>0.33896297216415405</real>
<key>Red Component</key>
<real>0.34798634052276611</real>
</dict>
<key>Ansi 14 Color</key>
<dict>
<key>Blue Component</key>
<real>0.56363654136657715</real>
<key>Green Component</key>
<real>0.56485837697982788</real>
<key>Red Component</key>
<real>0.50599193572998047</real>
</dict>
<key>Ansi 15 Color</key>
<dict>
<key>Blue Component</key>
<real>0.86405980587005615</real>
<key>Green Component</key>
<real>0.95794391632080078</real>
<key>Red Component</key>
<real>0.98943418264389038</real>
</dict>
<key>Ansi 2 Color</key>
<dict>
<key>Blue Component</key>
<real>0.020208755508065224</real>
<key>Green Component</key>
<real>0.54115492105484009</real>
<key>Red Component</key>
<real>0.44977453351020813</real>
</dict>
<key>Ansi 3 Color</key>
<dict>
<key>Blue Component</key>
<real>0.023484811186790466</real>
<key>Green Component</key>
<real>0.46751424670219421</real>
<key>Red Component</key>
<real>0.64746475219726562</real>
</dict>
<key>Ansi 4 Color</key>
<dict>
<key>Blue Component</key>
<real>0.78231418132781982</real>
<key>Green Component</key>
<real>0.46265947818756104</real>
<key>Red Component</key>
<real>0.12754884362220764</real>
</dict>
<key>Ansi 5 Color</key>
<dict>
<key>Blue Component</key>
<real>0.43516635894775391</real>
<key>Green Component</key>
<real>0.10802463442087173</real>
<key>Red Component</key>
<real>0.77738940715789795</real>
</dict>
<key>Ansi 6 Color</key>
<dict>
<key>Blue Component</key>
<real>0.52502274513244629</real>
<key>Green Component</key>
<real>0.57082360982894897</real>
<key>Red Component</key>
<real>0.14679534733295441</real>
</dict>
<key>Ansi 7 Color</key>
<dict>
<key>Blue Component</key>
<real>0.79781103134155273</real>
<key>Green Component</key>
<real>0.89001238346099854</real>
<key>Red Component</key>
<real>0.91611063480377197</real>
</dict>
<key>Ansi 8 Color</key>
<dict>
<key>Blue Component</key>
<real>0.53505516052246094</real>
<key>Green Component</key>
<real>0.39142724871635437</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Ansi 9 Color</key>
<dict>
<key>Blue Component</key>
<real>0.073530435562133789</real>
<key>Green Component</key>
<real>0.21325300633907318</real>
<key>Red Component</key>
<real>0.74176257848739624</real>
</dict>
<key>Background Color</key>
<dict>
<key>Blue Component</key>
<real>0.15170273184776306</real>
<key>Green Component</key>
<real>0.11783610284328461</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Bold Color</key>
<dict>
<key>Blue Component</key>
<real>0.56363654136657715</real>
<key>Green Component</key>
<real>0.56485837697982788</real>
<key>Red Component</key>
<real>0.50599193572998047</real>
</dict>
<key>Cursor Color</key>
<dict>
<key>Blue Component</key>
<real>0.51685798168182373</real>
<key>Green Component</key>
<real>0.50962930917739868</real>
<key>Red Component</key>
<real>0.44058024883270264</real>
</dict>
<key>Cursor Text Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
<key>Foreground Color</key>
<dict>
<key>Blue Component</key>
<real>0.51685798168182373</real>
<key>Green Component</key>
<real>0.50962930917739868</real>
<key>Red Component</key>
<real>0.44058024883270264</real>
</dict>
<key>Selected Text Color</key>
<dict>
<key>Blue Component</key>
<real>0.56363654136657715</real>
<key>Green Component</key>
<real>0.56485837697982788</real>
<key>Red Component</key>
<real>0.50599193572998047</real>
</dict>
<key>Selection Color</key>
<dict>
<key>Blue Component</key>
<real>0.19370138645172119</real>
<key>Green Component</key>
<real>0.15575926005840302</real>
<key>Red Component</key>
<real>0.0</real>
</dict>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment