-
Notifications
You must be signed in to change notification settings - Fork 1
/
vimrc
127 lines (110 loc) · 5.2 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
123
124
125
126
127
" Enable all Pathogen plugins
execute pathogen#infect()
let iterm_profile = $ITERM_PROFILE
syntax on " Enable syntax highlighting
if iterm_profile == "Dark"
set background=dark
else
set background=light " Set solarized background color
endif
colorscheme solarized " Set solarized colorscheme
set encoding=utf8 " Set UTF-8 encoding
set autoread " Reload files changed outside vim
set nocompatible " Use vim rather than vi settings
set backspace=indent,eol,start " Allow backspace in insert mode
set number " Line numbers are good
set ttyfast " Faster term redrawing, scrolling; perhaps
set nobackup " Disable file backups when writing files
set nowritebackup " Don't backup before overwriting files
set expandtab " Use the appropriate number of spaces to tab
set smarttab " A tab in front of a line inserts spaces
set shiftwidth=4 " # of spaces to use for autoindent
set tabstop=4 " # of spaces that a tab counts for
set textwidth=80 " Make all lines 80 chars or less
set wrap " Wrap lines longer than 80 chars
set linebreak " Wrap lines when convenient
set nojoinspaces " Set 1 space btwn lines/periods to be joined
set scrolloff=999 " Working line will always be in the center
set title " Set title of the Vim window
set titleold= " Revert to original title when exiting
set hlsearch " Highlight searches by default
set noshowmode " Don't show current mode [bc Lightline]
set noshowcmd " Don't show incomplete cmds [bc Lightline]
set laststatus=2 " Always show status bar
set autoindent " Use existing indent depth starting a new line
set smartindent " Do smart indenting when starting a new line
set breakindent " Keep at least the same indentation as previous line
set breakindentopt=shift:4 " Offset wrapped line by an additional 4 characters
set ttimeoutlen=1 " Exit insert/visual mode without ESC delay
set digraph " Support special characters, eg German umlaut
set undodir=$HOME/.vim/undodir " Set persistent undodir path
set undofile " Write changes to the undofile
set undolevels=1000 " Max # of changes that can be undone
set undoreload=10000 " Max # of lines to save for undo on buf reload
set directory=$HOME/.vim/swp// " Write swap files in one directory, unique nms
set splitright " Splitting will put the new window right
set splitbelow " Splitting will put the new window below
set eol " Save empty line at end of file
" Customize airline statusbar
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#formatter = 'unique_tail'
" Customize git gutter settings
set updatetime=10
let g:gitgutter_sign_added = '┃'
let g:gitgutter_sign_modified = '┃'
let g:gitgutter_sign_removed = '━'
let g:gitgutter_sign_removed_first_line = '━'
let g:gitgutter_sign_modified_removed = '┳'
highlight! link SignColumn NoText
highlight GitGutterAdd ctermfg=2
highlight GitGutterChange ctermfg=3
highlight GitGutterDelete ctermfg=1
" Set search results to white font, red background overriding solarized
autocmd ColorScheme * hi Search cterm=NONE ctermfg=white ctermbg=red
" Set Make tabs to tabs and not spaces
filetype on
filetype plugin on
autocmd FileType make set noexpandtab shiftwidth=4
" Close open buffer without closing window split
command BD bp|bd #
" Efficient saving and closing with using leader key
nnoremap <leader>q :q!<cr>
nnoremap <leader>z :wq<cr>
nnoremap <leader>w :w<cr>
" <Space> to enter command mode.
" (It's not worth letting <Space> be PgDn, because PgUp doesn't work, because
" the terminal passes <S-Space> as <Space>)
nnoremap <Space> :
vnoremap <Space> :
" Color highlight line numbers
highlight LineNr ctermfg=NONE
" Color highlight current cursor line number
highlight CursorLineNr ctermfg=brown
" Map yanking in visual mode to system's copy
vnoremap <C-c> "*y
" Map toggle automatic line comment (a la ST3)
nnoremap <C-/> gcc
" Map insert line above current line and exit insert mode (a la ST3)
nnoremap <S-o> O<ESC>
" Clear previous search highlights
" <C-l> would originally redraw the screen; now we first clear, then redraw
nnoremap <C-l> :nohl<CR><C-L>
" Provide my `pub` shell script as a Vim command
" Build LaTeX PDFs from Markdown with Pandoc
" No need for `Ctrl-z` and `fg` any more
command Pdf execute "w | silent !pub -d % &" | silent redraw!
command Tufte execute "w | silent !pub -t % &" | silent redraw!
" " Custom status line mode dictionary
" let g:cmode={
" \ 'n' : 'NORMAL',
" \ 'v' : 'VISUAL',
" \ 'V' : 'VISUAL',
" \ 'i' : 'INSERT',
" \ }
" " Custom status line - current mode buffer path modified column lines
" set statusline=%1*
" set statusline+=%{(g:cmode[mode()])}
" set statusline+=\ \[%n]
" set statusline+=\ %<%F\ %m
" set statusline+=%=
" set statusline+=%c%10(%l/%L%)%10(%p%%\%)