New answers tagged autocmd
0
votes
Autocommand is executed multiple times on filetype
The reason is that every time you switch to a *.py buffer its filetype is set and a new autocommand BufWrite is added to the stack.
Then when you write the buffer all the autocommand BufWrite are ...
0
votes
How to set autocmd for files without a filetype?
I'm assuming you don't want these autocmds to run on every file without a filetype and that there's some condition for when it should execute.
The built-in way to detect extensionless files is ...
1
vote
Create autocmd for downloaded files (filename contains spaces and incrementing numbers)?
setfiletype doesn't work if something else (like vim's ftdetect) already set a filetype
That's the whole purpose of this command and is documented on the relevant help page. When multiple patterns ...
0
votes
How to exclude filetype in autocmd using Neovim's Lua API?
Ok, so I came up with a workaround, which I'm not entirely satisfied with, since it doesn't make my intentions as clear. But it does now behave as I want it to. The workaround is to wrap the vim.wo ...
1
vote
How to detect netrw directory listing from autocommand?
Thanks to Matt's answer I realised I couldn't detect a netrw directory listing in a BufEnter autocommand (unless the code is running from an after directory).
So I switched to using a Filetype netrw ...
2
votes
Accepted
How to detect netrw directory listing from autocommand?
Obviously, netrw intercepts BufEnter itself to set the things up. So upon first BufEnter it depends on which autocmd was registered first: yours or netrw's one. As you want to go after netrw you can ...
Top 50 recent answers are included
Related Tags
autocmd × 424vimrc × 70
vimscript × 51
neovim × 48
filetype × 45
buffers × 32
key-bindings × 25
command-line × 14
save × 13
functions × 12
filetype-tex × 11
vim-windows × 10
insert-mode × 9
netrw × 9
events × 9
regular-expression × 8
terminal × 8
highlight × 8
folding × 8
lua × 8
search × 7
external-command × 7
formatting × 7
quickfix × 7
statusline × 7