-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
161 lines (130 loc) · 5.74 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
set nocompatible
filetype plugin indent on
if !exists("g:syntax_on")
syntax enable
endif
set autoread " Auto reload file after external command
"set background=dark " Use a dark background
set backspace=indent,eol,start " Delete over line breaks
set binary " Enable binary support
set colorcolumn=80,120 " Show ruler columns
set encoding=utf-8 " Use UTF-8 encoding
set hidden " Hide buffers instead of closing them
set laststatus=2 " Always display the status line
set nofoldenable " Disable folding
set lazyredraw " Use lazy redrawing
"set noshowmode " Don't show mode
set number " Show line numbers
set pastetoggle=<F2> " Toggle paste mode with F2
set ruler " Show ruler
set showcmd " Show current command
set showmatch " Show matching bracket/parenthesis/etc
set showmode " Show current mode
set tags=tags; " Find tags recursively
set title " Change terminal title
set ttyfast " Fast terminal
set wildmenu " Visual autocomplete for command menu
set clipboard^=unnamed,unnamedplus
set rulerformat=%30(%=\:b%n%y%m%r%w\ %l,%c%V\ %P%)
set ffs=unix,dos " File format
" Temp Files
set nobackup " No backup file
set noswapfile " No swap file
" Search
set incsearch " Incremental search
set hlsearch " Highlight matches
set ignorecase " Case-insensitive search...
set smartcase " ...unless search contains uppercase letter
" Indentation
set smarttab " Better tabs
set smartindent " Insert new level of indentation
set autoindent " Copy indentation from previous line
set tabstop=2 " Columns a tab counts for
set softtabstop=2 " Columns a tab inserts in insert mode
set shiftwidth=2 " Columns inserted with the reindent operations
set shiftround " Always indent by multiple of shiftwidth
set expandtab " Always use spaces instead of tabs
" Key sequence timeout
set ttimeout " Enable time out
set ttimeoutlen=0 " Disable key code delay
" Wrapping
set wrap " Don't wrap long lines
"set linebreak " When wrapping, only at certain characters
set textwidth=80 " Turn off physical line wrapping
set wrapmargin=80 " Turn off physical line wrapping
set nolist " For "soft" wrapping
" Joining
set nojoinspaces " Only one space when joining lines
set formatoptions+=j " Remove comment leader when joining lines
" Scroll
set sidescrolloff=5 " Keep at least 5 lines left/right
set scrolloff=5 " Keep at least 5 lines above/below
" Mouse
set mousehide " Hide mouse when typing
set mouse=nicr " Disable mouse
" Disable bell
set visualbell " Disable visual bell
set noerrorbells " Disable error bell
" Treat given characters as a word boundary
set iskeyword-=. " '.' is an end of word designator
set iskeyword-=# " '#' is an end of word designator
" Splits
set splitbelow " Horizontal split below
set splitright " Vertical split right
" Spell checking
set spelllang=en_us " English as default language
set spell " Enable by default
" Invisible characters
set list
"set listchars=eol:¬,tab:▶\ ,trail:~,extends:⟩,precedes:⟨,nbsp:␣
set listchars=tab:→\ ,space:·,nbsp:␣,trail:•,eol:¶,precedes:«,extends:»
set showbreak=↳\ \ \ "
" Make completion menu behave like an IDE
set completeopt=longest,menuone
" History
set history=1000 " Remember more commands
if has('persistent_undo')
set undofile " Persistent undo
set undodir=~/.vim/undo " Location to store undo history
set undolevels=1000 " Max number of changes
set undoreload=10000 " Max lines to save for undo on a buffer reload
endif
" Same color for sign column and line numbers
"highlight clear SignColumn
" Custom spell-checking highlighting
highlight SpellBad term=underline cterm=underline,bold ctermfg=NONE ctermbg=NONE
highlight SpellCap term=underline cterm=underline,bold ctermfg=NONE ctermbg=NONE
highlight SpellRare term=underline cterm=underline,bold ctermfg=NONE ctermbg=NONE
highlight SpellLocal term=underline cterm=underline,bold ctermfg=NONE ctermbg=NONE
" Move between open buffers.
nnoremap <C-n> :bnext<CR>
nnoremap <C-p> :bprev<CR>
" Easier split navigations
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Enable folding
set foldmethod=indent
set foldlevel=99
" Enable folding with the spacebar
nnoremap <space> za
" ---------------------------------------------------------------------------- "
" Auto Commands "
" ---------------------------------------------------------------------------- "
" Filetype specific settings
augroup filtypes
autocmd!
autocmd FileType c,cpp setlocal commentstring=///\ %s
autocmd FileType crontab setlocal nobackup nowritebackup
augroup end
" Remove trailing whitespace
augroup remove_trailing_whitespace
autocmd!
autocmd BufWritePre * :%s/\s\+$//e
augroup end
" Watch my .vimrc
augroup reload_vimrc
autocmd!
autocmd BufWritePost $MYVIMRC source $MYVIMRC
augroup end