From 460ec98052e07bbf16d8143d8f242280662582a6 Mon Sep 17 00:00:00 2001 From: jdhao Date: Thu, 26 Sep 2019 23:18:19 +0800 Subject: Split large nvim config into several files for easier management --- options.vim | 156 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 options.vim (limited to 'options.vim') diff --git a/options.vim b/options.vim new file mode 100644 index 0000000..1aa7b38 --- /dev/null +++ b/options.vim @@ -0,0 +1,156 @@ +"{ Builtin options and settings +" Changing fillchars for folding, so there is no garbage charactes +set fillchars=fold:\ ,vert:\| + +" Paste mode toggle, it seems that Neovim's bracketed paste mode +" does not work very well for nvim-qt, so we use good-old paste mode +set pastetoggle= + +" Split window below/right when creating horizontal/vertical windows +set splitbelow splitright + +" Time in milliseconds to wait for a mapped sequence to complete, +" see https://goo.gl/vHvyu8 for more info +set timeoutlen=500 + +" For CursorHold events +set updatetime=2000 + +" Clipboard settings, always use clipboard for all delete, yank, change, put +" operation, see https://goo.gl/YAHBbJ +set clipboard+=unnamedplus + +" Disable creating swapfiles, see https://goo.gl/FA6m6h +set noswapfile + +" General tab settings +set tabstop=4 " number of visual spaces per TAB +set softtabstop=4 " number of spaces in tab when editing +set shiftwidth=4 " number of spaces to use for autoindent +set expandtab " expand tab to spaces so that tabs are spaces + +" Set matching pairs of characters and highlight matching brackets +set matchpairs+=<:>,「:」 + +" Show line number and relative line number +set number relativenumber + +" Ignore case in general, but become case-sensitive when uppercase is present +set ignorecase smartcase + +" File and script encoding settings for vim +set fileencoding=utf-8 +set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1 +scriptencoding utf-8 + +" Break line at predefined characters +set linebreak +" Character to show before the lines that have been soft-wrapped +set showbreak=↪ + +" List all items and start selecting matches in cmd completion +set wildmode=list:full + +" Show current line where the cursor is +set cursorline +" Set a ruler at column 80, see https://goo.gl/vEkF5i +set colorcolumn=80 + +" Minimum lines to keep above and below cursor when scrolling +set scrolloff=3 + +" Use mouse to select and resize windows, etc. +if has('mouse') + set mouse=nv " Enable mouse in several mode + set mousemodel=popup " Set the behaviour of mouse +endif + +" Do not show mode on command line since vim-airline can show it +set noshowmode + +" Fileformats to use for new files +set fileformats=unix,dos + +" The mode in which cursorline text can be concealed +set concealcursor=nc + +" The way to show the result of substitution in real time for preview +set inccommand=nosplit + +" Ignore certain files and folders when globbing +set wildignore+=*.o,*.obj,*.bin,*.dll,*.exe +set wildignore+=*/.git/*,*/.svn/*,*/__pycache__/*,*/build/** +set wildignore+=*.jpg,*.png,*.jpeg,*.gif,*.bmp,*.tiff +set wildignore+=*.pyc +set wildignore+=*.DS_Store +set wildignore+=*.aux,*.bbl,*.blg,*.brf,*.fls,*.fdb_latexmk,*.synctex.gz,*.pdf + +" Ask for confirmation when handling unsaved or read-only files +set confirm + +" Use visual bells to indicate errors, do not use errorbells +set visualbell noerrorbells + +" The level we start to fold +set foldlevel=0 + +" The number of command and search history to keep +set history=500 + +" Use list mode and customized listchars +set list listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:+ + +" Auto-write the file based on some condition +set autowrite + +" Show hostname, full path of file and last-mod time on the window title. +" The meaning of the format str for strftime can be found in +" http://tinyurl.com/l9nuj4a. The function to get lastmod time is drawn from +" http://tinyurl.com/yxd23vo8 +set title +set titlestring=%{hostname()}\ \ %{expand('%:p')}\ \ %{strftime('%Y-%m-%d\ %H:%M',getftime(expand('%')))} + +" Persistent undo even after you close a file and re-open it +set undofile + +" Do not show "match xx of xx" and other messages during auto-completion +set shortmess+=c + +" Completion behaviour +set completeopt+=noinsert " Auto select the first completion entry +set completeopt+=menuone " Show menu even if there is only one item +set completeopt-=preview " Disable the preview window + +" Settings for popup menu +set pumheight=15 " Maximum number of items to show in popup menu +set pumblend=5 " Pesudo blend effect for popup menu + +" Scan files given by `dictionary` option +set complete+=k,kspell complete-=w complete-=b complete-=u complete-=t + +" Dictionary files for different systems +let g:MY_DICT = expand(stdpath('config') . '/dict/words') +let &dictionary = &dictionary . ',' . g:MY_DICT + +set spelllang=en,cjk " Spell languages + +" Align indent to next multiple value of shiftwidth. For its meaning, +" see http://tinyurl.com/y5n87a6m +set shiftround + +" Virtual edit is useful for visual block edit +set virtualedit=block + +" Correctly break multi-byte characters such as CJK, +" see http://tinyurl.com/y4sq6vf3 +set formatoptions+=mM + +" Tilde (~) is an operator, thus must be followed by motions like `e` or `w`. +set tildeop + +" Do not add two space after a period when joining lines or formatting texts, +" see https://tinyurl.com/y3yy9kov +set nojoinspaces + +set ambiwidth=double +"} -- cgit v1.2.3