DEV Community

CJ
CJ

Posted on • Originally published at chuanjin.me

1 1

New Vim Hack

Previously I am using spf13 for my vim configuration. However it is a bit sluggish for me since it includes too much settings and plugins which might not be needed for my daily usage, therefore I deicide to move to this vimrc.

New plugins installed manually such as vim-rails, vim-autoformat, YouCompleteMe, tagbar, vim-ctrlp-tjump etc.

Ctags is also needed for go to definition.

I remove/comment out the line to have deafault key mapping for multiple selection in plugins_config.vim

let g:multi_cursor_next_key="\<C-s>"

Here is how it looks for my_configs.vim

set shell=/bin/zsh
" Show line numbers by default
set number
" Remove the red line at 80 column
let g:pymode_options_colorcolumn = 0
" NERT tree show from left
let g:NERDTreeWinPos = "left"
" Colorscheme
if has('gui_running')
set background=light
colorscheme solarized
else
set background=dark
colorscheme peaksea
endif
" Remap the default keys for yankstack
let g:yankstack_map_keys = 0
nmap <leader>p <Plug>yankstack_substitute_older_paste
nmap <leader>P <Plug>yankstack_substitute_newer_paste
nnoremap <c-p> :CtrlP<cr>
" Insert a hash rocket
imap <c-l> <space>=><space>
nnoremap <c-a> ^
nnoremap <c-e> $
nnoremap H gT
nnoremap L gt
nmap <F8> :TagbarToggle<CR>
noremap <F3> :Autoformat<CR>
nnoremap <leader>v :CtrlPtjump<cr>
vnoremap <leader>vv :CtrlPtjumpVisual<cr>
let g:ctrlp_tjump_shortener = ['/home/.*/gems/', '.../']
let g:ctrlp_tjump_only_silent = 1
" Ctag for ruby, with guard-ctags-bundler
set tags+=gems.tags
" Ctag for python
set tags+=mytags
map <leader>n :NERDTreeToggle<cr>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" RENAME CURRENT FILE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! RenameFile()
let old_name = expand('%')
let new_name = input('New file name: ', expand('%'), 'file')
if new_name != '' && new_name != old_name
exec ':saveas ' . new_name
exec ':silent !rm ' . old_name
redraw!
endif
endfunction
map <leader>nn :call RenameFile()<cr>
set guifont=DejaVu\ Sans\ Mono\ for\ Powerline\ 9
set laststatus=2
let g:airline_powerline_fonts = 1
set statusline+=%#warningmsg#
set statusline+=%{SyntasticStatuslineFlag()}
set statusline+=%*
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1
let g:syntastic_check_on_wq = 0
view raw my_configs.vim hosted with ❤ by GitHub

Final look:

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more