From 8f350dc3287ae78643fe2711065254e7042b9c8a Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Tue, 10 Jul 2018 23:02:09 +0200 Subject: Added preview window function from the help improved man pager integration improved fonts for gvim --- CursorHold-example.vim | 37 ++++++++++++++++++++++++++++++ bashrc | 4 +++- default-font.conf | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ vimrc-full | 11 +++++++-- 4 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 CursorHold-example.vim create mode 100644 default-font.conf 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 @@ +au! CursorHold *.[ch] nested call PreviewWord() +func PreviewWord() + if &previewwindow " don't do this in the preview window + return + endif + let w = expand("") " get the word under cursor + if w =~ '\a' " if the word contains a letter + + " Delete any existing highlight before showing another tag + silent! wincmd P " jump to preview window + if &previewwindow " if we really get there... + match none " delete existing highlight + wincmd p " back to old window + endif + + " Try displaying a matching tag for the word under the cursor + try + exe "ptag " . w + catch + return + endtry + + silent! wincmd P " jump to preview window + if &previewwindow " if we really get there... + if has("folding") + silent! .foldopen " don't want a closed fold + endif + call search("$", "b") " to end of previous line + let w = substitute(w, '\\', '\\\\', "") + call search('\<\V' . w . '\>') " position cursor on match + " Add a match highlight to the word at this position + hi previewWord term=bold ctermbg=green guibg=green + exe 'match previewWord "\%' . line(".") . 'l\%' . col(".") . 'c\k*"' + wincmd p " back to old window + endif + endif +endfun diff --git a/bashrc b/bashrc index 04f32fb..24c51a0 100644 --- a/bashrc +++ b/bashrc @@ -9,7 +9,9 @@ # ":enew:0read !groffer --pager='cat' --tty $1 col -bx :set filetype=man buftype=nowrite readonlygg"; # } -export MANPAGER='vim -c":set noswapfile|%!col -b" -c":file man|:setlocal filetype=man buftype=nowrite readonly nonumber nolist signcolumn=no" -' +# export MANPAGER='vim -c":set noswapfile|%!col -b" -c":file man|:setlocal filetype=man buftype=nowrite readonly nonumber nolist signcolumn=no" -' +export MANPAGER="vim -M +MANPAGER -" + # man() { /bin/vim ":enew:0read !groffer --pager='cat' --tty $1 col -bx :set filetype=man buftype=nowrite readonlygg" -; } # alias git='git -c color.ui=false' # 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 @@ + + + + + + NotoSans-Regular + + + serif + Noto Serif + + + sans-serif + Noto Sans Mono Bold + + + + monospace + + + SauceCodePro Nerd Font Mono + + + 100 + + + dz + + + 14 + + + + + diff --git a/vimrc-full b/vimrc-full index f0bcea8..2c86fa2 100644 --- a/vimrc-full +++ b/vimrc-full @@ -164,10 +164,12 @@ if has("gui_running") " its possible to define alternative fonts (order matters) - set guifont=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10 + set guifont=Monospace\ 10 + set guifont+=Noto\ Sans\ Mono\ Bold + set guifont+=Noto\ Sans\ Mono\ Bold + set guifont+=Hasklug\ Nerd\ Font\ Mono\ Semi-Bold\ 10 set guifont+=Hasklig\ Semi-Bold\ 10 set guifont+=Bitstream\ Vera\ Sans\ Mono\ 10 - set guifont+=Monospace\ 10 set guifont+=FuraMono\ Nerd\ Font\ Mono\ Medium\ 11 set guifont+=Source\ Code\ Pro\ for\ Powerline\ SemiBold\ 10 set guifont+=LiterationMono\ Nerd\ Font\ Mono\ 10 @@ -915,6 +917,11 @@ command BuffersToArg :exec ':args '.join(map(range(0, bufnr('$')), 'fnameescape( command BufToArg :argadd %:. command Gbranch call setqflist([], 'r', {'title':'Git branch selector','items':map(systemlist("git branch"), {_, p->{'filename':'branch','module': fnamemodify(p, ':.')}})}) +" the following command opens a preview-window and shows the declaration of +" the function under the cursor. It also highlights the word to make it easier +" to spot within a great file +command Helpme au! CursorHold * nested let @/=expand('')|exe "silent! psearch ".expand("") + "======================================================================================================================= call plug#end() | " all plugins are getting loaded on this line, don't remove! -- cgit v1.2.3