autocmd Questions

7

Solved

I have a Vim autocmd that removes trailing whitespace in files before write. I want this almost 100% of the time, but there are a few filetypes that I'd like it disabled. Conventional wisdom is to ...
Matthia asked 27/6, 2011 at 17:45

2

Solved

This is because I'd like to automatically run tests after each file save. I have looked at autocmd and BufWritePost but cannot make it work.
Gastrectomy asked 7/1, 2011 at 16:26

1

Solved

From this answer I executed: :set modeline | doautocmd BufRead Since then, I cannot disable the BufRead. I can open a file and unset the modeline: :set nomodeline :e! :wq But when I reopen the sa...
Tropous asked 15/10, 2020 at 9:3

4

Is there an autocmd for when the preview window is opened/closed? I want to scroll the main window n lines up when it the preview window is opened, then n lines down when it is closed, to countera...
Underfoot asked 6/6, 2013 at 10:40

6

Basically the title. When I include in my vimrc set iskeyword-=_ and save it, when I reload gvim and type :set iskeyword I still see iskeyword=@,48-57,_,192-255 As you can see, the '_' is ...
Kinsler asked 30/9, 2014 at 14:33

2

The current gf command will open *.pdf files as ascii text. I want the pdf file opened with external tools (like okular, foxitreader, etc.). I tried to use autocmd to achieve it like this: au BufR...
Jessamyn asked 18/10, 2011 at 16:50

2

Solved

I put together the following pile of awesomeness: if !exists("g:AsciidocAutoSave") let g:AsciidocAutoSave = 0 endif fun! AsciidocRefresh() if g:AsciidocAutoSave == 1 execute 'write' execute '...
Lyndseylyndsie asked 24/4, 2013 at 15:15

1

Solved

I have the following line in my .vimrc to automatically beautify js files after I save them: autocmd BufWritePost *.js :call JsBeautify() I want this 99% of the time, but sometimes I just want t...
Boletus asked 9/12, 2016 at 23:56

1

Solved

I wish that each time I ":w" to save a .h/.cpp file in vim, vim will automatically run cpplint to check my format, and change the file if needed. How to specify this with autocmd? Thanks.
Safelight asked 19/11, 2016 at 14:47

1

Solved

When I insert mode sometimes my cursor moved because my palm accidentally placed on trackpad. So, I want to make autocmd to disable mouse on insert mode and enable it in normal mode. I write it li...
Renege asked 14/4, 2016 at 6:27

4

Solved

I want to write some autocmd's that check if the filename is this or that.. I've been trying: autocmd VimEnter * if % is "preamble" | Explore | endif autocmd VimEnter * if %=="preamble" | Explore...
Whip asked 15/5, 2011 at 16:31

1

I'm trying to write a snippet of VimL to allow the user to toggle the hilighting of unwanted trailing whitespace with a hotkey. (This is my first-ever Vim script, beyond copy-pasting things into my...
Taritariff asked 4/8, 2015 at 22:34

2

Solved

From the mighty PEP 8: [P]lease limit all lines to a maximum of 79 characters. For flowing long blocks of text (docstrings or comments), limiting the length to 72 characters is recommended. Wh...
Podiatry asked 26/10, 2010 at 19:22

2

Solved

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-...
Buote asked 21/2, 2014 at 21:38

1

Solved

Possible Duplicate: How can I automatically add some skeleton code when creating a new file with vim I googled and searched on SO for a way to create automatic headers when creating a...
Archon asked 9/12, 2012 at 12:45

2

I am trying to make an auto-cmd triggered by opening a new file with path including test/ and with filename ending in Test.java. Reading in :h autocmd-patterns I can not figure out if either only l...
Avid asked 9/8, 2011 at 17:13

1

Solved

I type really fast and sometimes accidentally save a file with the name consisting of a single ; or :. (A typo is sometimes introduced as I type the :wq command.) Is there any way to write a macro ...
Waters asked 2/6, 2011 at 5:51

2

Solved

I use vim and would like it to prevent me from saving php files that has parse errors. If I would like to use for instance "php -l <file>" to achieve this, how would the autocmd in .vimrc loo...
Cappadocia asked 19/5, 2011 at 8:34

2

Solved

I'm trying to make Vim run the command 'CommandTFlush' whenever a new file is writte. For those not using the Command-T plugin, the 'CommandTFlush' command is used to rebuild an index of files in t...
Ca asked 15/8, 2010 at 8:44

1

Solved

I am trying to implement an AutoCmd in Vim that needs to be executed when the current buffer has been modified. I have read through all the events available for AutoCmd in the docs but could...
Coccidiosis asked 9/4, 2011 at 18:16

3

Solved

I need to do the logical-and of two autocmd events in vim. Basically, the command has to run on an InsertLeave when the FileType is tex. It seems like this should work (in a .vimrc): autocmd FileT...
Chapel asked 21/8, 2009 at 17:14

2

Solved

I'm trying to automate file comment headers. I'm stuck trying to figure out how to insert the result of the uuidgen command into my header using vim's autocmd. Inside the header, the placeholder t...
Fogbow asked 5/5, 2010 at 15:10

2

Solved

I want to use the expand function in an autocmd. In particular, I am adapting a tip by Paul Biggar and I wanted to use the following auto command in my .gvimrc: autocmd FileType tex set makeprg=ru...
Appetence asked 19/11, 2009 at 20:36
1

© 2022 - 2024 — McMap. All rights reserved.