From d423247bf1fafd5f76b3f56cb82fdd269559b13f Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Sun, 27 Dec 2020 01:41:01 +0100 Subject: Made the plugin configurable --- README.md | 23 ++++++++++++++++++++--- plugin/vim-karlmarks.vim | 14 ++++---------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3576431..8ba6d83 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,6 @@ plugin will remember you to use more and once you have that on disk you can always deinstall it again. - - ## Prerequirements I recommend you use this in your `~/.vim/vimrc` @@ -25,7 +23,6 @@ I recommend you use this in your `~/.vim/vimrc` because if you set it to `signcolumn=auto` it will flicker when you change the window. - ## Installation Download the [zip file](https://git.entwicklerseite.de/vim-karlmarks/snapshot/vim-karlmarks-master.zip) @@ -42,6 +39,26 @@ and extract it inside `~/.vim/pack/coderonline/start/`. # remove zip file (not needed any more) rm vim-karlmarks.zip +## Configure optional and additional marks + +Here comes some inspiration for additional marks you could enable. Some +are potentially disturbing and were for that reason not pre-configured: + + let g:karlmarks = '"' " position in buffer when left + let g:karlmarks .= '{}' " start/end paragraph + let g:karlmarks .= '()' " start/end sentence + let g:karlmarks .= '[]' " start/end sentence + let g:karlmarks .= '.' " last change + let g:karlmarks .= "^" " insert mode stopped + let g:karlmarks .= "'`" + +but the `g_karlmarks_additional` setting defaults to + + let g:karlmarks_additional = "<>" + +to allow easier modification of the last selected block, e.g. reposition the +start of the block with `m<` and use `gv` to show the new selection. + ## Deinstallation diff --git a/plugin/vim-karlmarks.vim b/plugin/vim-karlmarks.vim index f0699e1..cd54fa5 100644 --- a/plugin/vim-karlmarks.vim +++ b/plugin/vim-karlmarks.vim @@ -1,14 +1,9 @@ -let g:markerbar_additional = '"' " position in buffer when left -let g:markerbar_additional .= '<>' " start/end last selection -let g:markerbar_additional .= '{}' " start/end paragraph -let g:markerbar_additional .= '()' " start/end sentence -let g:markerbar_additional .= '[]' " start/end sentence -let g:markerbar_additional .= '.' " last change -let g:markerbar_additional .= "^" " insert mode stopped -let g:markerbar_additional .= "'`" +if !exists("g:karlmarks") + let g:karlmarks = "<>" +endif function! KarlMarks() - for c in map(split(g:markerbar_additional, '\zs'), "char2nr(v:val)") + + for c in map(split(g:karlmarks, '\zs'), "char2nr(v:val)") + \ range(char2nr('a'), char2nr('z')) + \ range(char2nr('A'), char2nr('Z')) + \ range(char2nr('0'), char2nr('9')) @@ -22,7 +17,6 @@ function! KarlMarks() endif endfor endfunction - autocmd CursorHold * call KarlMarks() " important for distraction free reading while changing windows -- cgit v1.2.3