I had the same problem on Arch Linux, and finally I found that was the completion function's problem.
use complete -r vim
to remove the completer. (or put that line to your bashrc)
You can't make vim
behave like tail -f
. You can make less
behave like a combination of vim
and tail -f
though.
Forward forever (follow) mode
less
has a forward forever mode that you can enter by pressing F or by passing +F
to it as an argument.
$ less +F
In this mode, less
behaves like tail -f
in that it doesn't stop reading when it reaches the end of a file. It constantly refreshes with new data from the file. To exit this mode, press Ctrlc.
Syntax highlighting
less
supports automatic filtering of the data it reads. There is a program called source-highlight that can perform basic source code highlighting. It comes with a script that works well with less
. To use it, just set the LESSOPEN
environmental variable appropriately.
export LESSOPEN="| /path/to/src-hilite-lesspipe.sh %s"
You also have to tell less
to pass raw terminal escape sequences (these tell your terminal how to color text) by passing it the -R
flag. You can tell less
to pretend it is always being passed the -R
flag by setting the LESS
environmental variable.
export LESS=' -R '
When less
isn't enough
Although less
has vi-like keybindings, it just isn't the same as Vim. Sometimes it feels foreign and it lacks important features such as ctags integration and the ability to edit text.
You can make less
call Vim (assuming EDITOR=vim
) on the file it is currently viewing by pressing v. less
will even put your cursor in the correct location within Vim. When you exit Vim, you will find yourself back at less
. If you made any changes to the file while you were in Vim, they will be reflected in less
.
Best Answer
This feature is implemented as autocommand. It is set up in
/etc/vimrc
- see snippet below. Remove it from there or add command to remove that autocommand to your vimrc file. (I am using fedora - on rhel it should be very similar)If you do not have permissions or do not want to change
/etc/vimrc
, the command to put in your local.vimrc
to remove the autocommand is:au! <group> <cmdname>
, in this case:au! fedora BufReadPost
.