How to create a "tips" popup in vim

I have a few tips that I'm trying to remember in VIM. It would be great if I could open them in a horizontal split at the top of the current window with a key press (say, F4), and then collapse (switch) again by pressing F4 again.

So, how can I get a text file to open in the (small) split above my current window using the shift keys?

Perhaps there is a plugin that I do not know about this?

+5
source share
1 answer

That should do it. It will only work in normal mode, so it does not interfere with the actual dialing <F4>. Add it to yours .vimrc. Loads the file specified in the preview window. In this case, it is~/vimtips.txt

See this link for more information on the preview window. You can set options such as the size of the preview window, with some other options: http://vimdoc.sourceforge.net/htmldoc/windows.html#preview-window

let g:MyVimTips="off"
function! ToggleVimTips()
  if g:MyVimTips == "on"
    let g:MyVimTips="off"
    pclose
  else
    let g:MyVimTips="on"
    pedit ~/vimtips.txt
  endif
endfunction

nnoremap <F4> :call ToggleVimTips()<CR>
+6
source

All Articles