Domanda

I'm trying to execute an autocommand when a file (buffer?) is opened in vim that will display indentation guides by executing <Leader>ig. I'm using the vundle plugin nathanaelkane/vim-indent-guides

I currently am trying autocmd BufWinEnter <Leader> ig, but that doesn't seem to be working. I've also tried with <Leader>ig.

What do I need to change to make this work?

È stato utile?

Soluzione

vim-indent-guides provides the :IndentGuidesEnable function. You can execute this each time you open a file by adding the following to your .vimrc

autocmd BufReadPre,FileReadPre * :IndentGuidesEnable

Altri suggerimenti

If you want to add normal mode command to autocmd, you could use normal or exec like:

autocmd SomeEvent exec 'normal ' . (exists('mapleader')?mapleader:'\') . 'ig'

I didn't test above line, should work for your case.

Better way I think is, find out what does <Leader>ig mapped to, it could be a function, call the function in your autocmd.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top