Use a :terminal:
" in ~/.vim/after/ftplugin/python.vim
nnoremap <buffer> <CR> :write <bar> terminal python3 %<CR>
" update b:undo_ftplugin
When the command is finished, you can :set modifiable (:set ma) and edit.
In the end I managed to do this by checking the number of modified buffers.
Once the number of buffers reaches 0, only then run rsync.
" See https://vi.stackexchange.com/a/14313/40380
return len(filter(getbufinfo(), 'v:val.changed == 1'))
autocmd BufWritePost path/to/project/*
You may run
autocmd FileType python map <buffer> <CR> :w<CR>:call Exec('!python3 '.expand('%'))<CR>
exec printf('silent %s',a:cmd)
It writes the output of a command in a new tab.
I ended up combining bits of solutions provided by Luc and Maxim, ending up with the following in my .vimrc:
" clear all mappings starting with space in insert mode
" based on https://vi.stackexchange.com/a/26385/40274
" and https://vi.stackexchange.com/a/26384/40274
function! ClearInsertLeaders() abort
let s:mappings = execute('imap &...
Is this possible using QuitPre?
"Quit" means quitting a buffer as in :quit. You probably want ExitPre instead.
can I implement such functionality using Vimscript?
No, AFAIK, the action cannot be aborted by autocmd.
Based on the user's response, Vim should either quit, or cancel the quit
Simply :set confirm and no worries.
vim-polyglot has addressed this issue.
In commit Use setf for ambiguous extensions from Aug 24, 2020, it started converting from set filetype=... to the setf command, then later commit Make loading faster for ambiguous extensions without heuristics from Sep 29, 2020 expanded the use of setf to other extensions such as .template for filetype json.
This makes ...