Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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.

33 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
104 views

:tabonly does not close all unmodified tabs if there is a modified tab in the way

Create some test files, touch a b c d and open each in a tab, vim -p a b c d Modify file b. Go to tab c and issue :tabonly. Expected behavior: a and d tabs are closed. b is not closed because it is ...
Quasímodo's user avatar
  • 2,466
4 votes
0 answers
260 views

Directory symlink browsing moves me to new location when autochdir is set

I have a symlinked directory as such: ~/nested Which points to this directory: ~/whatever/yetanother/andanother/nested When I launch gvim or command line vim (7.4, with the standard, built-in ...
user62177541's user avatar
4 votes
0 answers
2k views

How can I undo last command in command line?

In general, is there a way to UNDO the last "meta" command (I mean a command entered in command line to manage a window ), or some equivalent keystroke sequence ? Btw, I know the u (= undo) and CTRL-...
Giorgio Robino's user avatar
3 votes
0 answers
792 views

Set maximum cmdheight

Is there a way to limit the command area in vim? When typing a long command, cmdheight is "temporarily increased", but I like to limit it to one line. What I currently have is illustrated on the ...
gospes's user avatar
  • 133
2 votes
1 answer
338 views

How to pass custom arguments to the shell invoked by :terminal?

I would like to specify the startup command to run on the :terminal shell. E.g. bash -c ls. The shell can be specified with set shell=bash, but how to specify the arguments? In another use case, I ...
tejasvi88's user avatar
  • 470
2 votes
0 answers
211 views

Bash process substitution on vim command line?

I want to be able to show someone a particular file's undo history in vim, remotely. It's a little complicated, so let me explain one step at a time. For starters, I can set a custom undofile and ...
Ryan Lue's user avatar
  • 891
2 votes
0 answers
300 views

How can I view all of the vimscript run by a command? (neovim)

I want something similar to what I get when I enter debug mode and type "step", then enter and up, enter and up, ten thousand times... But without having to do all that work, allows it to be done ...
phicr's user avatar
  • 693
2 votes
1 answer
45 views

Options from external commands in vim?

If I run from the vim terminal :! zathura foo.pdf It opens foo on top of the terminal and when I exit I go back to the vim file. If instead I try: :! zathura --fork foo.pdf The intended behaviour is ...
mtheorylord's user avatar
1 vote
0 answers
61 views

How can I handle whitespace of the path with nvim_buf_get_name?

I am using Neovim and I use this code to get the full path of the current file. local currnetPath=vim.api.nvim_buf_get_name(0) I want to use this variable for opening the current HTML file, so I need ...
mohamadi_arch's user avatar
1 vote
1 answer
157 views

Vim command-line mode encoding error when using global search in autocmd

Update Found the issue due to souce the menu this cause encoding=utf-8 and fileencoding=cp936 in _vimrc but in txt files it shows encoding=utf-8 fileencoding=utf-8 The way to fix is reset fenc=utf-8 ...
M_Sea's user avatar
  • 157
1 vote
0 answers
437 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
  • 1,025
1 vote
0 answers
58 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
0 answers
45 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
1 vote
0 answers
367 views

How do I disable messages like "written" and "2 fewer lines"?

How do I disable these messages. In the messages I always see: Messages maintainer: Bram Moolenaar <[email protected]> 2 fewer lines; before #526 7 seconds ago "somefile" 190L 6771B written
ritchie's user avatar
  • 253
1 vote
0 answers
46 views

Command (e.g. `g++`) does not point to the same binary when run from the terminal or from (neo)vim

I have NVIM v0.4.3 on macOS Mojave version 10.14.6 I have different version of g++ compilers on my machine and made the following alias in my .zshrc file: alias g++="/usr/local/bin/g++-9" ...
ecjb's user avatar
  • 149
1 vote
0 answers
114 views

Why does Gvim treat ansi escape codes differently than Vim in python code?

The following python code uses ansi escape sequences to clear the terminal screen and change the text color to red. It then prints "Hello from Vim." print ('\033c\033[31m Hello from Vim.') In Vim I ...
bashBedlam's user avatar
1 vote
0 answers
237 views

How vim doesn't expand Ex commands in autocmd?

I'm trying to pass a command to 'vim-tmux-runner' on each file save with au bellow. autocmd FileWritePost,BufWritePost *.py :VtrSendCommandToRunner python manage.py test <afile>:p:h:t Where: :...
sgp667's user avatar
  • 125
1 vote
0 answers
202 views

What encoding does :! use?

I'd like low-level control over exactly what bytes I send and receive from a process spawned from some vimscript. What encoding is used for communications with commands started with :!foo? Can I ...
Daniel Wagner's user avatar
1 vote
0 answers
102 views

Is it possible to copy block (given by range) multiple times in a single command?

Is there a way to copy a few times a given block from command-line mode, e.g. with the :t command? For example, how to copy the two lines (block) above the cursor -2,-1 to the current position ., 3 ...
Ivan's user avatar
  • 336
1 vote
0 answers
517 views

How do I get vim to autocomplete correctly for :! on Windows?

On Vim 7.3 on Windows, if I use Tab to autocomplete paths with nonstandard characters in many cases, it works fine. For example: :n 2016\ Posts\\feb\something.txt If I press Tab after '2' and 'f' ...
Paul Brinkley's user avatar
1 vote
0 answers
84 views

Strange glyph when moving commandline cursor

I recently tried vim for the (still in-dev!) Bash for Ubuntu on Windows. I noticed this odd glyph appearing on the commandline in vim - but only when moving across it. It flashes for one screen ...
Wolfie's user avatar
  • 667
0 votes
1 answer
40 views

Printing (file) information at the bottom line

I'd like to print some file information on vim's bottom line upon pressing a keyboard shortcut, sort of like Ctrl+G but with different info (modification timestamp). How can I output there? My current ...
Petr Skocik's user avatar
0 votes
0 answers
28 views

How to get/print all max-nested non-empty subdirs starting from some path(dir)?

How to get/print all max-nested non-empty subdirs starting from path(dir)? I found a random option to do this on Linux (bash): find ~/.config/nvim -type f | sed 's%/[^/]*$%%' | sort -u But I'm ...
cuc's user avatar
  • 1
0 votes
1 answer
72 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
0 answers
23 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,214
0 votes
1 answer
129 views

How to delete all lines in a command script without provoking error?

I'm trying to write a Vim command script (a file containing Ex commands) that removes all existing lines in a file (and then read in some new text, and do some further editing operations). I use the ...
user98761's user avatar
  • 121
0 votes
0 answers
329 views

Call custom bash function from Vim

I have created a bash function, in its own .sh file, which I want to use from within Vim, and later use if from within the lightline config file. I have tried many ways, but I cannot make it work. ...
Xxxo's user avatar
  • 187
0 votes
0 answers
63 views

calling vim with mpiexec says "Warning: Output is not to a terminal / Warning: Input is not from a terminal"

My question is a bit technical. For specific reason, I need to call vim after mpiexec. Example : mpiexec -n 1 vim mytext.txt But this gives the following warning message: Vim: Warning: Output is not ...
Kiven Jecquas's user avatar
0 votes
0 answers
24 views

When I run :LanguageToolCheck, the output is the java -jar command in a new buffer

I've been trying to utilize Vim to do more writing so I tried to install LanuageTool and a related vim plugin: https://github.com/dpelle/vim-LanguageTool/ However, even after specifying the location ...
GregePorter's user avatar
0 votes
0 answers
724 views

Mouse navigation not working in VIM

I started using VIM today and I found out that we could use the mouse pointer to go to a line in vim using set mouse=a But unfortunately, it is not working here is the config file https://pastebin.com/...
GN Vageesh's user avatar
0 votes
0 answers
37 views

JavaScript equivalent of :perldo?

Is there a JavaScript equivalent of :perldo that allows writing one-liners that perform inline replacement of the file (or file lines) based on small, ad hoc JavaScript programs? For example, this ...
jimbo's user avatar
  • 101
0 votes
0 answers
30 views

How to use `<count>` and `-count` to make command repeatable?

I am trying to use <count> and -count to make a command repeatable. This is the command I have right now: command! -count=1 Hello :d <count>. But I got this error instead when I run :...
John Winston's user avatar
0 votes
0 answers
342 views

Map left command key to left control key in terminal only?

I've asked this question over on AskDifferent without any luck. I'm using neovim to edit code and am needing to create a mapping to bind to <cmd-w> to <C-w>. How would I go about this on ...
Bdyce's user avatar
  • 101