103 lines
2.1 KiB
VimL
103 lines
2.1 KiB
VimL
" window
|
|
"-------------------------------------------------------------------------------
|
|
" Split window
|
|
nmap ss :split<Return><C-w>w
|
|
nmap sv :vsplit<Return><C-w>w
|
|
" Move window
|
|
"nmap <Space> <C-w>w
|
|
"map s<left> <C-w>h
|
|
"map s<up> <C-w>k
|
|
"map s<down> <C-w>j
|
|
"map s<right> <C-w>l
|
|
map sh <C-w>h
|
|
map sk <C-w>k
|
|
map sj <C-w>j
|
|
map sl <C-w>l
|
|
|
|
" Resize window
|
|
nmap <leader><up> <C-w>+
|
|
nmap <leader><down> <C-w>-
|
|
nmap <leader><left> <C-w><
|
|
nmap <leader><right> <C-w>>
|
|
|
|
|
|
|
|
" 插入模式移动光标
|
|
inoremap <leader>h <Left>
|
|
inoremap <leader>j <Down>
|
|
inoremap <leader>k <Up>
|
|
inoremap <leader>l <Right>
|
|
inoremap <leader>d <Delete>
|
|
|
|
nnoremap L $
|
|
nnoremap H ^
|
|
|
|
" 退出
|
|
" nmap <leader>w :wq<CR>
|
|
" nmap <leader>q :wqa<CR>
|
|
|
|
|
|
nmap q :bd<CR>
|
|
nmap Q :qa!<CR>
|
|
|
|
" 重新加载设置
|
|
map R :source ~/.config/nvim/init.vim<CR>
|
|
|
|
|
|
" 全选
|
|
nmap <C-a> gg<S-v>G
|
|
|
|
" 切换页面
|
|
" nmap <S-Tab> :bprev<Return>
|
|
" nmap <Tab> :bnext<Return>
|
|
nmap <S-Tab> :BufferLineCyclePrev<CR>
|
|
nmap <Tab> :BufferLineCycleNext<CR>
|
|
nmap <leader>1 :BufferLineGoToBuffer 1<CR>
|
|
nmap <leader>2 :BufferLineGoToBuffer 2<CR>
|
|
nmap <leader>3 :BufferLineGoToBuffer 3<CR>
|
|
nmap <leader>4 :BufferLineGoToBuffer 4<CR>
|
|
nmap <leader>5 :BufferLineGoToBuffer 5<CR>
|
|
nmap <leader>6 :BufferLineGoToBuffer 6<CR>
|
|
nmap <leader>7 :BufferLineGoToBuffer 7<CR>
|
|
nmap <leader>8 :BufferLineGoToBuffer 8<CR>
|
|
nmap <leader>9 :BufferLineGoToBuffer 9<CR>
|
|
|
|
|
|
|
|
|
|
nnoremap <F2> :NvimTreeToggle<CR>
|
|
|
|
|
|
" telescope
|
|
nnoremap sf <cmd>Telescope find_files<CR>
|
|
nnoremap sw <cmd>Telescope live_grep<CR>
|
|
|
|
" 禁用f1
|
|
" map <F1> <Nop>
|
|
map <F1> :ToggleTerm<CR>
|
|
|
|
|
|
map <F5> :call CompileRunGcc()<CR>
|
|
|
|
func! CompileRunGcc()
|
|
exec "w"
|
|
if &filetype == 'c'
|
|
exec '!g++ % -o %<'
|
|
exec '!time ./%<'
|
|
elseif &filetype == 'cpp'
|
|
exec '!g++ % -o %< -lboost_system'
|
|
exec '!time ./%<'
|
|
elseif &filetype == 'python'
|
|
exec '!time python %'
|
|
elseif &filetype == 'sh'
|
|
:!time bash %
|
|
elseif &filetype == 'go'
|
|
exec 'GoRun'
|
|
elseif &filetype == 'rust'
|
|
exec 'TermExec cmd="cargo run"'
|
|
elseif &filetype == 'verilog'
|
|
exec '!iverilog -o test.vvp % && ./test.vvp && open -a gtkwave test.vcd'
|
|
endif
|
|
endfunc
|
|
|