vim9script setlocal commentstring=//%s setl path-=/usr/include def Make() if filereadable("Makefile") Sh make else var fname = expand("%:p:r") exe $"Sh make {fname} && chmod +x {fname} && {fname}" endif enddef nnoremap Make() b:undo_ftplugin ..= ' | exe "nunmap "' # nnoremap make %<:redraw!:!./%< # b:undo_ftplugin ..= ' | exe "nunmap "' # if exists("g:loaded_lsp") # setlocal keywordprg=:LspHover # nnoremap gd LspGotoDefinition # b:undo_ftplugin ..= ' | setl keywordprg<' # b:undo_ftplugin ..= ' | exe "nunmap gd"' # endif # In insert mode type 'FF e 10' and it will insert 'for (int e = 0; e < 10; ++e) {.' iab FF :FF command -nargs=* FF call FF() def FF(i: string, x: string) var t = $'for (int {i} = 0; {i} < {x}; ++{i}) {{' exe 'normal! a' .. t exe "normal o\\\e" exe "normal o}\ekA" enddef