Reputation: 24324
I have a text file that I append some text to. I would like to configure Vim to go to the end of this particular file each time I open it.
How do I do this for a single file?
Upvotes: 1
Views: 287
Reputation: 566
if you're on a linux or on mac, you can use "tail"
tail -f n20 filename.log
^ this will keep showing the new lines. the file will be showing the 20 last lines.
Upvotes: 0
Reputation: 40499
If you put the following line into your vimrc, it will move the cursor to the last line of your-file-name.txt when you open it:
autocmd BufRead your-file-name.txt normal G
It will not, however, leave you in insert mode. If you also want to start inserting when you read the file, you need a slightly more complicated line in your vimrc:
autocmd BufRead your-file-name.txt execute "normal G$"|startinsert!
Upvotes: 8