Questions tagged [command-line]

Questions on ex- or colon-commands. For questions about command-line options used to launch the editor, use the [invocation] tag.

Filter by
Sorted by
Tagged with
0 votes
1 answer
17 views

Convert sequence of external commands to a Vim custom command

To reformat Markdown tables, I use the following sequence of external commands (e.g. after visually selecting my table lines): :<,>! sed 's/[[:space:]]\{1,\}\|/\#\|/g' :<,>! column -t -s '\...
gjherbiet's user avatar
1 vote
1 answer
28 views

List Vim arguments options

Is there a way to list the command line arguments showed by vim -h or vim --help from within Vim? Besides :r!vim -h which seems to be a workaround to achieve this.
ranemirusG's user avatar
2 votes
1 answer
225 views

How to obtain Vim's command line?

I want to see what shell command line were used to start Vim. For example, I used command vim -S Session.vim argv() and argc() don't show switches and it's parameters. Command :echo tr(join(readfile(&...
hobo-mts's user avatar
  • 123
0 votes
1 answer
52 views

NeoVim - Interact with the thing that pop ups when you type in a command

Questions How can I type something in there? What even is the name of this thing? Problem If you type in for example :!echo 'Hello World' This kinda terminal thing pops up I want to interact with ...
Pixelbog's user avatar
  • 325
0 votes
4 answers
52 views

How to repeat substitution on the consequent lines?

Say I want to fix a mistake in the following php code: $line1 = intval($line[$1]); $line2 = intval($line[$2]); $line3 = intval($line[$3]); and do substitution on the first line with: :s/\$\(\d\)/\1/ #...
l00p's user avatar
  • 243
2 votes
2 answers
450 views

Applying commands to buffer from Neovim command line with complex plugin managers

I come from the following problem: I'm using Neovim (0.8.3) with AstroNvim as plugin/everything-manager. I've successfully set up multiple LSP servers from within that, which use the right servers, ...
Marcus Müller's user avatar
1 vote
1 answer
58 views

Map to for loop

How can I make a mapping that includes a for-loop? xnoremap <leader>y :for i in [1, 2, 3, 4] | echo i | endfor errors E121: Undefined variable: i and xnoremap <leader>y :for line in ...
theonlygusti's user avatar
  • 2,189
0 votes
2 answers
51 views

How to open files from terminal in desired pattern (tabs, vertical and horizontal splits on desired files)

So, I wrote next bash script: #!/bin/bash if [ "$#" -gt 1 ]; then path=$1 else path=$(cat subject.txt | tr -d '\n') fi nvim -p 1 "setup/$path/body.tex" -p 1 preamble/...
Vladyslav Rehan's user avatar
0 votes
0 answers
12 views

Why recording typed characters by "qa" into reg a has different behavior for typed <M-Z> vs. <M-z>?

Case 1: In Excmd line I give qa to begin recording. I type \Alt Z (upper case Z) error message: E11: Invalid in command-line window:\<blank\>:q<CR> closes the window I give q for end ...
Anton Wessel's user avatar
1 vote
1 answer
28 views

Why does the command ":g x" show all lines matching the last search?

I accidentally stumbled on a solution for a problem I had: I wanted to get an overview over all occurrances of the word under the cursor, after I used # to find them individually. For some reason I ...
mkrieger1's user avatar
  • 135
1 vote
1 answer
70 views

Multiple "1 line >ed" messages

When I perform multiple shift :> operations, vim shows me a notification for each line that's shifted. Is there a way to avoid these multiple notifications? For example, I'm currently editing a ...
Keith Thompson's user avatar
0 votes
1 answer
62 views

How in Vim to visual select lines from command mode?

In vim we can move, copy or delete lines from command line Copy from 12 to 14 code and paste here: :12,14t. Move code from lines 14 - 16 to 20: :14,16m20 But how to make visual selection from line ...
serii 's user avatar
  • 59
1 vote
0 answers
263 views

How to create a (lua) function to run a particular command in the shell on the currently open file, within neovim

If I'm working on a file I might want to run a particular command which uses the file within the shell. Example - running black (python formatter) on an open file. Ideally I'd like to be able to enter ...
baxx's user avatar
  • 965
1 vote
2 answers
44 views

Make ":w" command throw an error on filenames starting with a colon ":"

From time to time I accidentally create files with names like ":w" or ":q". This happens when instead of writing :wq I type :w:q and sometimes, for some reason, even :w:w or :w :w. ...
Karolis Koncevičius's user avatar
0 votes
1 answer
217 views

How to get the total lines of a file before it's loaded into a buffer?

As title. My target is to disable a plugin before it is applied to a buffer that will be loaded with the content of a file. I can get the file name before it is loaded. The file to be opened is ...
NeoZoom.lua's user avatar
  • 1,232
1 vote
1 answer
80 views

How to add action before "gf"?

I'm using NVIM 0.8.2 I'd like to replace the default gf command (goto file under the cursor) to do something before and after the action. For example: echo "do something before" goto file/...
Lai32290's user avatar
  • 245
1 vote
2 answers
97 views

Ignore/map case in command prompt :edit fileName

I would like to use case-ignoring completion in the file arguments I pass to (n)vim in the internal command prompt: For example, :edit case<tab> should suggest caselower.txt and Caseupper.txt. ...
mcint's user avatar
  • 113
1 vote
1 answer
85 views

ci" or ci' doesn't work in vim key bindings for zsh command line editing [closed]

I have vim keybindings enabled for command line editing by bindkey -v. When I am trying to use ci", ci', di" or di' it doesn't work. For example: If I have a command echo "hello" '...
gmtek's user avatar
  • 145
0 votes
0 answers
9 views

Why Neovim has different color than Vim [duplicate]

I just installed Neovim and when I execute for example this command nnoremap <leader>gd :!clear<CR>:!git diff<CR> I'm getting this output for Neovim: and this output for Vim: How ...
whitesiroi's user avatar
1 vote
1 answer
37 views

@: does not work to repeat the :qa command

I open the diff files between 2 code revisions using git difftool. I can use :qa to close the current diff and go to the next one. Rather than pressing :qa repeatedly, I would like to use @:, but I ...
Abhilash's user avatar
0 votes
1 answer
47 views

How do I use variables with the delete command? (i.e., how to expand/reference variables for command arguments?)

I'm using variables for line numbers, and I want to delete a range of lines using these variables. How do I do that? let x = 5 let y = 20 " I want to delete the range of lines from x ...
Rob Bednark's user avatar
0 votes
1 answer
65 views

Stop flushing the last command when hitting enter

Suppose I wrote this command: command! -nargs=1 E echo ' -> <args>' and when user feeds an argument, :E abc I intend to see the following effect as they hit Enter: :E abc -> abc Of ...
Futarimiti's user avatar
0 votes
1 answer
54 views

NeoVim runs part of mapping while starting

I am using a Raspberry Pi for learning C. I use NeoVim and Mingw-GCC on the Pi over SSH. Building is done with a custom script named build. Initial builds were done by calling ./build from the command ...
Supragy Mishra's user avatar
1 vote
1 answer
290 views

In neovim, can I use Enter to accept a command completion instead of executing the command?

Using neovim (v0.8.1 on Fedora 37) with its default configuration in my home directory, when I type :e <tab> the completion menu pops up, the first entry (here Desktop) is highlighted and the ...
Quappas's user avatar
  • 53
0 votes
0 answers
132 views

How to tab autocomplete in command-line and search using CoC?

How can I have autocompletion in the colon command-line and during / search just as autocomplete works in my buffers?
theonlygusti's user avatar
  • 2,189
1 vote
2 answers
131 views

Vim fill command line with currently highlighted word in substitution

I have incsearch on, so when I type :s/thingS it will highlight the thingS part of thingSoFar in the below text see, this thing is the thingSoFar thing When I am typing that command line with my ...
theonlygusti's user avatar
  • 2,189
1 vote
4 answers
50 views

Programatically enter Command line window

I have bind q to :qa that hides q:. Is there a command to enter the Command Line Window that is not q:? How to access the Command Line Window without typing: q:?
Dominik Teiml's user avatar
0 votes
1 answer
34 views

vert command works but v doesn't

To open a buffer in a vertical split, you can use the word "vert". For example : :vert term #it opens a terminal in a vertical split :vert sb1 #it opens the buffer 1 in a vertical split ...
floupinette's user avatar
1 vote
0 answers
53 views

Completion for ++flags in command-line mode

Is there any way to turn on tab completion for the various ++[flag] flags that some commands take? For example, :e ++ff=unix whatever.txt overrides fileformat to unix for whatever.txt, but :e ++<...
rampion's user avatar
  • 201
1 vote
2 answers
84 views

Shorter way to call specific plugin function

In the middle of a Vim session, I need to call a particular plugin's function via: :call UltiSnips#RefreshSnippets() When from normal mode I type :call UltiS<Tab>, it auto-expands to ...
Tryer's user avatar
  • 227
1 vote
1 answer
27 views

vim in FCEDIT=...vim... does not work with more than one option

When I write in a bash commamd line vim -u /root/.vimrc -c "set textwidth=0" this works as expected. When using same in FCEDIT= it does not work: FCEDIT='vim -u /root/.vimrc -c "set ...
Anton Wessel's user avatar
1 vote
1 answer
93 views

Neovim E276 - Command works in Vim but Not in Neovim

Question Thanks to the comment from @martin-tournoij on one of my other questions. He gave me this piece of code: :%s/0x[a-fA-F0-9]\+/\=submatch(0)->str2nr(16)/ which looks for every hex-number ...
Pixelbog's user avatar
  • 325
0 votes
1 answer
35 views

How to prevent an extra newline from being appended to macros ending with a newline? [duplicate]

If I save a macro by typing: :let @s='/{<C-v><C-m>'<Enter> which looks like: :let @s='/{^M' the macro that is actually saved is /{^M^M, with an extra linebreak (that I did not type)...
ban_javascript's user avatar
0 votes
2 answers
199 views

Normal mode command in Command-line mode

I'm in the process of mapping MacOS keybindings (Cmd/Alt + arrows/backspace/delete) to Vim commands, and the only thing remaining is to make the movements in normal mode (such as b or e) work in the ...
Dominik Teiml's user avatar
0 votes
0 answers
20 views

cannot paste highlighted status line text

I recently switched from gvim 9.0 compiled with motif to gvim 9.0 compiled with gtk in a VDI using xfce4. With gvim 9.0 motif: If I highlight text from the file being edited in gvim and I push ...
Tomoo's user avatar
  • 1
0 votes
0 answers
15 views

How can I backspace over a specific sequence of characters in search mode?

I'm working on a autocmd CmdLineEnter / that should map backspace to delete a specific sequence of characters, say FOO, as unit. For instance, if the current command line is This is a text with a FOO ...
Enlico's user avatar
  • 2,162
3 votes
2 answers
111 views

How can I reuse parts of the last command / history

I'm looking for a fast and efficient way to re-use the parameters of the last command in a new command. For example, in a Bash shell you can use the $1 placeholder to reuse the 1st argument of the ...
chiborg's user avatar
  • 130
1 vote
0 answers
33 views

how to pass all open windows to command line in vim [closed]

I want to run clang-format on all open windows. What I currently do, is: for each open window: :!clang-format --style=file -i % I have 2 issues: the clang-format runs in shell, so it doesn't ...
CIsForCookies's user avatar
1 vote
1 answer
23 views

Why rhs of cnoremap (used as a rhs of another cnoremap) can be <c-s> but not <space>?

If you execute this cnoremap <expr> <silent> <C-S> execute(':cnoremap <c-s> ctrl-s') and then hit /Ctrl-sCtrl-sCtrl-sCtrl-s, you'll see the search command be populated by /...
Enlico's user avatar
  • 2,162
1 vote
0 answers
34 views

How to to get commmand completions for selection from a keymap?

The idea is to have a keybinding, which executes a lua/vimscript function to paste yanked text into the command line and then have the command completion showing suggestions or directly get the ...
Jay-Pi's user avatar
  • 123
0 votes
1 answer
26 views

Setting a filetype for piped input

Is it possible to set filetype when starting vim? I would like to get C highlighting when doing something like: $ echo 'int main(){return 0;}' |vi -R - from a shell. I have tried adding --cmd 'set ...
Petr Skocik's user avatar
4 votes
0 answers
76 views

How to get autocomplete for :set?

E.g. I am trying to change foldmethod to syntax: :set foldmethod=s^I^I When I press tab after typing s, I get ^I instead of auto-completing to syntax. Only possible options are manual,indent,expr,...
balki's user avatar
  • 306
0 votes
0 answers
20 views

Entering command-line window from quickfix window opened by YCM results in inconsistent Vim state

I think I'm supposed to file a bug report, however I'm not sure if for Vim or for YCM, so I'm asking this question to better understand what is really happening. YCM has the :YcmCompleter ...
Enlico's user avatar
  • 2,162
0 votes
2 answers
295 views

How to remove 2 characters from the beginning of a string after using filename-modifiers?

How to remove 2 characters from the beginning of a string after using filename-modifiers? So assume that I have a files that looks like this: /home/drskoolie/projects/examples/ex40.c /home/drskoolie/...
Al-Baraa El-Hag's user avatar
3 votes
2 answers
91 views

What is the pattern matched against for events CmdwinLeave and CmdwinEnter?

More in general I'm always in doubt about what's the meaning of the {aupat} argument of autocmd for a given {event}. From :help :autocmd I read (my emphasis) Add {cmd} to the list of commands that ...
Enlico's user avatar
  • 2,162
0 votes
1 answer
734 views

Passing a count to a user command with neovim's Lua API

vim.api.nvim_create_user_command("TestCommand", function(opts) print(opts.count) end, { count = 1 }) vim.keymap.set("n", "<C-x>", "<cmd> TestCommand ...
what the's user avatar
  • 101
0 votes
1 answer
159 views

How to repeat a command in command-line mode

I need to repeat the delete of matching lines in vscode-vim. Unfortunately the g has not been implemented yet, so I'm trying to figure out a way to repeat the same change in command-line mode using ...
Antonio Santoro's user avatar
0 votes
1 answer
365 views

Show command prompt including commands issued before entering neovim

I've been using vim for a long time and got used to issuing: :! to peek at the command prompt behind the vim "window" working on Terminal.app in Mac OS where I can see old commands and ...
Alec Jacobson's user avatar
1 vote
2 answers
39 views

Where's the documentation for Ctrl-C while in [Command Line] buffer?

Long ago I discovered that q: opens a [Command Line] buffer where I can enter and edit an ex command line using all the power of Vim. Next, some time ago, I discovered that I can access that mode even ...
Enlico's user avatar
  • 2,162
2 votes
1 answer
171 views

How to :edit executable from path?

Environment: Linux I apologize in advance if this question already exists somewhere and has a proper answer. It is just so difficult for me to search because the keywords are all so generic. Put ...
Josh Thies's user avatar

1
2 3 4 5
10