New answers tagged

2

I don't think you need exec in your command. !open <URL> in itself is a complete command recognized by Vim. So simply, :silent !open https://vi.stackexchange.com/ is sufficient! EDIT: As OP mentioned edits so here is a detailed explanation of why URLs containing ampersand & won't work without using either quotes or escape character. In OP's edit 2 ...


0

These commands should do the trick :global/pattern/.+1,.+Ndelete :global/pattern/\/+1,\/+Ndelete The key is to understand [range] for delete command. .+1 one line after cursor line .+N N lines after cursor line \/+1 one line after current match \/+N N lines after current match See :help cmdline-ranges for more details. Be aware it will delete pattern if ...


1

Open mode (from the :open command) is a bit of a legacy command: *:o* *:op* *:open* :[range]o[pen] Works like |:visual|: end Ex mode. {Vi: start editing in open mode} :[range]o[pen] /pattern/ As above, additionally move the cursor to the column where "pattern" matches in the ...


2

Unlike Maxin's answer, I'd recommend to use a ftplugin. They're really made to store the definition of filetype related mappings, commands, abbreviations, options, variables... While we shall use <buffer> with mappings and abbreviations, it's -b with commands. Now the problem is that you want to implement is quite complex. Vim main tool is regex. And ...


1

Unfortunately there is nothing like that. In my library plugin, I've implemented a generic feature that takes care of restoring options, variables (where restoring may means :unlet), mappings, or trigger some other actions at the end of a sequence of operations. But it's not meant to be used on the fly. It's too verbose for that. let cleanup = lh#on#exit() ...


1

You cannot have a command started with lowercase letter, use :Stripdbg or :StripDbg To define a command available only in specific filetype you can define it in autocommand event with -buffer parameter: augroup cpp_group | au! au FileType cpp command! -buffer StripDbg call StripDbg() augroup end You have to implement StripDbg() function to do actual ...


Top 50 recent answers are included