diff options
author | Max Christian Pohle | 2018-07-10 23:02:09 +0200 |
---|---|---|
committer | Max Christian Pohle | 2018-07-10 23:02:09 +0200 |
commit | 8f350dc3287ae78643fe2711065254e7042b9c8a (patch) | |
tree | 9a2fdc50fa9ec3d693737141c0c50cc3c6f629a8 | |
parent | 15fad7fd1701a16dfd1bf90854606a59473be09b (diff) | |
download | vim-8f350dc3287ae78643fe2711065254e7042b9c8a.tar.bz2 vim-8f350dc3287ae78643fe2711065254e7042b9c8a.zip |
Added preview window function from the help
improved man pager integration
improved fonts for gvim
-rw-r--r-- | CursorHold-example.vim | 37 | ||||
-rw-r--r-- | bashrc | 4 | ||||
-rw-r--r-- | default-font.conf | 61 | ||||
-rw-r--r-- | vimrc-full | 11 |
4 files changed, 110 insertions, 3 deletions
diff --git a/CursorHold-example.vim b/CursorHold-example.vim new file mode 100644 index 0000000..ae55396 --- /dev/null +++ b/CursorHold-example.vim | |||
@@ -0,0 +1,37 @@ | |||
1 | au! CursorHold *.[ch] nested call PreviewWord() | ||
2 | func PreviewWord() | ||
3 | if &previewwindow " don't do this in the preview window | ||
4 | return | ||
5 | endif | ||
6 | let w = expand("<cword>") " get the word under cursor | ||
7 | if w =~ '\a' " if the word contains a letter | ||
8 | |||
9 | " Delete any existing highlight before showing another tag | ||
10 | silent! wincmd P " jump to preview window | ||
11 | if &previewwindow " if we really get there... | ||
12 | match none " delete existing highlight | ||
13 | wincmd p " back to old window | ||
14 | endif | ||
15 | |||
16 | " Try displaying a matching tag for the word under the cursor | ||
17 | try | ||
18 | exe "ptag " . w | ||
19 | catch | ||
20 | return | ||
21 | endtry | ||
22 | |||
23 | silent! wincmd P " jump to preview window | ||
24 | if &previewwindow " if we really get there... | ||
25 | if has("folding") | ||
26 | silent! .foldopen " don't want a closed fold | ||
27 | endif | ||
28 | call search("$", "b") " to end of previous line | ||
29 | let w = substitute(w, '\\', '\\\\', "") | ||
30 | call search('\<\V' . w . '\>') " position cursor on match | ||
31 | " Add a match highlight to the word at this position | ||
32 | hi previewWord term=bold ctermbg=green guibg=green | ||
33 | exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"' | ||
34 | wincmd p " back to old window | ||
35 | endif | ||
36 | endif | ||
37 | endfun | ||
@@ -9,7 +9,9 @@ | |||
9 | # ":enew<CR>:0read !groffer --pager='cat' --tty $1 <bar> col -bx<CR> :set filetype=man buftype=nowrite readonly<CR>gg"; | 9 | # ":enew<CR>:0read !groffer --pager='cat' --tty $1 <bar> col -bx<CR> :set filetype=man buftype=nowrite readonly<CR>gg"; |
10 | # } | 10 | # } |
11 | 11 | ||
12 | export MANPAGER='vim -c":set noswapfile|%!col -b" -c":file man|:setlocal filetype=man buftype=nowrite readonly nonumber nolist signcolumn=no" -' | 12 | # export MANPAGER='vim -c":set noswapfile|%!col -b" -c":file man|:setlocal filetype=man buftype=nowrite readonly nonumber nolist signcolumn=no" -' |
13 | export MANPAGER="vim -M +MANPAGER -" | ||
14 | |||
13 | # man() { /bin/vim ":enew<CR>:0read !groffer --pager='cat' --tty $1 <bar> col -bx<CR> :set filetype=man buftype=nowrite readonly<CR>gg" -; } | 15 | # man() { /bin/vim ":enew<CR>:0read !groffer --pager='cat' --tty $1 <bar> col -bx<CR> :set filetype=man buftype=nowrite readonly<CR>gg" -; } |
14 | # alias git='git -c color.ui=false' | 16 | # alias git='git -c color.ui=false' |
15 | # export GIT_DIFF_OPTS="--no-color" | 17 | # export GIT_DIFF_OPTS="--no-color" |
diff --git a/default-font.conf b/default-font.conf new file mode 100644 index 0000000..b1de279 --- /dev/null +++ b/default-font.conf | |||
@@ -0,0 +1,61 @@ | |||
1 | <?xml version="1.0"?> | ||
2 | <!-- this is a configuration file for fontconfig and should be copied or linked to ~/.config/fontconfig/conf.d/ --> | ||
3 | <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | ||
4 | <fontconfig> | ||
5 | <match> | ||
6 | <edit mode="prepend" name="family"><string>NotoSans-Regular</string></edit> | ||
7 | </match> | ||
8 | <match target="pattern"> | ||
9 | <test qual="any" name="family"><string>serif</string></test> | ||
10 | <edit name="family" mode="assign" binding="same"><string>Noto Serif</string></edit> | ||
11 | </match> | ||
12 | <match target="pattern"> | ||
13 | <test qual="any" name="family"><string>sans-serif</string></test> | ||
14 | <edit name="family" mode="assign" binding="same"><string>Noto Sans Mono Bold</string></edit> | ||
15 | </match> | ||
16 | <match target="pattern"> | ||
17 | <test name="family" qual="any"> | ||
18 | <string>monospace</string> | ||
19 | </test> | ||
20 | <edit binding="strong" mode="assign" name="family"> | ||
21 | <string>SauceCodePro Nerd Font Mono</string> | ||
22 | </edit> | ||
23 | <edit binding="strong" mode="assign" name="weight"> | ||
24 | <int>100</int> | ||
25 | </edit> | ||
26 | <edit binding="strong" mode="assign" name="style"> | ||
27 | <string>dz</string> | ||
28 | </edit> | ||
29 | <edit binding="strong" mode="assign" name="pixelsize"> | ||
30 | <double>14</double> | ||
31 | </edit> | ||
32 | </match> | ||
33 | </fontconfig> | ||
34 | |||
35 | <!-- | ||
36 | family: "Anonymous Pro for Powerline"(s) | ||
37 | family: "Consolas for Powerline"(s) "Consolas for Powerline FixedD"(s) | ||
38 | family: "DejaVu Sans Mono for Powerline"(s) | ||
39 | family: "Droid Sans Mono for Powerline"(s) | ||
40 | family: "Inconsolata for Powerline"(s) | ||
41 | family: "Inconsolata-dz for Powerline"(s) | ||
42 | family: "Liberation Mono for Powerline"(s) | ||
43 | family: "Menlo for Powerline"(s) | ||
44 | family: "Meslo LG L DZ for Powerline"(s) | ||
45 | family: "Meslo LG L for Powerline"(s) | ||
46 | family: "Meslo LG M DZ for Powerline"(s) | ||
47 | family: "Meslo LG M for Powerline"(s) | ||
48 | family: "Meslo LG S DZ for Powerline"(s) | ||
49 | family: "Meslo LG S for Powerline"(s) | ||
50 | family: "PowerlineSymbols"(s) | ||
51 | family: "Source Code Pro for Powerline"(s) | ||
52 | family: "Source Code Pro for Powerline"(s) "Source Code Pro Black"(s) | ||
53 | family: "Source Code Pro for Powerline"(s) "Source Code Pro ExtraLight"(s) | ||
54 | family: "Source Code Pro for Powerline"(s) "Source Code Pro Light"(s) | ||
55 | family: "Source Code Pro for Powerline"(s) "Source Code Pro Medium"(s) | ||
56 | family: "Source Code Pro for Powerline"(s) "Source Code Pro Semibold"(s) | ||
57 | family: "Terminus for Powerline"(s) | ||
58 | family: "Ubuntu Mono derivative Powerline"(s) | ||
59 | family: "xos4 Terminess Powerline"(s) | ||
60 | family: "xos4 Terminus for Powerline"(s) | ||
61 | --> | ||
@@ -164,10 +164,12 @@ if has("gui_running") | |||
164 | 164 | ||
165 | 165 | ||
166 | " its possible to define alternative fonts (order matters) | 166 | " its possible to define alternative fonts (order matters) |
167 | set guifont=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10 | 167 | set guifont=Monospace\ 10 |
168 | set guifont+=Noto\ Sans\ Mono\ Bold | ||
169 | set guifont+=Noto\ Sans\ Mono\ Bold | ||
170 | set guifont+=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10 | ||
168 | set guifont+=Hasklig\ Semi-Bold\ 10 | 171 | set guifont+=Hasklig\ Semi-Bold\ 10 |
169 | set guifont+=Bitstream\ Vera\ Sans\ Mono\ 10 | 172 | set guifont+=Bitstream\ Vera\ Sans\ Mono\ 10 |
170 | set guifont+=Monospace\ 10 | ||
171 | set guifont+=FuraMono\ Nerd\ Font\ Mono\ Medium\ 11 | 173 | set guifont+=FuraMono\ Nerd\ Font\ Mono\ Medium\ 11 |
172 | set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 | 174 | set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 |
173 | set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10 | 175 | set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10 |
@@ -915,6 +917,11 @@ command BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape( | |||
915 | command BufToArg :argadd %:. | 917 | command BufToArg :argadd %:. |
916 | command Gbranch call setqflist([], 'r', {'title':'Git branch selector','items':map(systemlist("git branch"), {_, p->{'filename':'branch','module': fnamemodify(p, ':.')}})}) | 918 | command Gbranch call setqflist([], 'r', {'title':'Git branch selector','items':map(systemlist("git branch"), {_, p->{'filename':'branch','module': fnamemodify(p, ':.')}})}) |
917 | 919 | ||
920 | " the following command opens a preview-window and shows the declaration of | ||
921 | " the function under the cursor. It also highlights the word to make it easier | ||
922 | " to spot within a great file | ||
923 | command Helpme au! CursorHold * nested let @/=expand('<cword>')|exe "silent! psearch ".expand("<cword>") | ||
924 | |||
918 | "======================================================================================================================= | 925 | "======================================================================================================================= |
919 | call plug#end() | " all plugins are getting loaded on this line, don't remove! | 926 | call plug#end() | " all plugins are getting loaded on this line, don't remove! |
920 | 927 | ||