Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
14 views

How to press Enter in terminal vi mode execute mode (set -o vi) [on hold]

Ok so I'm using zsh and have been loving the set -o vi mode. However, I can't seem to use the execute mode: ➜ mv modules/db_instance_single modules/db_instance_double execute: s/single/double/g_ How ...
0
votes
0answers
44 views

What is this gibberish text showing in my command-line and how do I remove it?

My command-line shows some gibberish text whenever I open a file in Vim. Is it because of this lightline.vim extension that I am using? What does that text mean and how do I get rid of it? But the ...
0
votes
1answer
19 views

`vimdiff` nor `nvim -d` are working as an external diff tool for git

First line says output is not a terminal. The rest of the output looks like term codes aren't being processed. I use st, with $TERM = st-256color. I just tried it on termite ($TERM = xterm-termite) ...
4
votes
2answers
216 views

How do I change the “:” symbol in the minibuffer?

When you switch to command-line-mode, with :, you see a ":" symbol identifying that you're indeed in command line mode. Is there any way, other than modifying source code, I can change this symbol?
3
votes
2answers
91 views

creating a “:KeepCursor” command

I'd like to make a command that works like this: :KeepCursor {cmd} will the given execute ex command string, then restore the cursor's position. A primary example is: :KeepCursor normal! * which ...
0
votes
1answer
26 views

Running previous run command that was run in normal mode using colon

Recently I had to compile a latex file a few times, :!pdflatex filename.tex did the trick. But is there a way in normal mode to repeat commands like these which are in the recent history,but used ...
1
vote
1answer
30 views

Why will my set langmap in my vimrc not actually make the changes in Vim on macOS?

My vimrc is as follows: set langmap='q,\\,w,.e,pr,yt,fy,gu,ci,ro,lp,/[,=],aa,os,ed,uf,ig,dh,hj,tk,nl,s\\;,-',\\;z,qx,jc,kv,xb,bn,mm,w\\,,v.,z/,[-,]=,\"Q,<W,>E,PR,YT,FY,GU,CI,RO,LP,?{,+},AA,OS,...
2
votes
1answer
24 views

':norm dtxdty' works different than '0dtxdty', what's happening?

On line ay, 0dtxdty deletes the a (as I would expect), but :norm dtxdty does nothing, norm! and exec don't change it. I wanted to use it as part of a command to align as explained here, but to two ...
-1
votes
2answers
27 views

How to output the result of a command like :scriptnames in a buffer [duplicate]

:scriptnames outputs a (not convenient) list with more at the bottom. I'd like to have all the output in a buffer so i can search, edit ... How do i do that?
0
votes
1answer
50 views

May I have a Vim session report its “Mode” in its “Window Title”?

Clarification of the moving parts First, let me clarify what I mean by "Window Title", and what I expect to achieve On Windows OS, GUI programs will have three attributes: its Window Title texts, ...
1
vote
1answer
31 views

Find and replace in XML file in vi

I have an .xml file which contains many times the following web beacon <span lang="EN" class="multilang">ANY TEXT TOTO</span> I would like to make a "Find&Replace": each web beacon ...
0
votes
1answer
26 views

scroll while writing a substitution

how can I scroll or move around in the code while writing a search or command ? I want to write a substitution :s/xxx/yyy but I forgot what yyy should be and I need to scroll a little bit to find it, ...
1
vote
1answer
44 views

Opening up most recent file automatically when vim is started without command line arguments

I have found myself falling into a workflow where I'm often starting vim by running $ vim and then opening up the most recent file once inside. I was wondering how to detect: when vim is launched ...
0
votes
1answer
20 views

Is there a way to stay in the command line window after executing a line?

I find the command-line window incredibly useful for experimenting with my vim environment. But it's annoying to have to type q: every time I execute a line with <CR>. Is there a way to execute ...
0
votes
0answers
22 views

How to show “/foobar match 1 of ” or “E486: Pattern not found: foobar” in commandline when calling `normal! n` in function [duplicate]

I'm calling normal! n in a vimscript function. If there is a match, I don't get the message /foobar match 1 of 3 in the commandline. If there is no match, my commandline shortly flickers up and down ...
1
vote
2answers
45 views

