-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
executable file
·132 lines (110 loc) · 3.22 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
128
129
130
131
132
set nocompatible
filetype plugin indent on
syntax on
" Fix crappy Mac OS X defaults.
set backspace=indent,eol,start
set mouse-=a
set laststatus=2
set tabstop=4
set shiftwidth=4
set scrolloff=3
set colorcolumn=80,100,120
" Get rid of lag for exiting visual mode.
set timeoutlen=1000
set ttimeoutlen=0
" Complete options (disable preview scratch window).
set completeopt=menu,menuone
set hlsearch
set expandtab
set nu
set relativenumber
set autoindent
set autoread
set nowrap
set title
set cursorline
" Wildmenu creates a tab menu similar to fish and zsh. Also add some
" additional rules for case insensitivity.
set wildmenu
set noignorecase
set infercase
" Optimizations, useful for large files with multiple syntax highlighters.
set ttyfast
set lazyredraw
if !exists('g:vscode')
" Window management key mappings so there's no need to press C-W to switch
" buffers. C-hjkl can be used to switch between buffers with these mappings.
nmap <silent> <C-h> :wincmd h<CR>
nmap <silent> <C-j> :wincmd j<CR>
nmap <silent> <C-k> :wincmd k<CR>
nmap <silent> <C-l> :wincmd l<CR>
" Keep selection when reindenting blocks of selected text.
xnoremap < <gv
xnoremap > >gv
else
" vscode-neovim rebinds 'gq' to VSCode's code formatting feature for some
" reason. I prefer to have it work the same was as it does in vanilla vim.
" unmap gq
endif
" Vim distribution specific configurations.
if has('nvim')
let g:prog_name = "nvim"
" Provide an easy way to escape the terminal.
tnoremap <C-X> <C-\><C-n>
" Sakura and iTerm2 uses C-H for backspace since they are sane terminals.
" Let's map it to move to left window.
nmap <BS> <C-W>h
" Fix terrible hard to read cursor color.
hi MatchParen guifg=#F8F8F0 guibg=#444444 gui=bold
" Restore my preferred cursor on exit, which is the blinking underline.
augroup RestoreCursorShapeOnExit
autocmd!
autocmd VimLeave * set guicursor=a:hor20
augroup END
else
let g:prog_name = "vim"
endif
" Setup clipboard to work on linux, bsds, and darwin.
if has("unix")
let os=substitute(system('uname'), '\n', '', '')
if os == 'Darwin' || os == 'Mac'
set clipboard=unnamed
elseif os == 'Linux' || os == 'FreeBSD' || os == 'OpenBSD' || os == 'NetBSD'
set clipboard=unnamedplus
endif
elseif executable('win32yank.exe') == 1
set clipboard=unnamedplus
let g:clipboard = {
\ 'name': 'win32yank',
\ 'copy': {
\ '+': 'win32yank.exe -i --crlf',
\ '*': 'win32yank.exe -i --crlf',
\ },
\ 'paste': {
\ '+': 'win32yank.exe -o --lf',
\ '*': 'win32yank.exe -o --lf',
\ },
\ 'cache_enabled': 0,
\ }
endif
set background=dark
colorscheme lunaperche
" Generates a title for the window based on the context of the current buffer.
function! GetTitle()
let buffer_name = expand("%:t")
if len(buffer_name) <= 0
return g:prog_name
else
return buffer_name . " - " . g:prog_name
endif
endfunction
autocmd BufEnter * let &titlestring = GetTitle()
" Override some theme defaults to make vim more pleasing to the eye.
function! SetHighlights()
highlight Normal ctermbg=234
highlight clear CursorLine
highlight CursorLine ctermbg=236
highlight ColorColumn ctermbg=236
endfunction
autocmd VimEnter * call SetHighlights()
call SetHighlights()