From d6f121f28fe129055ff18f16ab764bd3c744355f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 2 Mar 2015 17:58:40 +0100 Subject: [PATCH] Starting port of old configuration Also, documenting it as I go. Especially keyboard shortcuts. --- cfg/03-hlsearch.vim | 2 ++ cfg/03-mouse.vim | 14 ++++++++++++++ cfg/04-local-help.vim | 9 +++++++++ cfg/05-folding.vim | 6 ++++++ cfg/05-visible-whitespace.vim | 32 ++++++++++++++++++++++++++++++++ doc/heavim.txt | 15 +++++++++++++++ doc/tags | 2 ++ 7 files changed, 80 insertions(+) create mode 100644 cfg/03-hlsearch.vim create mode 100644 cfg/03-mouse.vim create mode 100644 cfg/04-local-help.vim create mode 100644 cfg/05-folding.vim create mode 100644 cfg/05-visible-whitespace.vim create mode 100644 doc/heavim.txt create mode 100644 doc/tags diff --git a/cfg/03-hlsearch.vim b/cfg/03-hlsearch.vim new file mode 100644 index 0000000..80c8b18 --- /dev/null +++ b/cfg/03-hlsearch.vim @@ -0,0 +1,2 @@ +set hlsearch +nnoremap :nohlsearch diff --git a/cfg/03-mouse.vim b/cfg/03-mouse.vim new file mode 100644 index 0000000..ecfb536 --- /dev/null +++ b/cfg/03-mouse.vim @@ -0,0 +1,14 @@ +" Enable mouse by default, provide M shortcut to toggle on/off + +function! ToggleMouse() + if &g:mouse != "" + echo "Mouse disabled." + set mouse= + else + echo "Mouse enabled." + set mouse=a + endif +endfunction + +set mouse=a +nnoremap M :call ToggleMouse() diff --git a/cfg/04-local-help.vim b/cfg/04-local-help.vim new file mode 100644 index 0000000..fb0a05d --- /dev/null +++ b/cfg/04-local-help.vim @@ -0,0 +1,9 @@ +" If 'doc' directories exist in the local / main configuration, use them + +if isdirectory( g:vim_home . "/doc" ) + execute "helptags" g:vim_home . "/doc" +endif + +if exists( "g:vim_local_path" ) && isdirectory( g:vim_local_path . "/doc" ) + execute "helptags" g:vim_local_path . "/doc" +endif diff --git a/cfg/05-folding.vim b/cfg/05-folding.vim new file mode 100644 index 0000000..519b08f --- /dev/null +++ b/cfg/05-folding.vim @@ -0,0 +1,6 @@ +" Folding is enabled by default in marker mode. +" The plus key opens/closes folds. + +set foldenable +set foldmethod=marker +nnoremap + za diff --git a/cfg/05-visible-whitespace.vim b/cfg/05-visible-whitespace.vim new file mode 100644 index 0000000..eee3280 --- /dev/null +++ b/cfg/05-visible-whitespace.vim @@ -0,0 +1,32 @@ +" Trailing spaces and visible tabs +" +" Trailing spaces are visible in normal or visual mode, but hidden in insert +" mode. Tabs can be displayed or hidden using T. + +set list +set listchars="" +set listchars+=trail:• +set listchars+=tab:\ \ +let s:VisibleTabs = 0 + +function! s:UpdateListChars(type,value) + let lc = filter( split( &l:listchars , "," ) , "v:val !~ '^" . a:type . ":'" ) + [ a:type . ":" . a:value ] + let &l:listchars = join( lc , "," ) +endfunction + +function! SwitchVisibleTabs() + if s:VisibleTabs == 1 + let s:VisibleTabs = 0 + call s:UpdateListChars( "tab" , " " ) + else + let s:VisibleTabs = 1 + call s:UpdateListChars( "tab" , "» " ) + endif +endfunction + +nnoremap T :call SwitchVisibleTabs() +augroup TrailingWhitespace + autocmd! + autocmd InsertEnter * :call UpdateListChars( "trail" , " " ) + autocmd InsertLeave * :call UpdateListChars( "trail" , "•" ) +augroup END diff --git a/doc/heavim.txt b/doc/heavim.txt new file mode 100644 index 0000000..a920e27 --- /dev/null +++ b/doc/heavim.txt @@ -0,0 +1,15 @@ +*heavim.txt* A really heavy Vim configuration + +1. Keyboard shortcuts |heavim-shortcuts| + +============================================================================= +1. KEYBOARD SHORTCUTS ~ *heavim-shortcuts* + +Note: Heavim defines Space as the global leader key, and comma (',') as the +local leader key. + + + Toggle folds + + Clear highlighted search + M Toggle mouse + T Toggle visible tabs diff --git a/doc/tags b/doc/tags new file mode 100644 index 0000000..52da459 --- /dev/null +++ b/doc/tags @@ -0,0 +1,2 @@ +heavim-shortcuts heavim.txt /*heavim-shortcuts* +heavim.txt heavim.txt /*heavim.txt*