diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index a071eec..0a65536 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -35,15 +35,18 @@ Plug 'christoomey/vim-tmux-navigator' Plug 'jeffkreeftmeijer/vim-numbertoggle' Plug 'justinmk/vim-sneak' Plug 'RRethy/vim-illuminate' + +Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim +Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs + " editing Plug 'tpope/vim-commentary' " easily toggle comments for lines, paragraphs etc with gc Plug 'tpope/vim-surround' " lets you change surrounding things with cs (or ds to del, ys to add) Plug 'tommcdo/vim-exchange' " adds exchange operator with cx. common use: cxiw . on 2 words to switch Plug 'jiangmiao/auto-pairs' " Auto close brackets and '' Plug 'junegunn/vim-easy-align' " Align tables and other alignable things +Plug 'junegunn/vim-peekaboo' " Show the contents of regiseters on pasting from '', @, -Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show a directory listing within vim -Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': ['NERDTreeToggle', 'NERDTreeFind'] } " show git status in nerdtree for files and dirs " Fuzzy matching Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin' } Plug 'junegunn/fzf.vim' diff --git a/nvim/.config/nvim/plugin/vim-peekaboo.vim b/nvim/.config/nvim/plugin/vim-peekaboo.vim new file mode 100644 index 0000000..7f1d400 --- /dev/null +++ b/nvim/.config/nvim/plugin/vim-peekaboo.vim @@ -0,0 +1,31 @@ +" PLUGIN: vim-peekaboo +let g:peekaboo_delay=500 + +function! CreateCenteredFloatingWindow() + let width = float2nr(&columns * 0.6) + let height = float2nr(&lines * 0.6) + let top = ((&lines - height) / 2) - 1 + let left = (&columns - width) / 2 + let opts = {'relative': 'editor', 'row': top, 'col': left, 'width': width, 'height': height, 'style': 'minimal'} + + let top = "╭" . repeat("─", width - 2) . "╮" + let mid = "│" . repeat(" ", width - 2) . "│" + let bot = "╰" . repeat("─", width - 2) . "╯" + let lines = [top] + repeat([mid], height - 2) + [bot] + let s:buf = nvim_create_buf(v:false, v:true) + call nvim_buf_set_lines(s:buf, 0, -1, v:true, lines) + call nvim_open_win(s:buf, v:true, opts) + set winhl=Normal:Floating + let opts.row += 1 + let opts.height -= 2 + let opts.col += 2 + let opts.width -= 4 + call nvim_open_win(nvim_create_buf(v:false, v:true), v:true, opts) + au BufWipeout exe 'bw '.s:buf +endfunction + +if has('nvim-0.4.0') || has("patch-8.2.0191") + let g:peekaboo_window = "call CreateCenteredFloatingWindow()" +else " Fallback to a split window + let g:peekaboo_window={"window": "vert bo 30new"} +endif