junegunn / vim-peekaboo

:eyes: " / @ / CTRL-R
1.12k stars 38 forks source link

[Feature Request] foldcolumn independent window #77

Closed juanMarinero closed 1 year ago

juanMarinero commented 3 years ago

behavior

When opening a vertical split (:vsplit) the foldcolumn setting from original window is set in the vertical split one.

Same happens with vim-peekaboo.

See next screenshots, in its command line I executed :set foldcolumn? just before pressing " in normal mode: 01 2

desired behavior

Either:

Suggestions

Desktop

Ubuntu 20.04 Vim 8.2

Thanks in advance!

juanMarinero commented 3 years ago

See pull request 79 where at start of function! peekaboo#aboo() of vim-peekaboo/autoload/peekaboo.vim I added

let g:foldcolumn_orig=&foldcolumn " at EO-func restore original
set foldcolumn=0  " so peekaboo vsplit has it too

and at end I appended

" restore with window foldcolumn
exec 'set foldcolumn='.g:foldcolumn_orig

But I think I would be clearer with a decorator, like:

nnoremap <leader>z <C-u>:call Peekaboo_aboo_Wrapper()<CR>
function! Peekaboo_aboo_Wrapper(...)
  " python wrapper decorator for Vim
  " ... read https://vim.fandom.com/wiki/Write_your_own_Vim_function

  " before call peekaboo#aboo
  let g:foldcolumn_orig=&foldcolumn
  set foldcolumn=0  " so peekaboo vsplit has it too

  " wrapped function
  let params = [] " not empty, minimun required: list
  :call call (function('peekaboo#aboo'), params)

  " after call peekaboo#aboo
  " wincmd p  " move-cursor-back-to-previous-window-after-splitting
  exec 'set foldcolumn='.g:foldcolumn_orig
endfunction