1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | " vimrc by bohoomil
" vim:fenc=utf-8:nu:ai:si:et:ts=4:sw=4:fdm=indent:fdn=1:ft=vim:
" pathogen
filetype off
call pathogen#infect()
call pathogen#helptags()
call pathogen#runtime_append_all_bundles()
set nocompatible
set encoding=utf8
set modeline
filetype plugin on
syntax on
" "
" ui "
" "
"if &t_Co < 256
if &term=~'linux'
"if ($TERM) == 'linux'
colorscheme default " colourscheme for the 8 colour linux term
else
colorscheme dc2
endif
set background=dark
set guicursor=a:blinkon0
set nu! " line numbering
set smartindent
" wrap'n'jump by display lines
set wrap
set linebreak
set display+=lastline
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
" buftabs
noremap <F11> :bprev<CR>
noremap <F12> :bnext<CR>
let g:buftabs_only_basename=1
let g:buftabs_separator = "."
let g:buftabs_marker_start = "["
let g:buftabs_marker_end = "]"
let g:buftabs_marker_modified = "*"
" statusline
set cmdheight=1 " command line height
set laststatus=2 " condition to show status line, 2=always.
set ruler " show cursor position in status line
set showmode " show mode in status line
set showcmd " show partial commands in status line
" fileformat, encoding, type, buffer num, RO/HELP/PREVIEW, mod flag, filepath; spacer; line pos, line/total, percentage
set statusline=%{&ff}\ \%{&fenc}\ \b%1.3n\ \%#StatusFTP#\%Y\ \%#StatusRO#\%R\ \%#StatusHLP#\%H\ \%#StatusPRV#\%W\ \%#StatusModFlag#\%M\ \%#StatusLine#\%f\%=\%1.7c\ \%1.7l/%L\ \%p%%
" NERDTree config
nmap <silent> <F9> :NERDTreeToggle<CR>
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\env','\.vim$', '\~$', '\.pyc$', '\.swp$', '\.egg-info$', '^dist$', '^build$']
let NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\~$']
let NERDTreeShowBookmarks=1
let NERDTreeHightlightCursorline=1
" "
" filetypes "
" "
" txt2tags
au BufNewFile,BufRead *.t2t set ft=txt2tags
au Filetype txt2tags source $HOME/.vim/syntax/txt2tags.vim
"au BufNewFile,BufRead *.t2t set spell
au BufNewFile,BufRead *.t2t set wrap
au BufNewFile,BufRead *.t2t set lbr
"au Filetype txt2tags noremap <F10> :TlistToggle<Enter>
" txt2tags taglist support
let tlist_txt2tags_settings='txt2tags;d:Titles'
" latex
filetype plugin indent on
set grepprg=grep\ -nH\ $*
let g:tex_flavor = "xetex"
let g:Tex_DefaultTargetFormat = "pdf"
let g:Tex_CompileRule_pdf = "xelatex -interaction=nonstopmode $*"
let g:Tex_ViewRule_pdf = "acroread"
" tmux
let tmux = "/usr/share/vim/vim73/syntax/tmux.vim"
au BufRead,BufNewFile .tmux.conf set filetype=tmux.conf
au Syntax newlang source /usr/share/vim/vim73/syntax/tmux.vim
" logs
au BufNewFile,BufRead *.log set ft=messages
au BufNewFile,BufRead *.log{.*} set ft=messages
" Syntax highlighting for subtitle files
au BufNewFile,BufRead *.srt setf srt
au BufNewFile,BufRead *.mpsub setf mpsub
au BufNewFile,BufRead *.sub setf sub
au BufNewFile,BufRead Trolltech.conf,.mpdasrc,.xchm,.*toprc setf cfg
" other file types
if has("autocmd")
" always jump to the last cursor position
autocmd BufReadPost * if line("'\"")>0 && line("'\"")<=line("$")|exe "normal g`\""|endif
autocmd BufRead *.txt set tw=80 " limit width to n cols for txt files
autocmd BufRead *.eml set tw=0 fo=cq wm=0 " no automatic wrapping, rewrapping will wrap to 80
autocmd BufRead ~/.mutt/temp/mutt-* set tw=80 ft=mail " nocindent spell " width, mail syntax hilight, spellcheck
"autocmd FileType tex set tw=197 " wrap at 197 chars for LaTeX files
endif
" automatically give executable permissions if file
" begins with #! and contains '/bin/' in the path
function ModeChange()
if getline(1) =~ "^#!"
if getline(1) =~ "/bin/"
silent !chmod a+x <afile>
endif
endif
endfunction
au BufWritePost * call ModeChange()
augroup mkd
autocmd BufRead *.mkd set ai formatoptions=tcroqn2 comments=n:>
augroup END
" html conversion (:help 2html.vim)
let g:html_use_css = 1
let g:use_xhtml = 1
let g:html_use_encoding = "utf8"
let g:html_number_lines = 1
" "
" keyboard "
" "
" map keys to toggle functions
function! MapToggle(key, opt)
let cmd = ':set '.a:opt.'! \| set '.a:opt."?\<CR>"
exec 'nnoremap '.a:key.' '.cmd
exec 'inoremap '.a:key." \<C-O>".cmd
endfunction
command! -nargs=+ MapToggle call MapToggle(<f-args>)
" semicolon enters ex mode
map ; :
" space bar un-highligts search
noremap <silent> <Space> :silent noh<Bar>echo<CR>
" keys & functions
MapToggle <F5> spell
MapToggle <F6> hlsearch
set noexpandtab
set tabstop=2 " set tab keys to 2 spaces
set shiftwidth=4
set noautoindent " set noautoindent to prevent vim from
" inserting unwanted indents when pasting
" backspace
set bs=2
" tab key in visual mode
vmap <tab> >gv
vmap <S-tab> <gv
" leader
let mapleader = ","
let g:BASH_MapLeader = '.'
" urxvt home / end
" the second is for insert mode
map <Esc>[7~ <Home>
map <Esc>[8~ <End>
imap <Esc>[7~ <Home>
imap <Esc>[8~ <End>
"set nolist " list disables linebreak
imap <silent> <Down> <C-o>gj
imap <silent> <Up> <C-o>gk
nmap <silent> <Down> gj
nmap <silent> <Up> gk
nmap <silent> k gk
nmap <silent> j gj
" "
" mouse "
" "
if has('mouse')
set mouse=a
endif
set mousemodel=popup_setpos
" improves redrawing for newer computers
set tf
set nolazyredraw " turn off lazy redraw
set nohlsearch " highlight no search results
set wildmenu
set spelllang=pl,en " set spelling lang
set clipboard=unnamed " yank and copy to X clipboard
" "
" searching & history "
" "
set hlsearch " highlight all search results
set incsearch " increment search
set ignorecase " case-insensitive search; opposite noignorecase
set smartcase " uppercase causes case-sensitive search
set wrapscan " searches wrap back to the top of file
set nobackup " don't create backup files
set noswapfile " don't create swap file
set history=50 " keep 50 lines of command line history
set incsearch " do incremental searching
map <C-f> :FufFile /home/bohoomil/<CR>
set tags+=ftags
" "
" misc "
" "
" allow writing to files with root priviledges
cmap w!! w !sudo tee % > /dev/null
" Show syntax highlighting groups for word under cursor
nmap <C-S-P> :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
endfunc
" "
" gvim specific settings "
" "
if has ("gui_running")
" only initialize window size if it has not been initialized yet
if !exists ("s:my_windowInitialized_variable")
let s:my_windowInitialized_variable=1
" feel free to :set background=light for a different style
set background=dark
colorscheme dc2
set guifont=Monaco\ 10
" geometry
set lines=70 columns=120
set winaltkeys=no
" menubar / toolbar on / off
map <silent> <F2> :if &guioptions =~# 'T' <Bar>
\set guioptions-=T <Bar>
\set guioptions-=m <bar>
\else <Bar>
\set guioptions+=T <Bar>
\set guioptions+=m <Bar>
\endif<CR>
" remove scrollbars in gVim
set guioptions+=LlRrb
set guioptions-=LlRrb
" turn off toolbar
"set guioptions+=T
"set guioptions-=T
" toolbar -- exclusions
aunmenu ToolBar.Make
aunmenu ToolBar.RunCtags
aunmenu ToolBar.SaveSesn
aunmenu ToolBar.LoadSesn
aunmenu ToolBar.SaveAll
aunmenu ToolBar.FindHelp
endif
endif
|
x