Stack Exchange Network

Stack Exchange network consists of 174 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.

1
vote
1answer
25 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
25 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
26 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?
0
votes
0answers
16 views

Is it possible to set up vim to autocomplete from a file in command mode

I have the following function: function s:Test() { let l:build_dir = $HOME.'/path/to/repo/.build' let l:node_modules = l:build_dir.'/node_modules' let l:bin_dir = l:node_modules.'/.bin' ...
0
votes
0answers
27 views

Neovim command-line mode strange behaviour

I've just moved from vim to neovim to discover it. When I hit : in normal mode, it goes to command-line mode. Then I hit the first letter of the command, nothing appears beside the :. Then I hit the ...
2
votes
2answers
62 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
46 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
42 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
25 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
22 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
29 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....
0
votes
1answer
71 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
31 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
0answers
34 views

gx doesn't work on visually selected text

I have a link to a pdf file in my vim which contains spaces. I'm trying to open it with external app. While with gf I can visually select the text (e.g. a b.pdf) and open the pdf as a text file but ...
0
votes
1answer
50 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
85 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
35 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. ...
2
votes
1answer
40 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 ...
2
votes
3answers
167 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
44 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: :...
1
vote
0answers
42 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 ...
1
vote
1answer
36 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 ...
0
votes
1answer
29 views

How do I substitute two same words (of different cases) to another two words whilst retaining their original cases?

I am sorry that my English was not good enough to clearly describe the task in the title. Here is a more descriptive attempt. Let us say I have the following text \gls{tla}{TLA} (As a side note, ...
0
votes
0answers
14 views

Help completion appended with @en

Help completion has started showing @en after each choice. So, I get this after typing :help :set[tab][tab] :help :set+=@en I'm not sure when this started. Can anybody identify what it is so I ...
2
votes
1answer
63 views

Why are two <cr> characters required when executing this highlighting toggle command?

I use this keymapping toggle to highlighting on and off, but when I originally found it, the author did not list two <cr> at the end of the command. I found that if I didn't have two <cr> ...
0
votes
1answer
31 views

Indentation script not works for all occurence

I have following c.vim file - "imap ( ();<Left><Left> imap {<CR> {<CR>}<Esc>O imap [ []<Left> imap # #include<><Left> "imap " ""<Left> " ...
0
votes
1answer
89 views

Call vim command from shell, and suppress output while it operates

I'm setting up a vim environment install script. I'm using vim-plug for plugin management. What I'd like to do is, from the install.sh, run vim and call PlugInstall to trigger plugin download and ...
0
votes
1answer
33 views

Combining shell commands with :terminal

I have two shell commands which I want to run. However I only want to run the second one if the first one was successful. For simplicity let the commands be ls and ls. I can call then once at a time ...
2
votes
2answers
90 views

sending variable commands in vim-slime

I am relatively new to vim and have started using the vim-slime plugin. One thing I use it for is to run python scripts, for example :SlimeSend1 python ~/myPythonFile.py I now would like to automate ...
1
vote
1answer
35 views

Can I move to the start of the line on command-line mode?

I would like to move to the start of the line on the command-line mode with Ctrl + a. Right now I have the following setting on my ~/.vimrc, which is effective on insert mode: inoremap <C-a> &...
1
vote
0answers
78 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 ...
0
votes
1answer
57 views

Is it possible to make the tab completion on command-line mode case insensitive?

When I try to type in my directory to open my file, for example ~/Desktop, the tab completion doesn't work at the point of ~/d, since the completion only works on the capital letter. I already wrote ...
1
vote
1answer
66 views

Using colon-commands inside ternary expression

I have the following lines in my .vimrc let g = 0 inoremap <silent> <C-g> <C-o>:let g = !g<CR> inoremap <expr> <C-_> <C-o>(g == 0 ? :undo : :redo)<CR> ...
0
votes
1answer
109 views

my ag shortcut chokes on spaces

I got this in my .vimrc: set grepprg=grep\ -nriI\ --exclude=tags\ --exclude-dir=vendor " The Silver Searcher if executable('ag') " Use ag over grep let &grepprg = "ag --nogroup --nocolor --...
0
votes
1answer
43 views

opening multiple files in order of last changed

Suppose I want to look through a lot of files, one by one, using vi *. Is there an easy way to look a these files in non-alphabetical order, for example in order of newest or oldest first?
0
votes
2answers
158 views

vimscript: set text of command line in command mode?

How can one set the text of the command line in command mode? So when it is not in use? Same as the message that appears when writing a file? I'm looking for a solution for vim and/or nvim, preferably ...
1
vote
1answer
46 views

How do I move cursor around on unix shell using VIM commands? [closed]

I'm a vim user and forgot to grab my csh/vim settings before leaving my prev company. Basically, when tooling around my unix shell, I used vim commands (eg go back and forth using VIM quick-keys, ...
0
votes
2answers
197 views

How to go to previous open buffer from vim command line?

I am trying to write vim function which should make window to go to previous open buffer. How can I do it from command line? My first suggest was to find out some CTRL-O command line alternative.
2
votes
1answer
32 views

Can I change the command mode (: …) so that I can have vi shortcuts?

Basically my question is this. On my terminal I have vi mode enable. It saves me lots of time editing command line arguments and zooming throught the file system. I would like to have a similar mode ...
0
votes
2answers
44 views

Using -c command line option for Vim 7.4 on Windows produces errors

The following commands work fine when I issue them from the command mode in Vim: :%s/\(^\s\+\)\(\S\+.*)\s*\){$/\1\2\r\1{/g :g/^\s*\/\/$/d But when I run the above commands as a script as below: ...
2
votes
1answer
117 views

Creating mappings for command-line mode

I have made a few mappings for my personal configuration file, and I think I am getting a hang of it, however, I am wondering if there are any particular tricks to create mappings for command-line ...
-1
votes
1answer
341 views

I'm stuck in Vim; I see “Command Line” at the bottom and nothing makes Vim respond

I pressed :wq to write and quit. Except now I see a Command Line at the bottom and nothing I do makes vi respond (Enter, Esc, Ctrl+c, :, q, etc.). How do I get back to civilisation from here? If you ...
1
vote
2answers
102 views

Tab completion for filetypes in the commandline

If I want to set the filetype manually in vim, I would like to tab complete filetypes vim recognizes. However, right now vim just inserts a literal ^I :set ft=markd^I Is this possible?
2
votes
2answers
543 views

How to create multiple files?

While working on something like laravel, I end up creating the same view files index.blade.php, create.blade.php, show.blade.php within different folders like views/articles, views/comments, etc using ...
1
vote
1answer
81 views

How to navigate using vim keybindings in command line mode?

When using vim in commandline mode, I have to navigate using only arrow keys. I can't use the native vim bindings because when I key <esc>, it exits commandline mode. For example, if I was ...
0
votes
0answers
55 views

How to wrap text inside command line (text doesn't fit in command line)?

As you can see output from FrigoEU/psc-ide-vim doesn't fit into command line. changing set cmdheight doesn't help too.
2
votes
2answers
452 views

Any recommendations to enforce use of keybindings rather than equivalent command mode commands?

Context: I learned about the :[v]split command long before I learned the shortcuts Ctrl-w+[s|v] and as a result I find myself typing these commands often. Is there a way to break this habit ? (as a ...
1
vote
2answers
156 views

Contextual text processing

I would classify my mathematics pdf collection in folders named by the MSC 2010 Classification (just the 2 top-level). My approach is creating a file which will contain all path and uses mkdir in a ...
4
votes
1answer
136 views

Prevent FocusGained autocmd running in command line editing mode

I have the following in my vimrc to automatically reload a buffer: " Triger `autoread` when files changes on disk " https://unix.stackexchange.com/a/383044/143394 autocmd FocusGained,BufEnter,...
3
votes
1answer
313 views

I've just installed (g)Vim, how do I get arrow keys to access command history?

So the problem is that I've installed (g)Vim and the arrow keys are moving around rather than going through command history. It's a little complicated by the fact that there was an old version of vim ...