Skip to content

Instantly share code, notes, and snippets.

@hiveer
Last active May 17, 2018 08:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiveer/be8b4b6fb0fcb06fbb562038f81a3c64 to your computer and use it in GitHub Desktop.
Save hiveer/be8b4b6fb0fcb06fbb562038f81a3c64 to your computer and use it in GitHub Desktop.
some features I used in my vim config
" 修改leader键
let mapleader = ','
let g:mapleader = ','
nnoremap <leader>tr :!ctags -R --languages=Ruby<CR>
nnoremap <leader>tj :!ctags -R --languages=Javascript<CR>
" set grepprg=ack\ --nogroup\ --column\ $*
set grepprg=ag\ --vimgrep
set grepformat=%f:%l:%c:%m
" Add the current file's directory to the path if not already present.
autocmd BufRead *
\ let s:tempPath=escape(escape(expand("%:p:h"), ' '), '\ ') |
\ exec "set path+=".s:tempPath
" paste with 0 register
nnoremap cp "0p
" paste with system clipboard register
nnoremap sp "*p
nnoremap <leader>c :!bundle exec rspec %<cr>
nnoremap <leader>n :execute "!bundle exec rspec %:" . line(".")<cr>
" Automatically removing all trailing whitespace
" http://vim.wikia.com/wiki/Remove_unwanted_spaces
autocmd BufWritePre * :%s/\s\+$//e
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
set clipboard+=unnamed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment