我的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 <C-ScrollWheelUp> :call AdjustFontSize(1)<CR>
noremap <C-ScrollWheelDown> :call AdjustFontSize(-1)<CR>
inoremap <C-ScrollWheelUp> <Esc>:call AdjustFontSize(1)<CR>a
inoremap <C-ScrollWheelDown> <Esc>:call AdjustFontSize(-1)<CR>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=<F10>

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 <nop>
noremap S :w<CR>
noremap Q :q<CR>
map R :source $MYVIMRC<CR>
source C:/Editor/neovim/snippits.vim

"分页跳转
noremap <M-H> <C-w>h
noremap <M-J> <C-w>j
noremap <M-K> <C-w>k
noremap <M-L> <C-w>l
"noremap E :vsplit C:/Users/lenovo/AppData/Local/nvim/init.vim<CR>

noremap E :tabnew $MYVIMRC<CR>

"分页
"noremap <C-up> <C-w>s
"noremap <C-down> <C-w>s<C-w>j
"noremap <C-left> <C-w>v
"noremap <C-right> <C-w>v<C-w>l
"分页大小调整
map <C-Up> :res +5<CR>
map <C-down> :res -5<CR>
map <C-left> :vertical resize-5<CR>
map <C-right> :vertical resize+5<CR>
"快捷键
map <C-z> <Esc>ui
inoremap <C-a> <ESc>

inoremap <C-f> <Esc>/
map e $
map b 0

"复制粘贴
inoremap <C-S-v> <Esc>"*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 <silent><expr> <TAB>
\ pumvisible() ? "<C-n>" :
\ <SID>check_back_space() ? "<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "<C-p>" : "<C-h>"
inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "<C-y>" : "<C-g>u<CR>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
inoremap <silent><expr> <c-space> coc#refresh()
inoremap <silent><expr> <c-o> coc#refresh()
function! Show_documentation()
call CocActionAsync('highlight')
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
nnoremap <LEADER>h :call Show_documentation()<CR>
" set runtimepath^=~/.config/nvim/coc-extensions/coc-flutter-tools/
" let g:coc_node_args = ['--nolazy', '--inspect-brk=6045']
" let NVIM_COC_LOG_LEVEL = 'debug' " letNVIM_COC_LOG_FILE = '/Users/david/Desktop/log.txt'

nnoremap <silent><nowait> <LEADER>d :CocList diagnostics<cr>
nmap <silent> <LEADER>- <Plug>(coc-diagnostic-prev)
nmap <silent> <LEADER>= <Plug>(coc-diagnostic-next)
nnoremap <c-c> :CocCommand<CR>
" Text Objects
xmap kf <Plug>(coc-funcobj-i)
xmap af <Plug>(coc-funcobj-a)
omap kf <Plug>(coc-funcobj-i)
omap af <Plug>(coc-funcobj-a)
xmap kc <Plug>(coc-classobj-i)
omap kc <Plug>(coc-classobj-i)
xmap ac <Plug>(coc-classobj-a)
omap ac <Plug>(coc-classobj-a)
" Useful commands
nnoremap <silent> <space>y :<C-u>CocList -A --normal yank<cr>
nmap <silent> gd <Plug>(coc-definition)
nmap <silent> gy <Plug>(coc-type-definition)
" nmap <silent> gi <Plug>(coc-implementation)
nmap <silent> gr <Plug>(coc-references)
nmap <leader>rn <Plug>(coc-rename)
nmap tt :CocCommand explorer<CR>
" coc-translator
nmap ts <Plug>(coc-translator-p)
" Remap for do codeAction of selected region
function! s:cocActionsOpenFromSelected(type) abort
execute 'CocCommand actions.open ' . a:type
endfunction
xmap <leader>a <Plug>(coc-codeaction-selected)
nmap <leader>aw <Plug>(coc-codeaction-selected)w
" coctodolist
nnoremap <leader>tn :CocCommand todolist.create<CR>
nnoremap <leader>tl :CocList todolist<CR>
nnoremap <leader>tu :CocCommand todolist.download<CR>:CocCommand todolist.upload<CR>
" coc-tasks
noremap <silent> <leader>ts :CocList tasks<CR>
" coc-snippets
imap <C-l> <Plug>(coc-snippets-expand)
vmap <C-e> <Plug>(coc-snippets-select)
let g:coc_snippet_next = '<c-e>'
let g:coc_snippet_prev = '<c-n>'
imap <C-e> <Plug>(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 <F8> :TagbarToggle<CR>
"不显示文档总字数
"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 <M-k> :tabnext<CR>
noremap <M-j> :tabprevious<CR>

"括号匹配
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<CR>
map tc :NERDTreeClose<CR>
" ===
" === markdown
" ===
" Create markmap from the whole file
nmap <Leader>m <Plug>(coc-markmap-create)
" " Create markmap from the selected lines
vmap <Leader>m <Plug>(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 = '<C-j>'
"设置向后跳转键
let g:UltiSnipsJumpForwardTrigger = '<C-j>'
"设置向前跳转键
let g:UltiSnipsJumpBackwardTrigger = '<C-k>'
"设置文件目录
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 <F5> :MarkdownPreview<CR>

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

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 <F6> :w <cr> :call CheckPythonSyntax() <cr>
au filetype python imap <F6> <esc> :w <cr> :call CheckPythonSyntax() <cr></cr></cr></esc></F6></cr></cr></F6>

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 211,290评论 6 491
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,107评论 2 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 156,872评论 0 347
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,415评论 1 283
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,453评论 6 385
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,784评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,927评论 3 406
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,691评论 0 266
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,137评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,472评论 2 326
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,622评论 1 340
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,289评论 4 329
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,887评论 3 312
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,741评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,977评论 1 265
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,316评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,490评论 2 348

推荐阅读更多精彩内容