My .vimrc file became pretty long over the time, few things are for LaTeX, other are just my settings to make work in vim more convenient.
Here's picture how it looks:
My recent color scheme is delek. Last two lines are for status information as you can see from the picture, there is buffer number, file format and type, full path, modified flag, then on the right current line from total lines, column number and hexa number for character under cursor.
And the .vimrc file:
" ~/.vimrc (configuration file for vim only)
" skeletons
colorscheme delek
"color elflord
set paste
set ts=4
set shiftwidth=4
"caseinsensitive search
set ignorecase
set noruler
set laststatus=2
"KrisKo: statusline
set statusline=
set statusline+=%1*\ %n\ %* "buffer number
set statusline+=%5*%{&ff}%* "file format
set statusline+=%3*%y%* "file type
set statusline+=%4*\ %<%F%* "full path
set statusline+=%2*%m%* "modified flag
set statusline+=%1*%=%5l%* "current line
set statusline+=%2*/%L%* "total lines
set statusline+=%1*%4v\ %* "virtual column number
set statusline+=%2*0x%04B\ %* "character under cursor
syntax on
function! SKEL_spec()
0r /usr/share/vim/current/skeletons/skeleton.spec
language time en_US
if $USER != ''
let login = $USER
elseif $LOGNAME != ''
let login = $LOGNAME
else
let login = 'unknown'
endif
let newline = stridx(login, "\n")
if newline != -1
let login = strpart(login, 0, newline)
endif
if $HOSTNAME != ''
let hostname = $HOSTNAME
else
let hostname = system('hostname -f')
if v:shell_error
let hostname = 'localhost'
endif
endif
let newline = stridx(hostname, "\n")
if newline != -1
let hostname = strpart(hostname, 0, newline)
endif
exe "%s/specRPM_CREATION_DATE/" . strftime("%a\ %b\ %d\ %Y") . "/ge"
exe "%s/specRPM_CREATION_AUTHOR_MAIL/" . login . "@" . hostname . "/ge"
exe "%s/specRPM_CREATION_NAME/" . expand("%:t:r") . "/ge"
setf spec
endfunction
autocmd BufNewFile *.spec call SKEL_spec()
" filetypes
filetype plugin on
filetype indent on
"Latex Settings
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: This enables automatic indentation as you type.
filetype indent on
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
let g:LatexBox_latexmk_options = "-pvc -pdfps"
au FileType * exec("setlocal dictionary+=".$HOME."/.vim/dictionaries/".expand('<amatch>'))
set complete+=k
"autocmd /home/krisko/.vim/ftplugin/tex/tablatex.vim
autocmd BufNewFile,BufRead *.tex source ~/.vim/ftplugin/tex/tablatex.vim
" Modified tab completion. It works fine now.
function! My_TabComplete()
let line = getline('.') " curline
let substr = strpart(line, -1, col('.')+1) " from start to cursor
let substr = matchstr(substr, "[^ \t]*$") " word till cursor
if (strlen(substr)==0) " nothing to match on empty string
return "\<tab>"
endif
let bool = match(substr, '\.') " position of period, if any
if (bool==-1)
return "\<C-X>\<C-P>" " existing text matching
else
return "\<C-X>\<C-U>" " plugin matching
endif
endfunction
autocmd BufNew,BufRead *.java inoremap <tab> <C-R>=My_TabComplete()<CR>
"KrisKo: own commands
command W :exec ":w"
command Wq :exec ":wq"
" ~/.vimrc ends here

No comments:
Post a Comment