-
Notifications
You must be signed in to change notification settings - Fork 1
/
nvimrc
122 lines (102 loc) · 4.4 KB
/
nvimrc
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
" basic{{{1
syntax on
set autoindent " I hope you know what this does
set autowrite " automatically write before running commands that need it to be written
set hlsearch " turn on highlighting of searches
set ignorecase " make search non case sensitive
set incsearch " show the search result before you finish typing
set noshowmode " turn off "--INSERT--" at bottom of screen
set nowrap " change what happens when you get to edge of screen.
set shiftround " make indents always be at a multiple of the tab width
set showcmd " show commands that you are typing
set showmatch " when a bracket is inserted, briefly jump to the matching one.
set smartcase " allow you to search with more charters
set timeout " set timeout for mappings
set notitle " turn off the Vim title at the top of the window
set ttyfast " makes Vim faster
set visualbell " use visual bell instead of beeping
set backspace=2 " turn on backspace
set completeopt-=preview " disable pop-up when using Neocomplete
set formatoptions+=w " when text get over the number set by `set textwidth`, wrap it to next line
set foldmethod=marker " set the folding method to use three { to start and three } to end
set laststatus=2 " always turn on status line
set modelines=5 " number of lines down Vim checks for set commands
set mouse=a " turn on the mouse
set nrformats=octal,hex,alpha " allow you to ctrl-a/ctrl-x to increase/decrease letters and numbers
set scrolloff=7 " make Vim have 7 lines below cursor when moving down
set t_ut= " needed if using Vim inside of tmux
set textwidth=79 " set what line to wrap charters at.
set ttimeoutlen=50 " change wait time for `timeout`
set clipboard=unnamedplus " Vim yanks go to OS's clipboard as well
" remove "plus" if not on Linux
" set up menu stuff
set wildmenu
set wildmode=list,longest,full
" make line numbers go 1,2,3,4...
set number
" make the line your cursor is on 0
" set relativenumber
" extra chars like the end of line one and when text raps to next line
set list
set listchars=tab:\|\ ,eol:¬,extends:❯,precedes:❮
" make Vim's clipboard the same as OS's clipboard
let g:clipbrdDefaultReg = '+'
" make Vim save every time it leaves insert mode
au InsertLeave * if &mod && expand('%')!=''|write|endif
" save line number line when reopening file
if has("autocmd")
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
endif
" highlighting{{{1
" highlight the 81st column so you know when your line is to long
call matchadd('Error', '\%81v', 100)
au BufRead,BufNewFile *.md set filetype=markdown
au BufRead,BufNewFile *bash_profile* set filetype=sh
au BufRead,BufNewFile *tmux.conf* set filetype=sh
au BufRead,BufNewFile *conkyrc* set filetype=sh
au BufRead,BufNewFile *gitconfig* set filetype=gitconfig
" spell check
hi SpellBad ctermfg=red cterm=underline
if version >= 700
set spl=en spell
set nospell
endif
" mapping{{{1
" make jj typed quickly while in insert mode switch to normal mode :D
inoremap jj <Esc>
" ZZ is save and quit and ZQ is just quit, so...
" make ZS to save without closing
nnoremap ZS :w<CR>
" make ZA save and quit all windows
nnoremap ZA :wqall<CR>
" C changes until end of line and D deletes until end of line, so why not Y?
noremap Y y$
" better indenting for visual mode
vnoremap > >gv
vnoremap < <gv
" easily change buffers
nnoremap <C-H> :bprev<CR>
nnoremap <C-L> :bnext<CR>
" improve up and down shortcuts
nnoremap <C-J> <C-D>
nnoremap <C-K> <C-U>
" pair completion
inoremap { {}<Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap {<Space> {<Space><Space>}<Left><Left>
inoremap {{ {
inoremap {} {}
inoremap ( ()<Left>
inoremap (<CR> (<CR>)<Esc>O
inoremap (<Space> (<Space><Space>)<Left><Left>
inoremap (( (
inoremap () ()
inoremap [ []<Left>
inoremap [<CR> [<CR>]<Esc>O
inoremap [<Space> [<Space><Space>]<Left><Left>
inoremap [[ [
inoremap [] []
inoremap <> <><Left>
inoremap "" ""<Left>
inoremap '' ''<Left>
inoremap `` ``<Left>