-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathneovim.config.vim
More file actions
124 lines (107 loc) · 2.56 KB
/
neovim.config.vim
File metadata and controls
124 lines (107 loc) · 2.56 KB
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
" support mouse
:set mouse=a
" Alt + * move line
" http://vim.wikia.com/wiki/Moving_lines_up_or_down
if has('macunix')
nmap ∆ :m .+1<CR>==
nmap ˚ :m .-2<CR>==
imap ∆ <Esc>:m .+1<CR>==gi
imap ˚ <Esc>:m .-2<CR>==gi
vmap ∆ :m '>+1<CR>gv=gv
vmap ˚ :m '<-2<CR>gv=gv
elseif has('unix')
nmap <A-j> :m .+1<CR>==
nmap <A-k> :m .-2<CR>==
imap <A-j> <Esc>:m .+1<CR>==gi
imap <A-k> <Esc>:m .-2<CR>==gi
vmap <A-j> :m '>+1<CR>gv=gv
vmap <A-k> :m '<-2<CR>gv=gv
endif
" Shifting blocks visually
" https://vim.fandom.com/wiki/Shifting_blocks_visually
imap <Tab> >>_
imap <S-Tab> <C-D>
vmap <Tab> >gv
vmap <S-Tab> <gv
" move between different window
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" quit
nmap <Leader>w :wq<Enter>
nmap <Leader>q :q!<Enter>
imap <Leader>w <Esc>:wq<Enter>
imap <Leader>q <Esc>:q!<Enter>
nmap <C-s> :w<Enter>
" resize window
map <Leader>- :resize -10<Enter>
map <Leader>+ :resize +10<Enter>
map <Leader>< :vertical resize -10<Enter>
map <Leader>> :vertical resize +10<Enter>
"" hightline current line and column
au WinLeave * set nocursorline nocursorcolumn
au WinEnter * set cursorline cursorcolumn
set cursorline cursorcolumn
" font
if has('macunix')
set guifont=Hack\ Nerd\ Font:h14
elseif has('unix')
set guifont=Hack\ Nerd\ Font\ 14
endif
" tab spaces
set tabstop=2
set softtabstop=2
set shiftwidth=2
set expandtab
" line number
set nu
" Disable end of line
:set nofixendofline
" Auto reload file when file changed
:set autoread
au FocusGained * :checktime
" hide scroll
set guioptions-=L
set guioptions-=r
" support copy & paste by Ctrl C/V/X
:imap <C-v> <ESC>"+pa
:vmap <C-c> "+y
:vmap <C-x> "+d
" support copy & paste by Command C/V/X
:imap <M-v> <ESC>"+pa
:vmap <M-c> "+y
:vmap <M-x> "+d
" switch window
map <Leader>[ :bp<Enter>
map <Leader>] :bn<Enter>
" Toggle terminal
nnoremap <F11> :call ToggleTerm("term-slider", 1)<CR>
function! ToggleTerm(termname, slider)
let pane = bufwinnr(a:termname)
let buf = bufexists(a:termname)
if pane > 0
" pane is visible
if a:slider > 0
:exe pane . "wincmd c"
else
:exe "e #"
endif
elseif buf > 0
" buffer is not in pane
if a:slider
:exe "botright split +resize10"
endif
:exe "buffer " . a:termname
else
" buffer is not loaded, create
if a:slider
:exe "botright split +resize10"
endif
:terminal
:exe "f " a:termname
endif
endfunction
" split window
map <Leader>sv :vsplit<Enter>
map <Leader>sh :split<Enter>