Quantcast
Channel: User romainl - Vi and Vim Stack Exchange
Browsing latest articles
Browse All 102 View Live

Comment by romainl on Do we need to escape backslash in character in Vimscript?

Oh, and fuck Copilot.

View Article



Comment by romainl on Extending existing syntax highlighting system-wide

OK, I updated the answer with the presumably correct pacman-contrib.

View Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article


Answer 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 Article

Image may be NSFW.
Clik here to view.

Answer 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 Article

Image may be NSFW.
Clik here to view.

Answer 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 Article

Answer 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 Article


Comment 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 Article

Answer 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 Article


Comment 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 Article

Image may be NSFW.
Clik here to view.

Answer 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 Article


Answer by romainl for Is it possible to totally hide folded lines?

No, what you are asking is impossible.

View Article

Image may be NSFW.
Clik here to view.

Answer 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 Article

Image may be NSFW.
Clik here to view.

Answer 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 Article

Answer 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 Article


Comment 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 Article


Comment by romainl on Usage of pattern for ilist command

Answer amended.

View Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

Comment 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 Article

Comment 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 Article

Comment by romainl on End of sentence dot moves before bold text when using...

Use the plugin's issue tracker.

View Article



Answer 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 Article

Answer 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 Article

Comment by romainl on define a match group for a modeline

What did you try?

View Article

Comment 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 Article


Comment 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 Article

Answer 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 Article

Comment by romainl on Regex searching with escaping

/me discards answer

View Article


Comment 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 Article


Comment 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 Article

Comment 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 Article

Comment by romainl on What is :file in ex-mode?

Also, see vi.stackexchange.com/questions/2136/….

View Article
Browsing latest articles
Browse All 102 View Live




Latest Images