Last active
February 24, 2022 05:24
-
-
Save Fatpandac/fc9bd9facdf0f556e6e94d5fc2fa90d4 to your computer and use it in GitHub Desktop.
My Neovim configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let PlugPathLinux='/home/fatpandac/.config/nvim/plugged' | |
set number "显示行数 | |
set relativenumber "显示相对行数 | |
set updatetime=300 | |
set cc=80 | |
set t_Co=256 | |
set softtabstop=4 | |
set shiftwidth=4 | |
set showtabline=1 | |
set tabstop=4 "设置缩进 | |
set expandtab "使得 tab 转换为空格 | |
set fileencodings=UTF-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 | |
set cursorline "当行高亮 | |
set encoding=utf-8 "使用 utf-8 编码 | |
set noswapfile | |
set nofoldenable | |
set nobackup "不备份 | |
set foldmethod=indent "设置缩进 | |
tnoremap <Esc> <C-\><C-n> | |
set noshowmode | |
colorscheme gruvbox | |
set termguicolors | |
" 清除查找后的标记 | |
nnoremap <silent> <C-l> :<C-u>nohlsearch<CR><C-l> | |
"coc-ci | |
nmap <silent> w <Plug>(coc-ci-w) | |
nmap <silent> b <Plug>(coc-ci-b) | |
nmap <leader>rn <Plug>(coc-rename) | |
"Make <CR> auto-select the first completion item and notify coc.nvim to | |
"format on enter, <cr> could be remapped by other vim plugin | |
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~# '\s' | |
endfunction | |
" Coc-translator | |
" NOTE: do NOT use `nore` mappings | |
" popup | |
nmap <Leader>t <Plug>(coc-translator-p) | |
vmap <Leader>t <Plug>(coc-translator-pv) | |
" echo | |
nmap <Leader>e <Plug>(coc-translator-e) | |
vmap <Leader>e <Plug>(coc-translator-ev) | |
" replace | |
nmap <Leader>r <Plug>(coc-translator-r) | |
vmap <Leader>r <Plug>(coc-translator-rv) | |
" 设置tab键映射 | |
nmap <tab> :tabn<CR> | |
nmap <S-tab> :tabp<CR> | |
" explorer | |
nnoremap <C-c> :CocCommand explorer<CR> | |
" harpoon | |
nmap <C-p> :lua require("harpoon.ui").toggle_quick_menu()<CR> | |
nmap <C-s> :lua require("harpoon.mark").add_file()<CR> | |
"插件 | |
call plug#begin(PlugPathLinux) | |
Plug 'chentau/marks.nvim' | |
Plug 'github/copilot.vim' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'ThePrimeagen/harpoon' | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'dstein64/vim-startuptime' | |
" from Tim Pope | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-commentary' | |
Plug 'morhetz/gruvbox' | |
Plug 'Yggdroot/indentLine' | |
let g:indent_guides_guide_size = 1 " 指定对齐线的尺寸 | |
let g:indent_guides_start_level = 2 " 从第二层开始可视化显示缩进 | |
Plug 'itchyny/lightline.vim' | |
let g:lightline = { | |
\ 'colorscheme': 'wombat', | |
\ 'background': 'dark' | |
\ } | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'wakatime/vim-wakatime', {'on' : [] } | |
Plug 'Valloric/MatchTagAlways', {'on' : [] } | |
augroup load_plug | |
autocmd! | |
autocmd InsertEnter * call plug#load('MatchTagAlways', | |
\'vim-wakatime') | autocmd! load_plug | |
augroup END | |
Plug 'frazrepo/vim-rainbow' | |
let g:rainbow_active = 1 "括号涂色 | |
call plug#end() | |
lua <<EOF | |
require('nvim-treesitter.configs').setup { | |
ensure_installed = all, | |
sync_install = true, -- install languages synchronously (only applied to `ensure_installed`) | |
highlight = { | |
enable = true, -- false will disable the whole extension | |
additional_vim_regex_highlighting = true, | |
}, | |
} | |
require'marks'.setup { | |
mappings = { | |
set_next = "m,", | |
next = "m]", | |
preview = "m;", | |
set_bookmark0 = "m0", | |
prev = false -- pass false to disable only this default mapping | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment