Vim open file with h and l

So, I have the following lines in my vimrc to scroll through autocomplete using jk.

" Making autocompletion work with jk inoremap <expr> j ((pumvisible())?("\<Cn>"):("j")) inoremap <expr> k ((pumvisible())?("\<Cp>"):("k")) 

I was wondering if there would be a way to scroll sentences :tabe<Tab> with h and l ? This is what seems to be the most natural for me, but I could not find anything about how to do this.

+4
source share
2 answers

When using command line termination, regardless of whether you wildmenu or not, and what value you set for wildmode , the cursor remains on the command line, and any printed character you hit is inserted, including, of course, h and l .

With that in mind, do you really think it would be wise to give up the option to insert h and l on the command line?

If you don't like <Tab> , you can try the wildchar parameter, but you cannot get rid of or replace the <Cn> / <Cp> and arrows.

In addition, command line termination is a common function that is not limited to :tabe . :tabe is a red herring.

+1
source

To reassign h and l it looks weird to me. They are really useful, at least you need to write, enter commands, etc.

If you need easy autocomplete tips, you should add these lines to your vimrc:

 set wildmenu set wildmode =list:longest,list:full 

And then add the SuperTab function, it allows autocomplete with Tab and also navigate the menu with Tab. Here is the code:

 imap <Tab> <CR>=SuperTab()<CR> function! SuperTab() if (strpart(getline('.'),col('.')-2,1)=~'^\W\?$') return "\<Tab>" else return "\<Cn>" endif endfunction 

Hope this helps!

0
source

All Articles