2

I often just need to create a notes.txt file in Windows to just quickly paste some text from some other place, save it from the gvim UI, and close the file. I want to be able to perform this operation quickly without having to press i on the keyboard, and gvim is my editor of choice on Windows and all files with the .txt extension have been associated with gvim.

So, I want to configure my _Vimrc so that when a .txt file is opened, insert mode is enabled by default. For other files, if at all possible, starting in command mode is preferable as I often start a gvim session by jumping to a line number in command mode.

If the above is not possible, then how can I simply configure gvim to start in insert mode?

Thanks.

Martin Tournoij
  • 62,054
  • 25
  • 192
  • 271
John Sonderson
  • 617
  • 1
  • 6
  • 14

1 Answers1

3

This should do it:

autocmd BufRead *.txt startinsert
Ben
  • 146
  • 2