Questions tagged [command-history]

Questions about how Vim records the commands issues by the user and how to customize this behavior.

Filter by
Sorted by
Tagged with
2
votes
0answers
22 views

substitute short by long command forms from history on VimLeavePre

How can I edit the : history from a VimLeavePre autocmd? I'd like certain abbreviated command forms to be recorded with their long form in the shada file. I'm in the habit of using both :tabe {file} ...
0
votes
1answer
43 views

Why doesn't it find the correct item?

I have tried to use FZF to filter my (last) commands. The first function works well and retrieves the list of my last commands. When I select a command, it triggers my HandleCommand function but goes ...
1
vote
0answers
30 views

How do you remap keys in :history or :highlight?

I use Colemak hnei for nav in normal mode, but my keys default to hjkl when when I'm viewing :history and :highlight. How do I remap these keys? My guess is that the program may be switching to more....
0
votes
2answers
62 views

How to go up to previous command when in terminal mode in Vim 8?

I am new to Vim. I managed to use :terminal and :vertical terminal to have a terminal side by side with my code. This works great, I can move between my code and the terminals. However, how do I go ...
1
vote
1answer
202 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 ...
0
votes
1answer
29 views

Remap Enter in command history edit window only

I currently have <Enter> mapped to :nohlsearch in normal mode. This allows me to leave search highlighting on for all new searches, but easily turn it off when it (soon after usually) becomes a ...
0
votes
1answer
113 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 ....
2
votes
2answers
56 views

How to search and replace in the history

Is there a way edit command line or search history? I have read Is there search and replace history in vim? and tried using q: to open the history and do changes there, but all it seems to be able to ...
1
vote
0answers
36 views

How to view the command that was just un(re)done

Is it possible to see the sequence of key presses that are undone/redone when using u and Ctrl-r commands?
1
vote
2answers
325 views

reverse-i-search à la Bash Ctrl-r

I would like to be able to search through the previous commands starting with : that I entered, using an interactive incremental search, as it is possible in some shells (example: with Ctrl-r in bash)....
4
votes
1answer
48 views

Open command window dynamically

I am trying to use the command line window in a vimscript. Unfortunately, the experiment I have with is not good and I am not able to achieve the following: normal! q: This should open the command ...
5
votes
1answer
112 views

Equivalent of !n in bash in vim for ex commands?

I'd like to be able to view the last n commands, similar to the history command in bash, and then be able to execute the nth command similar to the way it is done in bash by using !<command number&...
9
votes
1answer
131 views

Use backspace to modify the current command in normal mode?

Sometimes when entering a command in normal mode you may make a typo, for example if I intend to type 10dk, I might accidentally start typing 19d. Since the command has not been completed/committed ...
18
votes
3answers
797 views

How does vim determine the size of a single “edit” when using “u” and “CTL-R”?

When using u or CTL-R to undo or re-do an edit in vim, I seem to alter chunks of text, not just the most recent keystroke. What determines the size of the chunk that is considered to be a single ...
7
votes
1answer
484 views

How to have endless vim history?

According to h: help: Use the 'history' option to set the number of lines that are remembered (default: 20) I know I can set the number of lines higher, yet is there an "endless" option that ...
0
votes
0answers
27 views

Cycle through edit command history [duplicate]

In Vim, i can cycle through edit locations with g, and g;, and jump to locations with Ctrl-I and Ctrl-O. Is there any way to similarly cycle through edit commands? This would be something similar to ...
9
votes
2answers
2k views

How to further increase cmdline history size?

I have already put the following setting in my .vimrc file: set history=1000 It's been there for a while, I work in vim on a daily basis, so there have been many commands executed by now. I know ...
8
votes
2answers
644 views

Is there a way to share vim command history?

Can I share Vim command history across instances in real time? By that I mean what people do in bash this way: export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" That is, ...
8
votes
2answers
230 views

How to access recently used files by choosing from a list?

I would like to have a keystroke to show a list of recently used files to choose one to edit. What do I need to provide that? And related, How do I manage the history of recently used files ...
66
votes
5answers
8k views

How do I jump to the location of my last edit?

I often make changes to the middle of a big file, use gg to jump to the top to check something, and then realize I forgot to set a mark where I was editing. Is there a built-in way to jump to the ...
3
votes
1answer
989 views

How to display invoked keystrokes and commands in normal mode? [duplicate]

How I can activate option which will display my pressed keystrokes or executed commands in normal mode on the screen? Especially it would be good, if it would give a slight info what specific ...
12
votes
1answer
169 views

Prevent Vim from recording events for certain filetypes

To add to this stackoverflow question, what should one put in their .vimrc to ensure 'private editing' of certain file extensions (e.g. .gpg files). Without compromising the effectiveness of the ...
35
votes
2answers
8k views

How can I view and edit my recording (i.e. recorded macro)?

I'm using complex repeats to record my operations (qq to record, some operations, q to stop) and I did a mistake. It is possible to see what I've recorded and correct the mistake, instead of doing it ...
10
votes
2answers
2k views

Showing command history with showcmd

When using set showcmd Vim shows partial commands in the last line of the screen. For example, in Normal mode when typing the command dt. the last line shows dt and then, when you hit . the command is ...
32
votes
2answers
2k views

Can I see the history of key presses in normal mode?

I know that Vim keeps history for ex commands, searches, jump locations, changes, and possibly others. With showcmd set, Vim also shows you what keys you have entered so far for a normal mode command,...
13
votes
1answer
522 views

How is command history resolved between multiple instances of Vim?

Vim keeps a history of ex commands (accessible via :↑ and q:), and that history persists after quitting. If I run multiple instances of Vim (same user, same home directory), how does Vim arbitrate ...
7
votes
1answer
1k views

How to cache file editing history in Vim, that it would not disappear after switching the file?

When I open another file in a Vim session all editing history for the other files disappears. Is it possible to configure Vim that it would automatically save and restore file editing history when ...