From 7538adb5ac559517be4317e545a01e2eced98e4a Mon Sep 17 00:00:00 2001 From: Xiao Pan Date: Sun, 27 Jul 2025 13:49:55 +0800 Subject: config nvim to let gq wrap Chinese sentences --- home/xyz/.config/nvim/init.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'home/xyz/.config') diff --git a/home/xyz/.config/nvim/init.vim b/home/xyz/.config/nvim/init.vim index b5c7be08..cd1a4004 100644 --- a/home/xyz/.config/nvim/init.vim +++ b/home/xyz/.config/nvim/init.vim @@ -76,8 +76,12 @@ endfunction " https://www.youtube.com/watch?v=dBBUOO1PRIU augroup mycmd autocmd! - " disable auto line break (tc) and insert comment (cro) - autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t + " Disable auto line break (tc) and insert comment (cro). Also add m and M + " to wrap Chinese sentences when using gq, more see :h fo-table. I learned + " it from: https://www.reddit.com/r/vim/comments/5k7fxg/comment/dbmngin/. + " The url use formatoptions+=mM but I choose to add one flag at a time + " because it is suggested in :h add-options-flags. + autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=t formatoptions+=m formatoptions+=M " auto rewrite as utf-8 if not when :w " if use FileType *, nvim can't recognize some file extensions, ex: .csv autocmd BufRead * let fenc_bef = Autocmd_set_fenc() -- cgit v1.2.3-70-g09d2