Can I open a file at an arbitrary line and column via the command line?

I'm working on Open::This, which provides a command line utility that acts as a wrapper around vim, emacs and nano. The utility is called ot. It does things like translating ot lib/Foo/Bar.pm:99 ...
0
votes
0answers
37 views

Why does not Vi buffer operation "n (double quote) work in Vim?

I have read from a book that, vi allows the following commands: "ayy, which means yank the current line into buffer named a. "dP, which means paste the content in buffer named d before the cursor. ...
0
votes
1answer
21 views

Is it possible to non-recursively remap a command?

So Fugitive defines :Glog. This is, apparently, aliased to a call to the script-local s:Log() function (according to :command Glog.) My muscle-memory has been using glog at the command-line, for ...
1
vote
1answer
127 views

Commands history for vim commandline and :terminal [closed]

I want a way in which we can access a history of commands in terminal mode (and Vim/NeoVim's internal command line), just like in a normal bash terminal; i.e. if I press the up key it will scroll ...
1
vote
1answer
194 views

How to have the echo command process newline characters?

I find that when running :echo message with a message variable that contains newlines, it displays the newline character as ^@. Often I'd prefer it to actually be split on a new line though. Do I ...
1
vote
1answer
37 views

How to force redraw when returning to command line from command line history window?

Something that's bothered me for about a decade now is that when I switch from command line into the command-line-history window (by pressing <c-f>) and then switch back (by pressing <c-c>)...
1
vote
2answers
92 views

Make :w automatically run :nohl

I want :nohl to be run automatically whenever I run :w. How can I set this up? I tried autocmd BufWrite * :nohl in my vimrc but that's not working Apparently (from comments, thanks D. Ben Knoble)...
2
votes
1answer
91 views

repeat last command but not write

@: repeats the last colon command I entered, but also seems to include :write so often I go through this kind of workflow: :s/foo/bar :w Now I go to another line and want to run :s/foo/bar again, ...
0
votes
1answer
214 views

FZF --preview in Vim returns zsh shell error

I have been trying out FZF with Neovim. I installed it via a nvim plugin package manager. I have not installed it for the command line. When trying to see file previews :FZF --preview="head -$LINES {}...
0
votes
1answer
41 views

Make a command to open c files next to the corresponding header

I would like to have commands like :ce and :ctabe that open a tab with a vertical split with the .c file on one site and the corresponding .h file on the other. How can i accomplish this behaviour?
3
votes
2answers
81 views

How to edit a file in a new tab?

I want to map :e file.txt to :tabnew file.txt, or the equivalent setting for editing file in a new tab. What do I need to put into my vimrc?
0
votes
1answer
343 views

Changing the vim color scheme only highlights lines of text?

I'm a big noob to vim here. I was trying to change the colorscheme of vim by editing the .vimrc file, but as I was playing around with different color schemes (ayu and gruvbox, for example) I noticed ...
1
vote
1answer
69 views

How can I conveniently close all read-only buffers?

For a longer running vim session, the number of buffers increases. However, often $VIMRUNTIME files, system files and netrw buffers can usually be closed with “closed” eyes. These are typically read-...
0
votes
1answer
100 views

Sharing vim commands history across different users and computers

I have configured .dotfiles. Eg. see here https://wiki.archlinux.org/index.php/Dotfiles So now I can do dgit push or dgit pull on whichever computer I want, and I have all my config files (including ....
8
votes
1answer
1k views

'<,'> in command prompt

Occasionally when I type : to quit or write my file the prompt already contains the characters :'<,'> without me typing anything. It causes an error if I type w or q. I cannot replicate this ...
1
vote
1answer
95 views

exiting vim without close tabs or files

I use alias lvim='vim -c "normal '\''0"' for reopen last files in my vim. But the questions is how exit vim without close any tabs or files, When I use :wq it close tab or files.
1
vote
1answer
53 views

Is there a setting that hides the last colon-command entered?

Is there a setting I could add to my vimrc file that would hide the last entered colon-command that stays visible on the bottom of the screen after I hit enter? For example, if I type ":3" to go to ...
1
vote
1answer
32 views

In visual mode, how do I bind a key so that the selected text generates “%s/<SELECTEDTEXT>/<CURSORHERE>/g”?

In visual mode, how do I bind a key so that the selected text generates %s/<SELECTEDTEXT>/<CURSORHERE>/g ? Preferably ; considering I never use it otherwise. Thanks.
0
votes
1answer
35 views

How to start recording a macro, using commandline mode?

If I wanted to start recording a macro using command-line mode, how would I do this? Additionally, if I wanted to bind this action to a key, how would I do that in my .vimrc?
2
votes
2answers
85 views

Place a string onto the command line without execution

Suppose I have a variable let g:f_themes="./themes/**" Suppose I want to map this command to a key: :execute "vimgrep /".expand("<cword>")."/g ".g:f_themes." | copen" That works, even ...
0
votes
3answers
60 views

What command can I use to insert the current directory in the command-line mode?

Currently, I set the following keymap to my .vimrc: nnoremap <C-z> :NERDTreeToggle ~/Dropbox/jupyter/<CR> However, I sometimes want to trigger it with different directory, for example: :...
0
votes
2answers
114 views

Move/filter to next *blank* line

I'm trying to do two things involving blank lines (empty lines or lines with only white-space on them). Move to the next blank line (or EOF if none) Filter (using !) to the next blank line (or EOF if ...
1
vote
0answers
58 views

How to make vim shell command wait for keypress?

I have assigned the macro !clear && gcc % && ./a.out to the key 'r'. So when I press '@r', I expect vim to: Clear the shell compile the current C file run the output The problem is ...
1
vote
1answer
30 views

Pasting from register to command line inserts ^M instead of new line

Say I want to search for multiple lines (or do anything with them in the command line). I yank some lines and enter search mode (/). I press Ctrl + r" to paste what I just yanked, but I get ^M for ...
1
vote
1answer
101 views

Stay in visual mode when in command mode and pressing escape

Suppose we do the following steps: Visually select something Type :some stuff press escape when we do the last step, the command mode is exited but also we are left in normal mode - not visual mode....
2
votes
2answers
469 views

How do you make the command mode case insensitive?

For example, I might accidentally type something like :WQ and I want it to work like :wq when a hit enter Another case is where I am typing a longer command name, for example NERDTreeTabsClose. (Note ...
0
votes
1answer
70 views

“-u {vimrc}” not working as expected

I am trying to set up vim so I can get different functions in with different files (i.e. x.lisp and x.scm) and in the manual it says starting with the option "-u ufile" uses "ufile" as the vimrc My ...
0
votes
1answer
79 views

Vim (Spacevim); :!git push == permission denied (publickey)

I have operating system: Windows 7. Git bash works fine for me, and it uses the public key id_rsa.pub. I can run git commands fine through window's command prompt as well - and it too uses the public ...
1
vote
3answers
339 views

How to redirect terminal output to vim or get `vim like` behaviour in terminal output [closed]

How to get vim keybindings at terminal output so I can navigate/operate at terminal output like in vim or get smooth shell command processing in vim. For example I type: ifconfig an i want to make ...
0
votes
1answer
41 views

Command Ordering

I made a user command called Type and would like it to appear first in the list of available commands when I type :t and then hit tab. Currently, the first command is TOhtml, which I've never used. ...
3
votes
1answer
46 views

:global, how to use matched pattern in the cmd of :g/pat/cmd?

Give a buffer each line contain a filename. how to use r! cmd on the filename, within a :g command? eg, BEFORE PROCESSING: file1.txt file2.txt AFTER PROCESSING (with wc -l): file1.txt 12 ...
3
votes
3answers
604 views

How to run zsh aliased command from vim command mode?

I have a bunch of really useful terminal programs which I use often while I am editing or writing. For example, dictionary is a popular one and I have aliased its usage to single character d in .zshrc ...
1
vote
0answers
59 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: :...
2
votes
0answers
64 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 ...
2
votes
1answer
78 views

How to automatically select the first entry of the wildmenu without having to tab?

In vim's command-line, after typing the first few characters, when I press the tab key, the wildmenu appears. However, irritatingly, it requires me one additional press of the tab key to select the ...