Search code examples
vimvim-pluginspf13vim

Editing .vimrc file to make 'set ft=python' a default setting and something more


I am a new comer to the vim world, and I have just installed spf13-vim for a quick start. Apart from that I have not touched my .vimrc file.

I mainly use vim to write some python scripts on a remote server, so I have to type 'set ft=python' each time I open a file using vim. I am wondering if it's possible to edit my .vimrc file to make python a default choice of vim.

Another confusing thing is that each time I type a blank in vim, it shows a inverted question mark on my vim screen. I think it's because of some mismatch in file encoding, but I have no more idea about it.

I know it's a stupid question, but right now I can't solve it myself. Any help is appreciated.

Edit:

I have solved the problem of setting python default by write 'set ft=python' to my .vimrc file. (I didn't know contents in .vimrc are commands in vim) But I still don't know how to eliminate the inverted question mark when I typed a blank char, even after I do some search.


Solution

  • Name the buffer you're editing from the start, don't forget the :filetype plugin in your .vimrc and then things will work correctly.

    In any way having :set ft=whatever in your .vimrc is twice wrong. First it'll apply to all new sessions opened without a file. Moreover it'll only apply to the first buffer. I.e. it won't work with :new.