Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What line of code I could add to vimrc to make <leader>ig command run when vim starts?

Tags:

vim

I'm new to Vim, sorry for this newbie question. I'm using a vim plugin vim-indent-guides

The default mapping to toggle the plugin is <leader>ig. What modification should be made to make it toggled on when vim-started

like image 464
mko Avatar asked Dec 03 '12 01:12

mko


3 Answers

Sounds like something the plugin might support in its configuration. Vim plugins are generally configured by putting something like

let g:global_variable_for_plugin = 1

in your ~/.vimrc.

Lo and behold, from the vim-indent-guides documentation:

Use this option to control whether the plugin is enabled on Vim startup.

Default: 0. Values: 0 or 1.
>
  let g:indent_guides_enable_on_vim_startup = 0
<
like image 80
Kenneth Cheng Avatar answered Oct 27 '22 09:10

Kenneth Cheng


What you need is to run the following command at vim startup

:IndentGuidesEnable

One of the ways is to add an autocommand to your .vimrc like

au VimEnter * IndentGuidesEnable

There are probably other ways but this looks pretty simple for me.

like image 39
And R Avatar answered Oct 27 '22 11:10

And R


I have no idea why that plugin is not enabled by default but the

IndentGuidesEnable

command seems to do just that. Add it somewhere in your ~/.vimrc.

More generally, mappings are just convenient shortcuts for commands or sequences of commands. You want to execute the command, not the mapping.

like image 1
romainl Avatar answered Oct 27 '22 09:10

romainl