我的nvim配置文件

set encoding=utf-8
set autochdir
"末尾空格显示为点
set listchars=trail:.
set list
"不与vi兼容
set nocompatible
"更改字号
let s:fontsize = 24
function! AdjustFontSize(amount)
let s:fontsize = s:fontsize+a:amount
:execute "GuiFont! Consolas:h" . s:fontsize
endfunction
noremap :call AdjustFontSize(1)
noremap :call AdjustFontSize(-1)
inoremap :call AdjustFontSize(1)a
inoremap :call AdjustFontSize(-1)a

set rnu
"a文Swp件
set nobackup " no backup files
set noswapfile " no swap files
set nowritebackup " only in case you don't want a backup file while editing
set noundofile " no undo files
"折叠功能
"折叠
set nofoldenable
"语法高亮
syntax on
filetype on
filetype plugin on
set ignorecase
set mouse=a
"搜索高亮
set hlsearch

set wildmenu
" 显示行号
set number"
let mapleader=","

set pastetoggle=

set backspace=indent,eol,start

" 基本缩进效果
set noautoindent
set tabstop=4
set shiftwidth=4
set expandtab
noremap J 5j
noremap K 5k
noremap L 7l
noremap H 7h
map S
noremap S :w
noremap Q :q
map R :source $MYVIMRC
source C:/Editor/neovim/snippits.vim

"分页跳转
noremap h
noremap j
noremap k
noremap l
"noremap E :vsplit C:/Users/lenovo/AppData/Local/nvim/init.vim

noremap E :tabnew $MYVIMRC

"分页
"noremap s
"noremap sj
"noremap v
"noremap vl
"分页大小调整
map :res +5
map :res -5
map :vertical resize-5
map :vertical resize+5
"快捷键
map ui
inoremap

inoremap /
map e $
map b 0

"复制粘贴
inoremap "*pa

call plug#begin('~/.vim/plugged')
" ===
" === wildfire
" ===
Plug 'gcmt/wildfire.vim'
Plug 'tpope/vim-surround'

" ===
" === colorscheme
" ===
Plug 'rakr/vim-one'
Plug 'morhetz/gruvbox'
colorscheme gruvbox
set background=dark
highlight Normal guibg=NONE ctermbg=None
" ===
" === 代码补全coc
" ===
Plug 'https://gitee.com/from1999/coc.nvim.git',{'do': 'yarn install --frozen-lockfile'}
inoremap
\ pumvisible() ? "" :
\ check_back_space() ? "" :
\ coc#refresh()
inoremap pumvisible() ? "" : ""
inoremap complete_info()["selected"] != "-1" ? "" : "u"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap coc#refresh()
inoremap coc#refresh()
function! Show_documentation()
call CocActionAsync('highlight')
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('')
else
call CocAction('doHover')
endif
endfunction
nnoremap h :call Show_documentation()
" set runtimepath^=~/.config/nvim/coc-extensions/coc-flutter-tools/
" let g:coc_node_args = ['--nolazy', '--inspect-brk=6045']
" let NVIM_COC_LOG_FILE = '/Users/david/Desktop/log.txt'

nnoremap d :CocList diagnostics
nmap - (coc-diagnostic-prev)
nmap = (coc-diagnostic-next)
nnoremap :CocCommand
" Text Objects
xmap kf (coc-funcobj-i)
xmap af (coc-funcobj-a)
omap kf (coc-funcobj-i)
omap af (coc-funcobj-a)
xmap kc (coc-classobj-i)
omap kc (coc-classobj-i)
xmap ac (coc-classobj-a)
omap ac (coc-classobj-a)
" Useful commands
nnoremap y :CocList -A --normal yank
nmap gd (coc-definition)
nmap gy (coc-type-definition)
" nmap gi (coc-implementation)
nmap gr (coc-references)
nmap rn (coc-rename)
nmap tt :CocCommand explorer
" coc-translator
nmap ts (coc-translator-p)
" Remap for do codeAction of selected region
function! s:cocActionsOpenFromSelected(type) abort
execute 'CocCommand actions.open ' . a:type
endfunction
xmap a (coc-codeaction-selected)
nmap aw (coc-codeaction-selected)w
" coctodolist
nnoremap tn :CocCommand todolist.create
nnoremap tl :CocList todolist
nnoremap tu :CocCommand todolist.download:CocCommand todolist.upload
" coc-tasks
noremap ts :CocList tasks
" coc-snippets
imap (coc-snippets-expand)
vmap (coc-snippets-select)
let g:coc_snippet_next = ''
let g:coc_snippet_prev = ''
imap (coc-snippets-expand-jump)
let g:snips_author = 'Haozhe Wang'
autocmd BufRead,BufNewFile tsconfig.json set filetype=jsonc
" ===
" === tagbar
" ===

Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'majutsushi/tagbar'
nmap :TagbarToggle
"不显示文档总字数
"let g:airline#extensions#wordcount#enabled = 0
""不显示文件编码(Windows系统)
let g:airline#parts#ffenc#skip_expected_string='utf-8[dos]'
"设置tagber对于markdown的支持
let g:tagbar_type_markdown = {
\ 'ctagstype' : 'markdown',
\ 'kinds' : [
\ 'h:Chapter',
\ 'i:Section',
\ 'k:Paragraph',
\ 'j:Subparagraph'
\ ]
\ }
let g:asyncrun_status = ''
"取消显示warning部分
let g:airline_section_warning = ''
"激活tagbar扩展
let g:airline#extensions#tagbar#enabled = 1"
" ===
" === vim-toc
" ===
Plug 'mzlogin/vim-markdown-toc'
let g:vim_auto_upgdate_on_save = 1
let g:vmt_cycle_list_item_markers = 1

