-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.vim
94 lines (75 loc) · 3.63 KB
/
init.vim
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
source ~/.config/nvim/plugins.vim
source ~/.config/nvim/theme.vim
source ~/.config/nvim/plugin-config/coc.vim
source ~/.config/nvim/plugin-config/fzf.vim
source ~/.config/nvim/plugin-config/startify.vim
source ~/.config/nvim/plugin-config/signify.vim
source ~/.config/nvim/plugin-config/whichkey.vim
" ---------------------------------------- ----------------------------------------
" General Settings Description
" ---------------------------------------- ----------------------------------------
syntax enable " Enable syntax highlighting
" set number " Always show line number
set nowrap " Do not wrap long line
set mouse=a " Enable mouse
set iskeyword+=- " Treat dash separated words as a word text object
set ruler " Show cursor position <row>,<col>
set cursorline " Show cursor line
set clipboard=unnamedplus " Copy paste between vim and everything else
set formatoptions-=cro " Stop newline continution of comments
set autowriteall " Auto save when switch buffer
" ---------------------------------------- ----------------------------------------
" Split Settings Description
" ---------------------------------------- ----------------------------------------
set splitbelow " Open horizontal split to bottom
set splitright " Open vertical split to right
nnoremap <C-h> <C-w><C-h>
nnoremap <C-j> <C-w><C-j>
nnoremap <C-k> <C-w><C-k>
nnoremap <C-l> <C-w><C-l>
" ---------------------------------------- ----------------------------------------
" Indentation Settings Description
" ---------------------------------------- ----------------------------------------
set tabstop=2 " Insert 2 spaces for a tab
set shiftwidth=2 " Change the number of space characters inserted for indentation
set smarttab " Makes tabbing smarter will realize you have 2 vs 4
set expandtab " Converts tabs to spaces
set smartindent " Makes indenting smart
set autoindent " Good auto indent
" ---------------------------------------- ----------------------------------------
" Key Mappings
" ---------------------------------------- ----------------------------------------
inoremap jk <esc>
inoremap <expr> <c-j> ("\<C-n>")
inoremap <expr> <c-k> ("\<C-p>")
inoremap OO <esc>O
inoremap AA <esc>A
" use option+<h,j,k,l> to move cursor in insert mode
inoremap ˙ <left>
inoremap ∆ <down>
inoremap ˚ <up>
inoremap ¬ <right>
nnoremap <C-p> :Files<CR>
nnoremap <C-s> :wall<cr>
nnoremap <C-w> :bd<cr>
nnoremap <C-q> :wqall<cr>
nnoremap <TAB> :bn<CR>
nnoremap <S-TAB> :bp<CR>
nnoremap ' :Marks<CR>
nnoremap ∆ <C-e>
nnoremap ˚ <C-y>
vnoremap < <gv
vnoremap > >gv
vnoremap p pgvy
vnoremap <leader>/ :Commentary<cr>
" Use opt + shift + '-', '=' to decrease/increase size
nnoremap <silent> — :resize -1<CR>
nnoremap <silent> ± :resize +1<CR>
" Use opt + '-', '=' to decrease/increase size
nnoremap <silent> – :vertical resize -2<CR>
nnoremap <silent> ≠ :vertical resize +2<CR>
" ---------------------------------------- ----------------------------------------
" Auto Commands
" ---------------------------------------- ----------------------------------------
" Auto source config file
" au! BufWritePost init.vim source ~/.config/nvim/init.vim