Hi, I want to know where the : command history is stored for a particular vim session. I know we can scroll and search through the history. My objective is to take a portion of the commands that I executed using trial and error and create a vim source file.
+4
A:
it is stored at $HOME/.viminfo
From the vim help command:
The viminfo file is used to store:
- The command line history.
- The search string history.
- The input-line history.
- Contents of registers.
- Marks for several files.
- File marks, pointing to locations in files.
- Last search/substitute pattern (for 'n' and '&').
- The buffer list.
- Global variables.
Arkaitz Jimenez
2009-04-20 17:11:16
thanks that was exactly what I was looking for...I was hunting for it in the vim installation dir
2009-04-20 17:27:46
+1
A:
It's in the file .viminfo (or _viminfo if you are on Windows). It should be in whatever passes for your home directory.
anon
2009-04-20 17:11:44
+2
A:
You are looking for the functions histget()
, histadd()
and histdel()
.
EDIT: viminfo file will contain history data from several sessions, which I guess, you were already aware of, according to the way you formulated your question.
Luc Hermitte
2009-04-20 17:12:55
+2
A:
You can also open your recent command history in a minibuffer using the q:
or :<CTRL-F>
commands
OPEN
There are two ways to open the command-line window:
1. From Command-line mode, use the key specified with the 'cedit' option.
The default is CTRL-F when 'compatible' is not set.
2. From Normal mode, use the "q:", "q/" or "q?" command. *q:* *q/* *q?*
This starts editing an Ex command-line ("q:") or search string ("q/" or
"q?"). Note that this is not possible while recording is in progress (the
"q" stops recording then).
When the window opens it is filled with the command-line history. The last
line contains the command as typed so far. The left column will show a
character that indicates the type of command-line being edited, see
|cmdwin-char|.
You can move around this window, and copy just like a normal buffer. Hitting <Enter>
over a command will execute it.
rampion
2009-04-20 19:41:27