what im trying to achieve:
<C-V>to paste text in normal mode in current buffer
- use same
<C-V>to vertically split a file from nerdtree
what i know:
- when you are with your cursor in nerdtree and you press the letter
s, it will split the file under cursor vertically ( from docs:
" s: open vsplit)
what i tried:
:normal sfrom nerdtree buffer, and
it workedlike a charm.
in init.vim i have this:
" this function works, i tried it many times function IsCurrentWindowNERDTree() return exists("t:NERDTreeBufName") && bufwinnr(t:NERDTreeBufName) == winnr() endfunction function Control_v_key_binding() if IsCurrentWindowNERDTree() " problem is here !!! normal s else " this just pastes the text from os clipboard normal "+p endif endfunction nnoremap <C-V> :call Control_v_key_binding()<CR> inoremap <C-V> <C-O>:call Control_v_key_binding()<CR>
in function, i tried:
- execute "normal \s"
- normal \s
- normal s
nnoremap <C-N> :normal s<CR> for control+N and it worked.
function Control_v_key_binding() if IsCurrentWindowNERDTree() normal s else normal "+p endif endfunction " this is really stupid, this configuration works flawlessly nnoremap <C-N> :call Control_v_key_binding()<CR> " and this doesnt work nnoremap <C-V> :call Control_v_key_binding()<CR>
some weird part, i debugged this function and it just wont enter in the first
if, goes automatically on
else, but works on every other case for other keybindings, my function
IsCurrentWindowNERDTree works everytime ; i binded
nnoremap <C-V> :normal s<CR>, doesnt work either.
i dont understand what is wrong with
any ideas? thanks