-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
executable file
·118 lines (84 loc) · 2.71 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
set nocompatible " Use Vim defaults
if has("syntax")
syntax on " syntax highlighting
endif
set showmatch " Show matching brackets
set fileformat=unix
set wrap
set linebreak
set display+=lastline
set autoindent
set smartindent
highlight SpecialKey ctermfg=darkblue ctermbg=white
let python_space_errors = 1
set wildmenu " command-line completion
set hlsearch " search highlighting
set ruler " display cursor position
" Set wildcard ignores
set wildignore=*.o,*.obj,*.bak,*.exe,*~
set ignorecase " Case-insensitive matching
" Trim trailing whitespace on certain files
autocmd FileType c,cpp,java,php,python,ruby autocmd BufWritePre <buffer> :%s/\s\+$//e
" Fix staircase pasting
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
nnoremap j gj
nnoremap k gk
" Sometimes backspace is broken in source-built Vim
set backspace=2
set backspace=indent,eol,start
source ~/.vim/plug.vim
filetype plugin on
filetype on
function ShowSpaces(...)
let @/='\v(\s+$)|( +\ze\t)'
let oldhlsearch=&hlsearch
if !a:0
let &hlsearch=!&hlsearch
else
let &hlsearch=a:1
end
return oldhlsearch
endfunction
function TrimSpaces() range
let oldhlsearch=ShowSpaces(1)
execute a:firstline.",".a:lastline."substitute ///gec"
let &hlsearch=oldhlsearch
endfunction
command -bar -nargs=? ShowSpaces call ShowSpaces(<args>)
command -bar -nargs=0 -range=% TrimSpaces <line1>,<line2>call TrimSpaces())
" Use Mac OS X clipboard
if has('mac')
set clipboard=unnamed
endif
" Use the Vim 7 spellchecker
au BufNewFile,BufRead *.txt,*.html,*.rst,*.md,README*,*.tex set spell
" Source personal abbreviations
source ~/.vim/abbrev.vim
" Use tag file in .git, no cscope
set nocst
set tags+=./.git/tags,.././.git/tags,../.././.git/tags,../../.././.git/tags
" Toggle taglist window
nnoremap <silent> <F8> :TlistToggle<CR>
" Add a dictionary
set dictionary+=/usr/share/dict/words
let g:gitgutter_diff_args = '--patience -w'
" Set omnicompletion
set omnifunc=syntaxcomplete#Complete
source ~/.vim/underline.vim
source ~/.vim/rst_syntax.vim
" RST tables
let g:table_mode_corner_corner="+"
let g:table_mode_header_fillchar="="
" TODO put these in the proper places
autocmd FileType gitcommit setlocal spell
autocmd FileType help setlocal nospell
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
autocmd FileType markdown setlocal ts=4 sts=4 sw=4 expandtab
" Don't know why this isn't a thing already
nnoremap ZN :write<CR>:next<CR>
map <Leader>tt <Plug>VimwikiToggleListItem
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
let g:markdown_fenced_languages = ['html', 'python', 'ruby', 'rust', 'bash=sh', 'php', 'css', 'javascript', 'js=javascript', 'json=javascript', 'yaml', 'html', 'go', 'erlang', 'lisp']
let g:lisp_rainbow=1