The ~/.vimrc file is very useful to store your configuration settings in. But it can also have other files included in it, with a simple line of text. This means you can have one configuration file containing syntax highlighting settings and other settings in another file.
This is how to do it. Use the line below in your ~/.vimrc file to include an extra configuration file from your ~/.vim folder.
so ~/.vim/highlight.vim |
Then this will be included in your main ~/.vimrc file.
This is what it contains.
:highlight Normal ctermbg=black ctermfg=white guibg=white guifg=white :colors koehler :syntax on |
This is a very easy way to split up a large configuration file for VIM and break it up into manageable parts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | :set nu :set wrap :set encoding=utf-8 set nocompatible set bs=2 set tw=72 set cindent set mouse=a set nowrapscan set showmatch set showmode set uc=0 set mousehide set hlsearch so ~/.vim/highlight.vim let c_comment_strings=1 " Color for xiterm, rxvt, nxterm, color-xterm : so ~/.vim/terminfo.vim |
The above file is my ~/.vimrc with 2 files included. This makes it easier to edit if it gets too large as separate sections can be in their own file.
Another very good VIM trick is to open a large file like this.
──[jason@192.168.1.2]─[~] └──╼ ╼ $ vim Documents/stallman.txt +65 |
This will open the file with the cursor at line 65. This is a very useful trick for programming and your debugger finds an error at line 65, you may then jump straight to it and fix the problem.
More useful settings.
" Bold current line number set cursorline highlight clear CursorLine highlight CursorLineNr cterm=bold " Cursor shape let &t_SI = "\<Esc>[6 q" let &t_SR = "\<Esc>[4 q" let &t_EI = "\<Esc>[2 q" " Tab/Shift+Tab functionality nnoremap <Tab> >>_ nnoremap <S-Tab> <<_ inoremap <S-Tab> <C-D> vnoremap <Tab> >gv vnoremap <S-Tab> <gv " Buffer switching nnoremap <silent> <C-h> :bprevious<CR> nnoremap <silent> <C-l> :bnext<CR> |