-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.vimrc
More file actions
77 lines (64 loc) · 2.63 KB
/
.vimrc
File metadata and controls
77 lines (64 loc) · 2.63 KB
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
"---------------------------------------------------------------
" 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:
"---------------------------------------------------------------
map ; :
syntax on
filetype on
"colorscheme miromiro
colorscheme molokai
set t_Co=256 " force 256-color mode
set nowrap " don't wrap line
set nocompatible " don't accomodate vi
set nobackup " disable backup files (filename~)
set splitbelow " place new files below the current
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 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 wildmode=list:longest,full
let g:loaded_matchparen=1
" tabs and indenting
set noexpandtab " don't insert spaces instead of tabs
set tabstop=4 " tabs appear as n number of columns
set shiftwidth=4 " n cols for auto-indenting
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
" 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
autocmd BufRead *.txt set tw=78 " limit width to n cols for txt files
autocmd BufRead ~/.mutt/temp/mutt-* set tw=78 ft=mail nocindent spell " width, mail syntax hilight, spellcheck
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
" 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!! %!sudo tee > /dev/null %