-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
140 lines (115 loc) · 3.56 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
133
134
135
136
137
138
139
140
set nocompatible
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
if has('gui_running')
set cursorline " highlight current line
endif
set incsearch " do incremental searching
set expandtab
set autoindent
set cinkeys-=0# " to stop moving to column 0 after pressing hash
filetype plugin indent on
set tabstop=4
set smarttab
set shiftwidth=4
set hlsearch
set wrap
set ignorecase
set smartcase
set showbreak=+++\
set wildmenu " Show a menu of possible completions
set wildmode=longest:full,full
set scrolloff=1
set sidescrolloff=5
set laststatus=2
set showtabline=1
set nrformats-=octal
set ttimeout
set ttimeoutlen=100
set display+=lastline
set nobackup
set noswapfile
set updatetime=250
set wildignore=tags,*.pdb,*.exe,*.obj
set diffopt+=vertical
set fileformats=unix,dos
set lazyredraw
"if (has("termguicolors"))
" let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
" let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
" set termguicolors
"endif
syntax on
" Some customizations for work machines compared with my personal preferences
if !empty($VIM_WORK_STYLE)
set shiftwidth=2
set tabstop=8
endif
set undofile
if has('win32') || has('win64')
set undodir=~/vimfiles/undodir
else
set undodir=~/.vim/undodir
end
let g:airline_theme='nord'
let g:airline_extensions = ['branch']
if &encoding ==# 'latin1' && has('gui_running')
set encoding=utf-8
endif
set list
set listchars=tab:>\
" here's a tab: .
set formatoptions+=j " Delete comment character when joining commented lines
colorscheme nord
" For all text files set 'textwidth' to 80 characters.
autocmd FileType text setlocal textwidth=80
autocmd FileType c setlocal textwidth=80
autocmd FileType h setlocal textwidth=80
autocmd FileType cpp setlocal textwidth=80
autocmd FileType markdown setlocal linebreak
" How to read/write brotli-compressed files
autocmd BufReadPre,FileReadPre *.br setlocal bin
autocmd BufReadPost,FileReadPost *.br call gzip#read("brotli -d --rm")
autocmd BufWritePost,FileWritePost *.br call gzip#write("brotli -5 --rm")
autocmd FileAppendPre *.br call gzip#appre("brotli -d --rm")
autocmd FileAppendPost *.br call gzip#write("brotli -5 --rm")
" Remap leader to comma
let mapleader = ","
" Type 'jk' while in insert mode to escape to normal mode.
imap jk <Esc>
" Use ,l to clear the highlighting of :set hlsearch.
nnoremap <silent><leader>l :nohlsearch<cr>
nnoremap <silent><leader>q :cclose<cr>
nnoremap <silent><leader>n :cnext<cr>
nnoremap <silent><leader>N :cprevious<cr>
" FZF shortcuts
nnoremap <leader>o :GFiles<cr>
nnoremap <leader>p :Files<cr>
nnoremap <leader>u :Buffers<cr>
set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
" The Silver Searcher
"if executable('ag')
" set grepprg=ag\ --nogroup\ --nocolor
"endif
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" create a vsplit and move to it
nnoremap <leader>w <C-w>v<C-w>l
map <Leader>t :TagbarToggle<CR>
" Highlight trailing spaces (like the one on this line)
:highlight ExtraWhitespace ctermbg=18 guibg=#ff0087
":match ExtraWhitespace /\s\+$/
:match ExtraWhitespace /\s\+\%#\@<!$/
:autocmd ColorScheme * highlight ExtraWhitespace ctermbg=18 guibg=#ff0087
:au InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
:au InsertLeave * match ExtraWhitespace /\s\+$/
let g:rustfmt_autosave = 1
set background&