Comment by romainl on Do we need to escape backslash in character in Vimscript?
Oh, and fuck Copilot.
View ArticleComment by romainl on Extending existing syntax highlighting system-wide
OK, I updated the answer with the presumably correct pacman-contrib.
View ArticleAnswer by romainl for What resources or learning path would you recommend for...
Some people recommend doing vimtutor or going to the manual. I think they are all good recommendations, but what I am looking for is a roadmap from beginner to master.That is your "roadmap". The user...
View ArticleAnswer by romainl for Why does `yW` yank until the end of the WORD, but `W`...
It might be useful to quote :help exclusive, here:A character motion is either inclusive or exclusive. When inclusive, thestart and end position of the motion are included in the operation....
View ArticleAnswer by romainl for Why d$ and v$d behave differently
In the context of :help $:To the end of the line. When a count is given also go[count - 1] lines downward, or as far is possible.|inclusive| motion. [...]"To the end of the line" really means "to the...
View ArticleAnswer by romainl for What is an abandoned buffer in vim?
An "abandoned" buffer is a buffer you left without saving changes.If you have set nohidden (the default value), Vim generally warns you about unsaved changes when you try to leave a modified buffer....
View ArticleAnswer by romainl for Smart and auto indent not indenting as expected for JSX
Your foo.js is assigned the javascript filetype while its content is not actually JavaScript. Ideally, your JSX file should have the .jsx extension, which would make Vim assign the theoretically...
View ArticleAnswer by romainl for How to map q for saving and quitting?
(cross-posted from SO)First things first: Vim is Vim, not Vi. They have lots of things in common but even more differences. If you absolutely want to learn from a book, pick a book about Vim, not a...
View ArticleAnswer by romainl for Convenient way to surround block with markdown...
Turning common but overly expensive sequences of commands into convenient mappings is an integral part of the Vim experience. If you can clearly express that sequence of commands it is generally...
View ArticleAnswer by romainl for Help understanding this :global command
How did you get that command? Did you read :help :g? :help :range?Anyway, let's deconstruct that command::g!^\~/vimfiles/plugin/^-1d _:g/<pattern>/<command> executes <command> on each...
View ArticleAnswer by romainl for How can expand and contract visual selection from a tag...
When using "a something" text objects (at, a(, etc.) in visual mode, you can generally keep using them to expand the visual selection. In this case, you should be able to do vatat to select the parent...
View ArticleAnswer by romainl for delete using command in terminal mode of nvim
You are running a shell in that terminal window, and that shell already has command-line editing capabilities so there is no need to involve Vim at all.In bash, you would simply need to do M-t (which...
View ArticleAnswer by romainl for Rotate list of lines
There are two parts to your question:somehow select a "block" of variable length between two "markers",make the first line of the block the last.This answer addresses the latter part.Moving a given...
View ArticleComment by romainl on Backspaces in script are not interpreted in playback
Yes. And for some reason, Vim handles it correctly when playing back macros while it craps out in the context of -w and -s. FWIW, the exact same thing happens with <Left> (<80>kl) and friends.
View ArticleAnswer by romainl for mapping works on next line instead of current
The problem is caused by the extraneous space between <Esc> and ::inoremap <C-f> <Esc> : exec '.!printf "world"'<CR> ^The right-hand side of a mapping is a macro. It means that...
View ArticleComment by romainl on How to use prettier for formatting markdown files on save?
Yes. My suggestion is to handle the view restoration and the formatting separately but I am not aware of all your circumstances so you might be better off handling the two at the same place. YMMV.
View ArticleAnswer by romainl for Paste in visual block mode
Once you have yanked line from visual mode, you…move the cursor to the first 1 of 111,press <C-v> to enter visual-block mode,extend the visual selection to the first 4 of 444,press I to enter...
View ArticleAnswer by romainl for Is it possible to totally hide folded lines?
No, what you are asking is impossible.
View ArticleAnswer by romainl for Join two buffers into a single buffer
I would:disable Vim's "mouse" handling,select the relevant text with my "mouse",copy it with my terminal/system "copy" feature,open a new buffer in Vim,put the content from the system clipboard,remove...
View ArticleAnswer by romainl for How to define a do-nothing event?
There is no API for defining custom events. What you define are autocommands that are meant to be executed explicitly. Executing those autocommands explicitly is the closest you can get from having...
View ArticleAnswer by romainl for How to copy text to clipboard from status bar...
You can't copy because set mouse=a gives Vim full control of the mouse.Since this is vi.stackexchange.com, a proper Vim solution would simply be to:disable mouse handling with :set mouse=,select...
View ArticleComment by romainl on Store a windows path in a global variable and access it...
Yeah, thanks for the pointer. Now the hardest part : reverting a 25 years habit.
View ArticleAnswer by romainl for Setting variables in file in ftplugin directory
Filetype plugins, whether they are from $VIMRUNTIME/ftplugin, ~/.vim/ftplugin, or ~/.vim/after/ftplugin, are sourced before any syntax script. The "options" you listed in your question are all...
View ArticleAnswer by romainl for User-defined command for tab completion not working "No...
This paragraph, under :help :command-repl vaguely explains what is happening:The replacement text {repl} for a user defined command is scanned for specialescape sequences, using <...> notation....
View ArticleAnswer by romainl for How to guard doautocmd?
Here is the entire :help User, the reading of which is pretty much required before using that event:Never executed automatically. To be used forautocommands that are only executed with":doautocmd".Note...
View ArticleComment by romainl on How to remove incorrect red background for the correct...
Your "old/new" example a) is not highlighted as an error, and b) use the highlight groups perlSubDeclaration and perlSubName, here (Vim 9.1.0). Could you add the full output of $ vim --version to the...
View ArticleComment by romainl on Is there an option that can be set for programs such as...
No. has('unix') and has('macunix') both return 1 on macOS (built-in Vim and MacVim). See this gist for a better method.
View ArticleComment by romainl on End of sentence dot moves before bold text when using...
Use the plugin's issue tracker.
View ArticleAnswer by romainl for Is there any difference between set...
You can do either of the following:set option=valuelet &option = valueand, in vim9script:&option = value:help :set has been there forever because it was part of ex and vi, while :help :let is a...
View ArticleAnswer by romainl for Is there an option that can be set for programs such as...
:make has makeprg, = has equalprg, gq has formatprg,etc. but there is no startprg option or anything that looks like it because there is no higher level feature :start that would require it. Frankly,...
View ArticleComment by romainl on Weird characters in the quickfix list (wsl + docker)
They are escape sequences produced by whatever is outputting/filtering the errors, for formatting, styling, etc. Well written command-line tools shouldn't use any of those by default when used in a...
View ArticleComment by romainl on set noshowcmd to only hide partial commands
Better investigate WHY you get that unexpected behavior than ask for a way to hide it.
View ArticleAnswer by romainl for Quickfix list: I changed the paths of listed files but...
This is fundamentally the same problem as your earlier question about escape sequences: your pipeline sends garbage to Vim and that's where you should put your effort.build_script.sh knows the working...
View ArticleComment by romainl on Can I somehow define the file type in some meta-data?
What you want is called a modeline. See :help modeline.
View ArticleComment by romainl on Can I somehow define the file type in some meta-data?
This a) doesn't answer OP's question, and b) is all magical, without any explanation of what's going on.
View ArticleComment by romainl on What is :file in ex-mode?
Learning to use its documentation is an integral part of learning Vim. Don't half-ass it.
View ArticleComment by romainl on What is :file in ex-mode?
Also, see vi.stackexchange.com/questions/2136/….
View Article
More Pages to Explore .....