set nocompatible
""
"Syntax coloring options
""
"if !has('gui_running')
" set t_Co=8 t_md=
"endif
syntax on
set background=dark
set number
set showcmd
set foldmethod=manual
""
"Indent options
""
set autoindent
set smartindent
""
"Search options
""
set hlsearch
set wrapscan
set incsearch
set ignorecase
""
"Tab indent options
""
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
""
"Wrap options
""
set wrap
set linebreak
set whichwrap+=<,>,[,]
set backspace=indent,eol,start
""
"Status line
""
set laststatus=2
set statusline=%<%f%y%m%r\ %{&encoding},%{&ff}\ %l,%c%V/%L\ %P
set history=100
""
"Backup and swap
""
set backup
set backupcopy=yes
set backupdir=$HOME/.vim/backup,.
set directory=$HOME/.vim/swap,.
""
"Encodings
""
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=utf-8,cp1251,koi8-r,cp866
""
"Completion options
""
"set completeopt-=preview
"set completeopt+=longest
set completeopt=menu
""
"Window options
""
set winminwidth=0
set winminheight=0
""
"Other options
""
set mouse=a
let c_syntax_for_h=""
""
"Keymap settings
""
" No settings yet
""
"Hotkey maps
""
imap <Ins> <Esc>i
"inoremap <Nul> <C-X><C-O>
"inoremap <C-Space> <C-X><C-O>
"imap <C-@> <C-Space>
map <F2> :TlistToggle<CR>
imap <F2> <Esc>:TlistToggle<CR>
vmap <F2> <Esc>:TlistToggle<CR>
nmap <F3> :nohlsearch<CR>
imap <F3> <Esc>:nohlsearch<CR>
vmap <F3> <Esc>:nohlsearch<CR>
""
"Menu config
""
set wildmenu
set wcm=<Tab>
menu Encoding.Read.UTF-8 :e ++enc=utf-8<CR>
menu Encoding.Read.CP1251 :e ++enc=cp1251<CR>
menu Encoding.Read.KOI8-R :e ++enc=koi8-r<CR>
menu Encoding.Read.CP8666 :e ++enc=cp866<CR>
map <F7> :emenu Encoding.Read.<Tab>
menu Encoding.Write.UTF-8 :set fenc=utf-8<CR>
menu Encoding.Write.CP1251 :set fenc=cp1251<CR>
menu Encoding.Write.KOI8-R :set fenc=koi8-r<CR>
menu Encoding.Write.CP8666 :set fenc=cp866<CR>
map <S-F7> :emenu Encoding.Write.<Tab>
menu Encoding.Endline.UNIX :set fileformat=unix<CR>
menu Encoding.Endline.DOS :set fileformat=dos<CR>
menu Encoding.Endline.MAC :set fileformat=mac<CR>
map <C-F7> :emenu Encoding.Endline.<Tab>
menu Textwidth.off :set textwidth=0<CR>
menu Textwidth.on :set textwidth=80<CR>
""
"Enable plugins
""
filetype on
au BufRead,BufNewFile *.phps set filetype=php
au BufRead,BufNewFile *.phtml set filetype=php
""
"TagList settings
""
let g:Tlist_Show_One_File = 1
function! CtwUpdateCtags()
echo "Update ctags function is not setted."
endfunction
let CtwUpdateCtagsFunction = "CtwUpdateCtags"
nmap <F11> :call {CtwUpdateCtagsFunction}()<CR>
menu ctags.Update<Tab><F11> <F11>
" Switch between header file and source code in C / C++
" ,s switch to source code
" ,S switch to source in new window
" ,h switch to header
" ,H switch to header in new window
nmap ,s :call CtwSwitchToSource()<CR>
nmap ,S :call CtwSwitchToSourceN()<CR>
nmap ,h :call CtwSwitchToHeader()<CR>
nmap ,H :call CtwSwitchToHeaderN()<CR>
function! CtwSwitchToHeader()
if &filetype == "c"
find %:t:r.h
return
end
if &filetype == "cpp"
find %:t:r.hpp
return
end
endfunction
function! CtwSwitchToHeaderN()
if &filetype == "c"
sfind %:t:r.h
return
end
if &filetype == "cpp"
sfind %:t:r.hpp
return
end
endfunction
function! CtwSwitchToSource()
if &filetype == "c"
find %:t:r.c
return
end
if &filetype == "cpp"
find %:t:r.cpp
return
end
endfunction
function! CtwSwitchToSourceN()
if &filetype == "c"
sfind %:t:r.c
return
end
if &filetype == "cpp"
sfind %:t:r.cpp
return
end
endfunction
function! CtwMake()
if &filetype == "python"
write
make
return
endif
let old_tab_num = tabpagenr()
tabe
tabm
let old_buf_list = tabpagebuflist(tabpagenr())
make
let buf_list = tabpagebuflist(tabpagenr())
if old_buflist == buflist
tabc
execute 'tabn '.old_tab_num
else
setlocal foldlevel = 9999
endif
endfunction
nmap ,m :call CtwMake()<CR>
nmap ,w :cwindow<CR>
nmap ,n :cnext<CR>
nmap ,p :cprevious<CR>
nmap ,l :clist<CR>
menu Make.Make<Tab> ,m
menu Make.Make\ Window<Tab> ,w
menu Make.Next\ Error<Tab> ,n
menu Make.Previous\ Error<Tab> ,p
menu Make.Errors\ List<Tab> ,l