"===
" === tab
" ===
noremap :tabnext
noremap :tabprevious

"括号匹配
Plug 'jiangmiao/auto-pairs'
" ===
" === airline
" ===
"airline
""安装字体后必须设置
"let g:airline_powerline_fonts = 1
""关闭tabline
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#buffer_nr_show = 1

" ===
" === nerdtree
" ===
Plug 'preservim/nerdtree'
let NERDTreeShowHidden=1
map tt :NERDTree
map tc :NERDTreeClose
" ===
" === markdown
" ===
" Create markmap from the whole file
nmap m (coc-markmap-create)
" " Create markmap from the selected lines
vmap m (coc-markmap-create-v)"
Plug 'godlygeek/tabular' "必要插件,安装在vim-markdown前面
Plug 'plasticboy/vim-markdown'
Plug 'dkarter/bullets.vim'
" Bullets.vim
let g:bullets_enabled_file_types = [
\ 'markdown',
\ 'text',
\ 'gitcommit',
\ 'scratch',
\ 'md'
]
let g:vim_markdown_new_list_item_indent = 2
set concealcursor=""
let g:indentLine_concealcursor = 'Q'
let g:vmt_auto_update_on_save = 0
function RToc()
exe "/-toc .* -->"
let lstart=line('.')
exe "/-toc -->"
let lnum=line('.')
execute lstart.",".lnum."g/ /d"
endfunction
"数学公式
let g:vim_markdown_math = 1

"Plug 'suan/vim-instant-markdown'
Plug 'iamcco/mathjax-support-for-mkdp'
Plug 'https://gitee.com/yaozhijin/markdown-preview.nvim.git', { 'do': 'cd app && yarn install'}

" "
" ===
" === ulitsnips
" ===

Plug 'https://gitee.com/zgpio/ultisnips.git'

""设置tab键为触发键
let g:UltiSnipsExpandTrigger = ''
"设置向后跳转键
let g:UltiSnipsJumpForwardTrigger = ''
"设置向前跳转键
let g:UltiSnipsJumpBackwardTrigger = ''
"设置文件目录
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
let g:UltiSnipsSnippetDirectories = ['UltiSnips']
"设置打开配置文件时为垂直打开
let g:UltiSnipsEditSplit="vertical"

"________________代码片段 over _________________

Plug 'honza/vim-snippets'

" ===
" === 参考线
" ===
Plug 'Yggdroot/indentLine'
let g:indent_guides_guide_size = 1 " 指定对齐线的尺寸
let g:indent_guides_start_level = 2 " 从第二层开始可视化显示缩进
" ===
" === 多光标
" ===
Plug 'mg979/vim-visual-multi'

call plug#end()

" ===
" === markdown shortcuts
" ===
map :MarkdownPreview

autocmd BufRead,BufNewFile *.{mdkdarkdown$dwn} set noimdisable
noremap W :vsplit C:/Editor/neovim/snippits.vim

function CheckPythonSyntax()
let mp = &makeprg
let ef = &errorformat
let exeFile = expand("%:t")
setlocal makeprg=python\ -u
set efm=%C\ %.%#,%A\ \ File\ "%f"\,\ line\ %l%.%#,%Z%[%^\ ]%\@=%m
silent make %
copen
" set efm 是设置quickfix的errorformat,以便vim识别
" makeprg 是vim内置的编译命令,可以通过更改来实现编译对应类型文件。具体可参考vim官方说明文件。
" copen是打开quickfix,n用来设置quichfix窗口大小,如 cope5。在错误描述上回车,可以直接跳转到错误行。
let &makeprg = mp
let &errorformat = ef
endfunction
"一个是普通模式下,一个是插入模式下
au filetype python map :w :call CheckPythonSyntax()
au filetype python imap :w :call CheckPythonSyntax()

你可能感兴趣的:(我的nvim配置文件)