Questions tagged [autocmd]

Vim commands you can specify to be executed automatically when reading or writing a file, when entering or leaving a buffer or window, and when exiting Vim

Vim's documentation on autocmd: http://vimdoc.sourceforge.net/htmldoc/autocmd.html

113 questions
0
votes
1 answer

Disabling autocmd's for special windows

How would I disable autocmd's for entering/leaving windows such ":help", ":NERDTree", or ":TlistOpen"? Right now I modify "eventignore" before and after calling those commands (besides ":help", I don't know how to do that yet), but I can't figure…
user2005303
0
votes
1 answer

Variables of scripts go away with autocmd?

I tried this in .vimrc (which uses vundle): autocmd FileType python Bundle 'ervandew/supertab' and 'ervandew/supertab' also lists in 'BundleList` in a python file. It doesn't work. I don't know why. Maybe my autocmd command was wrong? I suspect the…
emnoor
  • 2,528
  • 2
  • 18
  • 15
0
votes
1 answer

Launch (:normal) command on vim start with .java files

I want to put line in my .vimrc file so that it will fold the /* ... */ like comments on autostart with *.java files. So far I have came up with this but it does not want to work (although the command works in vim) autocmd…
Patryk
  • 22,602
  • 44
  • 128
  • 244
0
votes
0 answers

Vim mapping works in command mode but not when used in autocmd

I have this autocmd in my .vimrc: autocmd Filetype markdown inoremap :call AutoUMDList() When I open a markdown file, enter Insert mode and press , I get the following error: E15: Invalid expression: ^O:call…
Robert Audi
  • 8,019
  • 9
  • 45
  • 67
0
votes
2 answers

Prevent buffer from unloading in autocmd

I'm writing a BufUnload autocmd, and I want to conditionally prevent the buffer from actually being unloaded or closed from within the autocmd. Is there a way to do this? For instance, I want to use the contents of the buffer as a commit message for…
brianmearns
  • 9,581
  • 10
  • 52
  • 79
0
votes
1 answer

Improve autocommand to indent and return to line on BufLeave and FocusLost

I was looking for an autocommand to make Vim do a gg=G on BufLeave and FocusLost so that it would indent the buffer I wasn't using. I didn't like the idea of doing this when I open or save a file because I figured I would get impatient of the larger…
bhoeksem
  • 7
  • 1
  • 5
0
votes
1 answer

Vim: Autocmd for removing colorscheme background fail to run

I'm trying to override the background of all colorschemes when using terminal windows - mostly because I find transparent terminal windows strangely exciting. All my best efforts of research points towards defining an autocmmand that will run…
Daniel
  • 341
  • 2
  • 17
0
votes
2 answers

How to write a pattern that excludes a string from the filename in a vim autocmd

I'd like to define different mappings for files which have the same suffix. E.g. define a general mapping for all ruby files and a different mapping only for rspec files: au BufNewFile,BufRead *_spec.rb map t :w!:!rspec % au…
José Ricardo
  • 1,479
  • 1
  • 14
  • 28
1 2 3 4 5 6 7
8