diff options
author | Max Christian Pohle | 2020-12-27 01:41:01 +0100 |
---|---|---|
committer | Max Christian Pohle | 2020-12-27 01:41:01 +0100 |
commit | d423247bf1fafd5f76b3f56cb82fdd269559b13f (patch) | |
tree | 32ed9696c4f5ed55f03a46ec7109b99674fada94 | |
parent | 1325cded2458f8d72e9d877007a312e35a20b540 (diff) | |
download | vim-karlmarks-d423247bf1fafd5f76b3f56cb82fdd269559b13f.tar.bz2 vim-karlmarks-d423247bf1fafd5f76b3f56cb82fdd269559b13f.zip |
Made the plugin configurable
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | plugin/vim-karlmarks.vim | 14 |
2 files changed, 24 insertions, 13 deletions
@@ -14,8 +14,6 @@ plugin will remember you to use more and once you have that on disk you can | |||
14 | always deinstall it again. | 14 | always deinstall it again. |
15 | 15 | ||
16 | 16 | ||
17 | |||
18 | |||
19 | ## Prerequirements | 17 | ## Prerequirements |
20 | 18 | ||
21 | I recommend you use this in your `~/.vim/vimrc` | 19 | I recommend you use this in your `~/.vim/vimrc` |
@@ -25,7 +23,6 @@ I recommend you use this in your `~/.vim/vimrc` | |||
25 | because if you set it to `signcolumn=auto` it will flicker when you change | 23 | because if you set it to `signcolumn=auto` it will flicker when you change |
26 | the window. | 24 | the window. |
27 | 25 | ||
28 | |||
29 | ## Installation | 26 | ## Installation |
30 | 27 | ||
31 | Download the [zip file](https://git.entwicklerseite.de/vim-karlmarks/snapshot/vim-karlmarks-master.zip) | 28 | 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/`. | |||
42 | # remove zip file (not needed any more) | 39 | # remove zip file (not needed any more) |
43 | rm vim-karlmarks.zip | 40 | rm vim-karlmarks.zip |
44 | 41 | ||
42 | ## Configure optional and additional marks | ||
43 | |||
44 | Here comes some inspiration for additional marks you could enable. Some | ||
45 | are potentially disturbing and were for that reason not pre-configured: | ||
46 | |||
47 | let g:karlmarks = '"' " position in buffer when left | ||
48 | let g:karlmarks .= '{}' " start/end paragraph | ||
49 | let g:karlmarks .= '()' " start/end sentence | ||
50 | let g:karlmarks .= '[]' " start/end sentence | ||
51 | let g:karlmarks .= '.' " last change | ||
52 | let g:karlmarks .= "^" " insert mode stopped | ||
53 | let g:karlmarks .= "'`" | ||
54 | |||
55 | but the `g_karlmarks_additional` setting defaults to | ||
56 | |||
57 | let g:karlmarks_additional = "<>" | ||
58 | |||
59 | to allow easier modification of the last selected block, e.g. reposition the | ||
60 | start of the block with `m<` and use `gv` to show the new selection. | ||
61 | |||
45 | 62 | ||
46 | ## Deinstallation | 63 | ## Deinstallation |
47 | 64 | ||
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 @@ | |||
1 | let g:markerbar_additional = '"' " position in buffer when left | 1 | if !exists("g:karlmarks") |
2 | let g:markerbar_additional .= '<>' " start/end last selection | 2 | let g:karlmarks = "<>" |
3 | let g:markerbar_additional .= '{}' " start/end paragraph | 3 | endif |
4 | let g:markerbar_additional .= '()' " start/end sentence | ||
5 | let g:markerbar_additional .= '[]' " start/end sentence | ||
6 | let g:markerbar_additional .= '.' " last change | ||
7 | let g:markerbar_additional .= "^" " insert mode stopped | ||
8 | let g:markerbar_additional .= "'`" | ||
9 | 4 | ||
10 | function! KarlMarks() | 5 | function! KarlMarks() |
11 | for c in map(split(g:markerbar_additional, '\zs'), "char2nr(v:val)") + | 6 | for c in map(split(g:karlmarks, '\zs'), "char2nr(v:val)") + |
12 | \ range(char2nr('a'), char2nr('z')) + | 7 | \ range(char2nr('a'), char2nr('z')) + |
13 | \ range(char2nr('A'), char2nr('Z')) + | 8 | \ range(char2nr('A'), char2nr('Z')) + |
14 | \ range(char2nr('0'), char2nr('9')) | 9 | \ range(char2nr('0'), char2nr('9')) |
@@ -22,7 +17,6 @@ function! KarlMarks() | |||
22 | endif | 17 | endif |
23 | endfor | 18 | endfor |
24 | endfunction | 19 | endfunction |
25 | |||
26 | autocmd CursorHold * call KarlMarks() | 20 | autocmd CursorHold * call KarlMarks() |
27 | 21 | ||
28 | " important for distraction free reading while changing windows | 22 | " important for distraction free reading while changing windows |