-
Notifications
You must be signed in to change notification settings - Fork 0
/
.xvimrc
126 lines (103 loc) · 4.02 KB
/
.xvimrc
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
filetype plugin indent on
set nocompatible
set number
" maps leader to ',' and maps '\' to ',' for char search
let mapleader = ","
noremap \ ,
" Text-wrapping stuff. (Also check out my cursorcolumn setting in .gvimrc.)
set textwidth=110 " 80-width lines is for 1995
let &wrapmargin= &textwidth
set formatoptions=croql " Now it shouldn't hard-wrap long lines as you're typing (annoying), but you can gq
" as expected.
" Highlight search but allow toggle hl off with space
set hlsearch
nnoremap <silent> <Space> :nohlsearch<Bar>:echo<CR>
" Tab settings. two spaces and >>, << are the same as tabs
set smarttab
set ts=2
set sw=2
set sts=2
set expandtab
" Tab completion for vim ci
set wildmenu
set wildmode=list:longest
set scrolloff=10 " This keeps 10 lines of context when scrolling
set title " Sets title of window to filename
set laststatus=2 " last window always has a status line
set ignorecase
set smartcase
set autoindent
" Better backspacing
set backspace=indent,eol,start
" Space between lines for clarity
set linespace=3
" Highlighted incremental search
set incsearch
" cursor line color
set cursorline
hi clear CursorLine
hi CursorLineNr guifg=lightgreen cterm=bold guibg=#363946
" Adjust colors as necessary
hi ColorColumn guibg=#444444
hi ColorColumn ctermbg=0
hi IncSearch guifg=NONE guibg=#353E44
hi IncSearch ctermfg=NONE ctermbg=67
hi Search guifg=NONE guibg=#545449
hi Search ctermfg=NONE ctermbg=22
hi Comment guifg=#339933 gui=NONE
hi Comment ctermfg=245 cterm=NONE
" Status line awesomeness
hi StatusLine guifg=#e0e0e0 guibg=#363946 gui=none
hi StatusLine ctermfg=254 ctermbg=237 cterm=none
hi StatusLineNC guifg=#767986 guibg=#363946 gui=none
hi StatusLineNC ctermfg=244 ctermbg=237 cterm=none
hi User1 ctermbg=darkgreen ctermfg=white guibg=#004400 guifg=#e0e0e0
hi User2 ctermbg=237 ctermfg=red guibg=#363946 guifg=red gui=bold
"set statusline=%<%F%h%m%r%h%w%y\ %{&ff}\ %{strftime(\"%c\",getftime(expand(\"%:p\")))}%=\ lin:%l\,%L\ col:%c%V\ pos:%o\ ascii:%b\ %P
set statusline= " clear the statusline for when vimrc is reloaded
set statusline+=%1* "switch to User1 highlight
set statusline+=%<%F " Full filename
set statusline+=%2* "switch to User1 highlight
set statusline+=%h%m%r%w\ " flags
set statusline+=%* "switch back to statusline highlight
set statusline+=%y\ " filetype
set statusline+=%= " right align
set statusline+=%{strftime(\"%a\ %y/%m/%d\ %H:%M:%S\",getftime(expand(\"%:p\")))}\ "time
set statusline+=%-7.(col:%c%)\ %<%P " offset
" Show extra whitespace
hi ExtraWhitespace guibg=DarkGray
hi ExtraWhitespace ctermbg=DarkGray
match ExtraWhitespace /\s\+$/
" Add line break indicator
set colorcolumn=110
hi ColorColumn ctermbg=darkgrey guibg=darkgrey
" Allow yank to copy to system clipboard
set clipboard=unnamed
" Ensure the temp dirs exist
call system("mkdir -p ~/.vim/tmp/swap")
call system("mkdir -p ~/.vim/tmp/backup")
call system("mkdir -p ~/.vim/tmp/undo")
" Change where we store swap/undo files
set dir=~/.vim/tmp/swap/
set backupdir=~/.vim/tmp/backup/
set undodir=~/.vim/tmp/undo/
" Don't back up temp files
set backupskip=/tmp/*,/private/tmp/*
" Faster scrolling
nmap <C-h> 5j
nmap <C-y> 5k
" Search for selected text, forwards or backwards.
vnoremap <silent> * :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\gvy/<C-R><C-R>=substitute(
\escape(@", '/\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
vnoremap <silent> # :<C-U>
\let old_reg=getreg('"')<Bar>let old_regtype=getregtype('"')<CR>
\gvy?<C-R><C-R>=substitute(
\escape(@", '?\.*$^~['), '\_s\+', '\\_s\\+', 'g')<CR><CR>
\gV:call setreg('"', old_reg, old_regtype)<CR>
" Set '.' to be a keyword in word parsing
set iskeyword-=.
" Go back a file (rather than just a jump spot)
nmap <C-b> :bf<CR>