Still talking about vim, are we? Here's how Inny does his vimrc these days:
First up, Autocomplete. I do all this on windows, but I try to make sure it runs on linux as well. I use Ctrl-n as my autocompleter, which I also map to ctrl-space (cuz visual studio). I used to use the plugin supertab for that, but there are too many times when I want tab for spacing and vim can lock up for a second or two when autocompleting a right parenthesis into the entire dictionary.
Code: Select all
set wildmenu
set wildmode=list,full
set complete-=k complete+=k
set completefunc=syntaxcomplete#Complete
set omnifunc=syntaxcomplete#Complete
set tags=tags;/
" ctrl-space for autocomplete
inoremap <C-Space> <C-n>
if has("gui_running") == 0
if has("unix")
inoremap <Nul> <C-n>
endif
endif
I complement this with the linux words dictionary, so that my laziness is enhanced.
Code: Select all
if has("win32") || has("win64")
set dictionary-=~/vimfiles/linux_words.dict dictionary+=~/vimfiles/linux_words.dict
else
set dictionary-=/usr/share/dict/words dictionary+=/usr/share/dict/words
endif
Next, I add the love dictionary to the autocomplete. I forget where I got this from, but it's almost certainly here on the love2d forums. Go find it. It's a function, because I don't want love autocomplete in other file types.
Code: Select all
function SetLovePrefs()
if has("win32") || has("win64")
setlocal dictionary-=~/vimfiles/love-dictionary/love.dict dictionary+=~/vimfiles/love-dictionary/love.dict
setlocal dictionary-=~/vimfiles/lua.dict dictionary+=~/vimfiles/lua.dict
end
endfunction
Here's where I do the autocmds that set my preferences when editing lua files. The iskeyword thing is a bane and a boon, be careful with it.
Code: Select all
autocmd FileType lua setlocal tabstop=2 shiftwidth=2 softtabstop=2
autocmd FileType lua call SetLovePrefs()
autocmd FileType lua setlocal iskeyword+=:
autocmd FileType lua setlocal iskeyword+=.
And the last bit, enabling love commands so I can do it right in gvim. This isn't necessarily a great idea as the editor is locked up while Love is running, but it works for my needs. Like kikito said, also have a term open, because there are times when you want to browse the code while having the editor be responsive. If you use these, you need to fill in where you have love and lua installed. On linux, you shouldn't need these, as /usr/bin is in your $PATH.
Code: Select all
if has("win32") || has("win64")
command -nargs=* Love10 :!"C:\Program Files\LOVE-0.10.2\lovec.exe" . <args>
command -nargs=* Lua51 :!"C:\Program Files (x86)\Lua\5.1\lua.exe" <args>
end
Please please please use :help on all of things you see here. Don't just blindly use them unless you understand them.
Edit: Oh hey, that start cmd /c might be useful here. I guess I'll be doing that from now on. (This is the life of being a vim user, you're always learning a new tip)