]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
vim: introduce characterize and replace easy align mapping
[dotfiles.git] / vim / vimrc
index f57d3d1e0c8b2f999fdca27ddd83f5f4aa944cf3..19208e52643c3680d70a9d0d3d9c12d46aa2afa8 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -1,8 +1,3 @@
-" My vimrc.
-"
-" Author:   Samir Benmendil <samir.benmendil[at]gmail[dot]com>
-"
-
 " runtimepath {{{1
 set runtimepath ^=$XDG_CONFIG_HOME/vim
 set runtimepath +=$XDG_CONFIG_HOME/vim/after
@@ -54,6 +49,7 @@ Plug 'sjl/gundo.vim'
 Plug 'thinca/vim-qfreplace'
 Plug 'tomtom/tcomment_vim'
 Plug 'tpope/vim-abolish'
+Plug 'tpope/vim-characterize'
 Plug 'tpope/vim-endwise'
 Plug 'tpope/vim-eunuch'
 Plug 'tpope/vim-fugitive'
@@ -612,7 +608,18 @@ nmap <silent> <leader>dd :tab split \| Gdiff \| wincmd h<CR>
 " delete fugitive buffers when closed
 autocmd BufReadPost fugitive://* set bufhidden=delete
 
-nnoremap <silent> <leader>gs :Git<CR>
+function! GitToggle()
+  if buflisted(bufname('.git/index'))
+    bdelete .git/index
+  else
+    Git
+    16wincmd_
+  endif
+endfunction
+command! GitToggle :call GitToggle()
+command! GToggle GitToggle
+nnoremap <silent> <leader>gs :GitToggle<CR>
+
 nnoremap <silent> <leader>gd :Gdiffsplit<CR>
 nnoremap <silent> <leader>gc :echohl WarningMsg \| echo "use \<leader>gcc instead" \| echohl None<CR> 
 nnoremap <silent> <leader>gcc :tab G commit -v<CR>
@@ -629,7 +636,8 @@ nnoremap <silent> <leader>gb :G blame<cr>
 
 augroup fugitive_gstatus
     au!
-    autocmd BufWinEnter */.git/index resize 16
+    autocmd User FugitiveIndex setlocal winfixheight
+    autocmd User FugitiveIndex nmap <buffer> <leader><space> =
 augroup end
 
 " Gundo {{{2
@@ -673,6 +681,9 @@ let g:SignatureMap = {
 
 " switch
 let g:switch_mapping = "<Leader>s"
+let g:switch_custom_definitions = [
+      \   ['yes', 'no']
+      \ ]
 
 " spellrotate
 nmap <silent> z] <Plug>(SpellRotateForward)
@@ -826,8 +837,9 @@ let g:ycm_language_server =
 
 " vim-easy-align {{{2
 " start interactive EasyAlign in visual mode
-vmap <Enter> <Plug>(EasyAlign)
-nmap ga <Plug>(EasyAlign)
+vmap <Enter>   <Esc>:echohl WarningMsg \| echo "EasyAlign mapped to \16<leader>a now" \| echohl None<CR>
+vmap <leader>a <Plug>(EasyAlign)
+nmap <leader>a <Plug>(EasyAlign)
 
 " vim-gtest {{{2
 let g:gtest#highlight_failing_tests = 0