dotfiles

Personal dotfiles
git clone https://git.bracken.jp/dotfiles.git
Log | Files | Refs | LICENSE

commit 848cd54650c1560794b11826a4668dff7eac3408
parent 0e504b47a31894e508a55aae23df384d1534b89d
Author: Chris Bracken <chris@bracken.jp>
Date:   Fri, 22 May 2020 16:51:43 -0700

Limit some cscope, vimwiki mappings to filetypes

Limited cscope <leader> mappings to c,cpp,objc files.
Limited vimwiki diary prev/next <leader> mappings to vimwiki files.

Diffstat:
M.vim/plugin/cscope.vim | 88++++++++++++++++++++++++++++++++++++++++----------------------------------------
M.vim/spell/en.utf-8.add | 2++
M.vim/vimrc | 12+++++++++---
3 files changed, 55 insertions(+), 47 deletions(-)

diff --git a/.vim/plugin/cscope.vim b/.vim/plugin/cscope.vim @@ -14,56 +14,56 @@ " when it was compiled. If it wasn't, time to recompile vim... if has("cscope") - """"""""""""" Standard cscope/vim boilerplate + """"""""""""" Standard cscope/vim boilerplate - " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' - set cscopetag + " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' + set cscopetag - " check cscope for definition of a symbol before checking ctags: set to 1 - " if you want the reverse search order. - set csto=0 + " check cscope for definition of a symbol before checking ctags: set to 1 + " if you want the reverse search order. + set csto=0 - " add any cscope database in current directory - if filereadable("cscope.out") - cs add cscope.out - " else add the database pointed to by environment variable - elseif $CSCOPE_DB != "" - cs add $CSCOPE_DB - endif + " add any cscope database in current directory + if filereadable("cscope.out") + cs add cscope.out + " else add the database pointed to by environment variable + elseif $CSCOPE_DB != "" + cs add $CSCOPE_DB + endif - " show msg when any other cscope db added - set cscopeverbose + " show msg when any other cscope db added + set cscopeverbose - """"""""""""" My cscope/vim key mappings - " - " The following maps all invoke one of the following cscope search types: - " - " 's' symbol: find all references to the token under cursor - " 'g' global: find global definition(s) of the token under cursor - " 'c' calls: find all calls to the function name under cursor - " 't' text: find all instances of the text under cursor - " 'e' egrep: egrep search for the word under cursor - " 'f' file: open the filename under cursor - " 'i' includes: find files that include the filename under cursor - " 'd' called: find functions that function under cursor calls - " - " All of the maps involving the <cfile> macro use '^<cfile>$': this is so - " that searches over '#include <time.h>" return only references to - " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all - " files that contain 'time.h' as part of their name). + """"""""""""" My cscope/vim key mappings + " + " The following maps all invoke one of the following cscope search types: + " + " 's' symbol: find all references to the token under cursor + " 'g' global: find global definition(s) of the token under cursor + " 'c' calls: find all calls to the function name under cursor + " 't' text: find all instances of the text under cursor + " 'e' egrep: egrep search for the word under cursor + " 'f' file: open the filename under cursor + " 'i' includes: find files that include the filename under cursor + " 'd' called: find functions that function under cursor calls + " + " All of the maps involving the <cfile> macro use '^<cfile>$': this is so + " that searches over '#include <time.h>" return only references to + " 'time.h', and not 'sys/time.h', etc. (by default cscope will return all + " files that contain 'time.h' as part of their name). - " To do the first type of search, hit the leader key, followed by one of - " the cscope search types above (s,g,c,t,e,f,i,d). The result of your - " cscope search will be displayed in the current window. You can use - " CTRL-T to go back to where you were before the search. + " To do the first type of search, hit the leader key, followed by one of + " the cscope search types above (s,g,c,t,e,f,i,d). The result of your + " cscope search will be displayed in the current window. You can use + " CTRL-T to go back to where you were before the search. - nmap <leader>s :cs find s <C-R>=expand("<cword>")<CR><CR> - nmap <leader>g :cs find g <C-R>=expand("<cword>")<CR><CR> - nmap <leader>c :cs find c <C-R>=expand("<cword>")<CR><CR> - nmap <leader>t :cs find t <C-R>=expand("<cword>")<CR><CR> - nmap <leader>e :cs find e <C-R>=expand("<cword>")<CR><CR> - nmap <leader>f :cs find f <C-R>=expand("<cfile>")<CR><CR> - nmap <leader>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> - nmap <leader>d :cs find d <C-R>=expand("<cword>")<CR><CR> + au FileType c,cpp,objc nmap <leader>s :cs find s <C-R>=expand("<cword>")<CR><CR> + au FileType c,cpp,objc nmap <leader>g :cs find g <C-R>=expand("<cword>")<CR><CR> + au FileType c,cpp,objc nmap <leader>c :cs find c <C-R>=expand("<cword>")<CR><CR> + au FileType c,cpp,objc nmap <leader>t :cs find t <C-R>=expand("<cword>")<CR><CR> + au FileType c,cpp,objc nmap <leader>e :cs find e <C-R>=expand("<cword>")<CR><CR> + au FileType c,cpp,objc nmap <leader>f :cs find f <C-R>=expand("<cfile>")<CR><CR> + au FileType c,cpp,objc nmap <leader>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR> + au FileType c,cpp,objc nmap <leader>d :cs find d <C-R>=expand("<cword>")<CR><CR> endif diff --git a/.vim/spell/en.utf-8.add b/.vim/spell/en.utf-8.add @@ -128,3 +128,5 @@ www xml yoghurt zsh +repo +repos diff --git a/.vim/vimrc b/.vim/vimrc @@ -100,15 +100,21 @@ let wiki_2.nested_syntaxes = {'c++': 'cpp', 'dart': 'dart'} let g:vimwiki_list = [wiki_1, wiki_2] " Personal wiki diary index, new entry, task list -nmap <leader>ji <Plug>VimwikiDiaryIndex +nmap <leader>jw <Plug>VimwikiIndex +nmap <leader>jd <Plug>VimwikiDiaryIndex nmap <leader>jn <Plug>VimwikiMakeDiaryNote nmap <leader>jt :e ~/Documents/wiki/Tasks.wiki<CR> " Work wiki diary index, new entry, task list -nmap <leader>ki <Plug>VimwikiDiaryIndex +nmap <leader>kw 2<Plug>VimwikiIndex +nmap <leader>kd 2<Plug>VimwikiDiaryIndex nmap <leader>kn 2<Plug>VimwikiMakeDiaryNote nmap <leader>kt :e ~/Documents/gwiki/Tasks.wiki<CR> +" Wiki diary previous, next day +au FileType vimwiki nmap <leader>dp <Plug>VimwikiDiaryPrevDay +au FileType vimwiki nmap <leader>dn <Plug>VimwikiDiaryNextDay + " Colorscheme and syntax highlighting if &t_Co > 2 syntax enable @@ -160,7 +166,7 @@ endif " Functions " Insert the current date in '2020-04-22 (Thu)' format -nnoremap <buffer><Leader>cd :put =strftime('%Y-%M-%d (%a)')<CR> +nnoremap <Leader>cd i<C-R>=strftime('%Y-%M-%d (%a)')<CR><Esc> " Apply clang-format to a range of lines (or all) function ClangFormat()