In Vim by default when you enter :e
and hit the up arrow, it shows a list of files previously opened using the :e
command. Is there a way to add files that I've opened from the terminal via vim <filename>
to this list as well?
One possibility:
au BufEnter * for f in argv() | call histadd( "cmd", "e " . f ) | endfor
Explanation:
au # Autocommand.
BufEnter # Run it after entering a buffer.
* # For any file matching.
for f in argv() # Select files in argument list.
call histadd( "cmd", "e " . f ) # Append to history of ex commands (beginning
# with colon) letter 'e' (of edit) with file name.
endfor # Repeat next loop.
Put that command in your vimrc
file and try.
I don't think so. The :e <up>
is just a convenient way of browsing your
history of ex commands. It's not specific to the edit command. It just happens
that when you type the beginning of an ex command, the history will be
"filtered" to the entries which begin with the same characters.
The :args
command will print the list of files given as arguments in
the command-line, and :arge
will edit a file and put it in the argument
list (if isn't already).
Alternatively, the :b
command can be used to enter a buffer (in case
you still have the file in a buffer and want to edit it.
One of these might help you!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With