-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
122 lines (104 loc) · 4.72 KB
/
.vimrc
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
"---------------------------------------------------------------
" file: ~/.vimrc
" author: jason ryan - http://jasonwryan.com/
" vim:fenc=utf-8:nu:ai:si:et:ts=4:sw=4:fdm=indent:fdn=1:ft=vim:
"---------------------------------------------------------------
syntax on
filetype plugin on
filetype indent on
if &t_Co < 256
colorscheme miro8 " colourscheme for the 8 colour linux term
else
colorscheme miromiro
endif
set ttyfast " don't lag…
set cursorline " track position
set nocompatible " leave the old ways behind…
set nowrap " don't wrap lines
set nobackup " disable backup files (filename~)
set splitbelow " place new files below the current
set showmatch " matching brackets & the like
set clipboard+=unnamed " yank and copy to X clipboard
set encoding=utf-8 " UTF-8 encoding for all new files
set backspace=2 " full backspacing capabilities (indent,eol,start)
set scrolloff=10 " keep 10 lines of context
set number " show line numbers
set ww=b,s,h,l,<,>,[,] " whichwrap -- left/right keys can traverse up/down
set linebreak " attempt to wrap lines cleanly
set wildmenu " enhanced tab-completion shows all matching cmds in a popup menu
set spelllang=en_gb " real English spelling
set dictionary+=/usr/share/dict/words " use standard dictionary
set wildmode=list:longest,full " full completion options
let g:is_posix=1 " POSIX shell scripts
let g:loaded_matchparen=1 " disable parenthesis hlight plugin
let g:is_bash=1 " bash syntax the default for hlighting
let g:vimsyn_noerror=1 " hack for correct syntax hlighting
" tabs and indenting
set tabstop=4 " tabs appear as n number of columns
set shiftwidth=4 " n cols for auto-indenting
set expandtab " insert spaces instead of tabs
set autoindent " auto indents next new line
" searching
set hlsearch " highlight all search results
set incsearch " increment search
set ignorecase " case-insensitive search
set smartcase " uppercase causes case-sensitive search
" listchars
set list
set listchars=trail:·,precedes:«,extends:»,eol:↲,tab:▸\
" status bar info and appearance
set statusline=\ \%f%m%r%h%w\ ::\ %y\ [%{&ff}]\%=\ [%p%%:\ %l/%L]\
set laststatus=2
set cmdheight=1
if has("autocmd")
" always jump to the last cursor position
autocmd BufReadPost * if line("'\"")>0 && line("'\"")<=line("$")|exe "normal g`\""|endif
" limit cols to 80 in various filetypes
autocmd BufRead *.txt set tw=80 " limit width to n cols for txt files
autocmd BufRead *.markdown set tw=80 nolist " for blog entries
autocmd BufRead ~/.mutt/temp/mutt-* set tw=79 ft=mail nolist nocindent spell " width, mail syntax hilight, spellcheck
autocmd BufRead /tmp/vimprobable* set tw=80 spell
autocmd FileType tex set tw=80 " wrap at 80 chars for LaTeX files
endif
" 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>)
" Keys & functions
MapToggle <F4> number
MapToggle <F5> spell
MapToggle <F6> paste
MapToggle <F7> hlsearch
MapToggle <F8> wrap
" LaTeX settings
set grepprg=grep\ -nH\ $*
let g:tex_flavor='latex'
let g:Tex_DefaultTargetFormat='pdf'
let g:Tex_ViewRule_pdf='evince'
let g:Tex_CompileRule_dvi='latex -interaction=nonstopmode $*'
let g:Tex_CompileRule_pdf='pdflatex -interaction=nonstopmode $*'
" set path for latexsuite
set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after
" keep cursor centered
:nnoremap j jzz
:nnoremap k kzz
" space bar un-highligts search
:noremap <silent> <Space> :silent noh<Bar>echo<CR>
" Allows writing to files with root priviledges
cmap w!! w !sudo tee % > /dev/null
" toggle colored right border after 80 chars
set colorcolumn=0
let s:color_column_old = 80
function! s:ToggleColorColumn()
if s:color_column_old == 0
let s:color_column_old = &colorcolumn
windo let &colorcolumn = 0
else
windo let &colorcolumn=s:color_column_old
let s:color_column_old = 0
endif
endfunction
nnoremap <bar> :call <SID>ToggleColorColumn()<cr>