We changed our privacy policy. Read more.

New answers tagged

1

I know a reference to a plugin is not an ideal answer, but this is a tricky thing to accomplish generally and I maintain a plugin which seems to do exactly what you ask for so I'll mention it. The plugin match-up supports text objects a% and i% corresponding to pairs which were originally defined by matchit's % (matchit is a built-in plugin in vim which ...


1

Prepend runtimepath with ~/.vim, See :h :set^= :se[t] {option}^={value} *:set^=* Multiply the {value} to a number option, or prepend the {value} to a string option. When the option is a comma separated list, a comma is added, unless the value was empty. Also see |:set-args| above.


1

Here is the file in question with commented lines that contain useful tips to create your own ale linter. I hope it can provide a useful template for others to use : " Description: norminette linter for C files. " " Get the norminette with : " " python3 -m pip install --upgrade pip setuptools " python3 -m pip install norminette &...


0

A rough sketch with lots of bugs, probably. The function names could use some work, too. function Templates(ext) abort return glob(printf('~/Documents/Library/**/*.%s', a:ext), v:false, v:true) endfunction function ChooseTemplateAll() abort const ext = fnamemodify(@%, ':e') call popup_menu(Templates(ext), #{callback: 'SelectedTemplate', title: '...


1

Here are some examples. (Note that your keywordAs already covers the bullet, you just need to highlight it as you want.) When the delimiters are always on the same line, this is probably the simplest way to go: syntax match Important /!!.*!!/ But to be more flexible, allowing delimiters anywhere, use a region: " Don't use Question; it's a `:help ...


1

If you want to automate this process I would go with regular vimscript + vim api: let output = system('w3m -dump someurl.com') let output = substitute(output, 'regex', 'replace', 'g') " do smth else with output "... "... " append output to the current buffer after current line call append('.', split(output, '\n')) If you really want to ...


1

Why the second version doesn't work? Because there is nothing mapped to <C-Space><C-^>. Space separates a sequence of keys and a mapped value. Are there explanations/rules/best practices where to put and not put spaces when we define mappings in Vim? :h :map is concise indeed. :map {lhs} {rhs} should tell you that there should be a space ...


1

:h :set+= :se[t] {option}+={value} *:set+=* Add the {value} to a number option, or append the {value} to a string option. When the option is a comma separated list, a comma is added, unless the value was empty. If the option is a list of flags, superfluous flags are ...


1

You were close with trying a map command, but you want to define a command line mode mapping, not a normal mode mapping. cnoremap cup tabdo call MapRunCmd()<CR>


1

@ChristianBrabandt 's simple solution type :Cup in vim command line, it will turn into :tabdo call MapRunCmd() :com -nargs=0 Cup tabdo call MapRunCmd()


2

:help maparg() explains that maparg('<C-L>', 'n') will return the normal mode mapping assigned to control-L. When there is no mapping for <C-L>, then it will return an empty string...so it's politely checking for the existence of a mapping before assign the mapping. Concerning ==# with an empty string, some plugin authors automatically use ==# ...


0

If I understand correctly, Maxim Kim's solution was close to perfect, the only missing thing is that the exact command to run should be specific to the current project. IOW, the value to use should be buffer local. As this is something I do a lot in my plugins, I've factorized everything regarding option fetching to option toggling (I also have a :Toggle ...


1

In vim, I open a terminal using :term and enter the normal mode using . Then, :Explore does not open the vim's file navigation view, but creates a another split window of the current terminal session. That is how it should be. I would like to know why this is happening, and how to fix it. Thank you! :Explore is provided by built-in netrw plugin. You can ...


3

It's explained in :help :silent *:sil* *:silent* *:silent!* :sil[ent][!] {command} Execute {command} silently. Normal messages will not be given or added to the message history. When [!] is added, error messages will also be skipped, and commands and mappings will not be aborted when ...


2

:r inserts the contents of a file. It does not overwrite existing contents. Since a new file opened in Vim can't have zero lines* you'll be adding the file's contents to one blank line. Simplest thing to do is just add an additional command to your autocommand: autocmd BufNewFile *.cpp 0r C:\Users\User\Desktop\cp\Template.cpp | $d So we use | to indicate an ...


1

For starters, the first command (:call TwiddleCase(%)) is missing the + (or -c) that must precede all commands. And you shouldn't need that trailing cat. Oh and stylistically, IMO, it's a little clearer to keep the +s outside the command-enclosing quotes. So... echo "110511093 some dude" | vim -es +'call TwiddleCase(%)' +'%print' +':q!' /dev/stdin ...


Top 50 recent answers are included