]> git.rmz.io Git - dotfiles.git/blobdiff - vim/vimrc
vim: also pull when reading diary entries
[dotfiles.git] / vim / vimrc
index cf8068e58f342b90b06e9183cece667dd743eceb..90fbf5d4e9e4e9556a3fc26f2e3ac9fe38486043 100644 (file)
--- a/vim/vimrc
+++ b/vim/vimrc
@@ -72,6 +72,8 @@ Plugin 'derekwyatt/vim-protodef'
 " needs editing colorscheme
 " Plugin 'jeaye/color_coded'
 " Check LucHermites plugins: https://github.com/LucHermitte/lh-cpp
+Plugin 'wincent/loupe'
+Plugin 'Ram-Z/vimwiki'
 
 call vundle#end()
 
@@ -443,9 +445,9 @@ nnoremap zx zMzxzt
 
 map <F1> :ls<CR>:b<space>
 
-" move between windows
-nnoremap <C-L> <C-W>w
-nnoremap <C-H> <C-W>W
+" move between windows (skip previewwindow)
+nnoremap <silent> <C-L> <C-W>w:if &previewwindow \| wincmd w \| endif<CR>
+nnoremap <silent> <C-H> <C-W>W:if &previewwindow \| wincmd W \| endif<CR>
 
 "xterm mouse with middleclick paste
 nnoremap <MiddleMouse> i<MiddleMouse>
@@ -655,7 +657,7 @@ let g:unite_source_grep_max_candidates = 2000
 if executable('ag')
     " Use ag in unite grep source.
     let g:unite_source_grep_command = 'ag'
-    let g:unite_source_grep_default_opts = '--smart-case --vimgrep --hidden --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
+    let g:unite_source_grep_default_opts = '--smart-case --vimgrep --ignore ''.hg'' --ignore ''.svn'' --ignore ''.git'' --ignore ''.bzr'''
     let g:unite_source_grep_recursive_opt = ''
 end
 nnoremap <silent> [unite]a :<C-u>Unite grep:.::\12\17<CR>
@@ -664,7 +666,7 @@ command! -nargs=1 Ag Unite grep:.::<args>
 " unite-file_rec {{{3
 if executable('ag')
     " Use ag in unite rec source
-    let g:unite_source_rec_async_command = 'ag --follow --nocolor --nogroup --hidden -g ""'
+    let g:unite_source_rec_async_command = ['ag', '--follow', '--nocolor', '--nogroup', '-g', '']
 end
 nnoremap <silent> [unite]f :<C-u>Unite -start-insert file_rec/async<CR>
 call unite#custom#source('file_rec/async', 'sorters', 'sorter_selecta')
@@ -740,6 +742,15 @@ xmap T <Plug>Sneak_T
 omap t <Plug>Sneak_t
 omap T <Plug>Sneak_T
 
+" vimviki {{{2
+let g:vimwiki_list = [{'path': '$XDG_DATA_HOME/vimwiki'}]
+let g:vimwiki_auto_chdir = 1
+augroup myvimwiki
+  au! BufRead      $XDG_DATA_HOME/vimwiki/index.wiki   !git pull
+  au! BufRead      $XDG_DATA_HOME/vimwiki/diary/*.wiki !git pull
+  au! BufWritePost $XDG_DATA_HOME/vimwiki/*.wiki       exe  '!git add "<afile>";git commit -m"' . strftime("%FT%R") . '";git push'
+augroup END
+
 " functions {{{1
 
 " Convenient command to see the difference between the current buffer and the