我的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

" 基本縮進(jìn)效果
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

"分頁跳轉(zhuǎn)
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
"分頁大小調(diào)整
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

"復(fù)制粘貼
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>
"不顯示文檔總字?jǐn)?shù)
"let g:airline#extensions#wordcount#enabled = 0
""不顯示文件編碼(Windows系統(tǒng))
let g:airline#parts#ffenc#skip_expected_string='utf-8[dos]'
"設(shè)置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擴(kuò)展
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
""安裝字體后必須設(shè)置
"let g:airline_powerline_fonts = 1
""關(guān)閉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
"數(shù)學(xué)公式
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'

""設(shè)置tab鍵為觸發(fā)鍵
let g:UltiSnipsExpandTrigger = '<C-j>'
"設(shè)置向后跳轉(zhuǎn)鍵
let g:UltiSnipsJumpForwardTrigger = '<C-j>'
"設(shè)置向前跳轉(zhuǎn)鍵
let g:UltiSnipsJumpBackwardTrigger = '<C-k>'
"設(shè)置文件目錄
let g:UltiSnipsSnippetsDir = '~/.vim/UltiSnips'
let g:UltiSnipsSnippetDirectories = ['UltiSnips']
"設(shè)置打開配置文件時為垂直打開
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 " 從第二層開始可視化顯示縮進(jìn)
" ===
" === 多光標(biāo)
" ===
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 是設(shè)置quickfix的errorformat,以便vim識別
" makeprg 是vim內(nèi)置的編譯命令,可以通過更改來實現(xiàn)編譯對應(yīng)類型文件羹饰。具體可參考vim官方說明文件阐枣。
" copen是打開quickfix侵贵,n用來設(shè)置quichfix窗口大小,如 cope5蚂子。在錯誤描述上回車本缠,可以直接跳轉(zhuǎn)到錯誤行斥扛。
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>

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末丹锹,一起剝皮案震驚了整個濱河市稀颁,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌卷仑,老刑警劉巖峻村,帶你破解...
    沈念sama閱讀 218,755評論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件麸折,死亡現(xiàn)場離奇詭異锡凝,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)垢啼,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,305評論 3 395
  • 文/潘曉璐 我一進(jìn)店門窜锯,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人芭析,你說我怎么就攤上這事锚扎。” “怎么了馁启?”我有些...
    開封第一講書人閱讀 165,138評論 0 355
  • 文/不壞的土叔 我叫張陵驾孔,是天一觀的道長。 經(jīng)常有香客問我惯疙,道長翠勉,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,791評論 1 295
  • 正文 為了忘掉前任霉颠,我火速辦了婚禮对碌,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘蒿偎。我一直安慰自己朽们,他們只是感情好怀读,可當(dāng)我...
    茶點故事閱讀 67,794評論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著骑脱,像睡著了一般菜枷。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上叁丧,一...
    開封第一講書人閱讀 51,631評論 1 305
  • 那天犁跪,我揣著相機(jī)與錄音,去河邊找鬼歹袁。 笑死坷衍,一個胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的条舔。 我是一名探鬼主播枫耳,決...
    沈念sama閱讀 40,362評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼孟抗!你這毒婦竟也來了迁杨?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,264評論 0 276
  • 序言:老撾萬榮一對情侶失蹤凄硼,失蹤者是張志新(化名)和其女友劉穎铅协,沒想到半個月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體摊沉,經(jīng)...
    沈念sama閱讀 45,724評論 1 315
  • 正文 獨居荒郊野嶺守林人離奇死亡狐史,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,900評論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發(fā)現(xiàn)自己被綠了说墨。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片骏全。...
    茶點故事閱讀 40,040評論 1 350
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖尼斧,靈堂內(nèi)的尸體忽然破棺而出姜贡,到底是詐尸還是另有隱情,我是刑警寧澤棺棵,帶...
    沈念sama閱讀 35,742評論 5 346
  • 正文 年R本政府宣布楼咳,位于F島的核電站,受9級特大地震影響烛恤,放射性物質(zhì)發(fā)生泄漏母怜。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點故事閱讀 41,364評論 3 330
  • 文/蒙蒙 一棒动、第九天 我趴在偏房一處隱蔽的房頂上張望糙申。 院中可真熱鬧,春花似錦、人聲如沸柜裸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,944評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽疙挺。三九已至扛邑,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間铐然,已是汗流浹背蔬崩。 一陣腳步聲響...
    開封第一講書人閱讀 33,060評論 1 270
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點兒被人妖公主榨干…… 1. 我叫王不留搀暑,地道東北人沥阳。 一個月前我還...
    沈念sama閱讀 48,247評論 3 371
  • 正文 我出身青樓,卻偏偏與公主長得像自点,于是被迫代替她去往敵國和親桐罕。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 44,979評論 2 355

推薦閱讀更多精彩內(nèi)容