172 lines
5.0 KiB
VimL
172 lines
5.0 KiB
VimL
scriptencoding utf-8
|
||
|
||
" Change fillchars for folding, vertical split, end of buffer, and message
|
||
" separator
|
||
set fillchars=fold:\ ,foldsep:\ ,foldopen:,foldclose:,vert:\│,eob:\ ,msgsep:‾,diff:╱
|
||
|
||
" Time in milliseconds to wait for a mapped sequence to complete
|
||
set timeoutlen=500
|
||
|
||
" For CursorHold events
|
||
set updatetime=500
|
||
|
||
" Always use clipboard for all delete, yank, change, and put operations
|
||
if !empty(provider#clipboard#Executable())
|
||
set clipboard+=unnamedplus
|
||
endif
|
||
|
||
" Ignore certain files and folders when globing
|
||
set wildignore+=*.o,*.obj,*.dylib,*.bin,*.dll,*.exe
|
||
set wildignore+=*/.git/*,*/.svn/*,*/__pycache__/*,*/build/**
|
||
set wildignore+=*.jpg,*.png,*.jpeg,*.bmp,*.gif,*.tiff,*.svg,*.ico
|
||
set wildignore+=*.pyc,*pkl
|
||
set wildignore+=*.DS_Store
|
||
set wildignore+=*.aux,*.bbl,*.blg,*.brf,*.fls,*.fdb_latexmk,*.synctex.gz,*.xdv
|
||
set wildignorecase " ignore file and dir name cases in cmd-completion
|
||
|
||
" Set up backup directory
|
||
let g:backupdir=expand(stdpath('data') . '/backup//')
|
||
let &backupdir=g:backupdir
|
||
|
||
" Skip backup for patterns in option wildignore
|
||
let &backupskip=&wildignore
|
||
set backup " create backup for files
|
||
set backupcopy=yes " copy the original file to backupdir and overwrite it
|
||
|
||
" Set up swap directory
|
||
let g:swapdir=expand(stdpath('data') . '/swap//')
|
||
let &directory=g:swapdir
|
||
|
||
" Set up persistent undo
|
||
set undofile
|
||
let g:undodir=expand(stdpath('data') . '/undo//')
|
||
let &undodir=g:undodir
|
||
|
||
" General tab settings
|
||
set tabstop=2 " number of visual spaces per TAB
|
||
set softtabstop=2 " number of spaces in tab when editing
|
||
set shiftwidth=2 " 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
|
||
|
||
" Break line at predefined characters
|
||
set linebreak
|
||
|
||
" Character to show before the lines that have been soft-wrapped
|
||
set showbreak=↪
|
||
|
||
" List all matches and complete till longest common string
|
||
set wildmode=list:longest
|
||
|
||
" Minimum lines to keep above and below cursor when scrolling
|
||
set scrolloff=3
|
||
|
||
" Use mouse to select and resize windows, etc.
|
||
set mouse=n
|
||
set mousemodel=popup " Set the behavior of mouse
|
||
set mousescroll=ver:1,hor:0
|
||
|
||
" Fileformats to use for new files
|
||
set fileformats=unix,dos
|
||
|
||
" Ask for confirmation when handling unsaved or read-only files
|
||
set confirm
|
||
|
||
" Do not use visual and errorbells
|
||
set visualbell noerrorbells
|
||
|
||
" Number of commands and search history to keep
|
||
set history=500
|
||
|
||
" Use list mode and customized listchars (show characters for whitespace)
|
||
set list listchars=tab:▸\ ,extends:❯,precedes:❮,nbsp:␣
|
||
|
||
" Auto-write the file base on some condition
|
||
set autowrite
|
||
|
||
" Show hostname and full path of file on the window title
|
||
set title
|
||
set titlestring=
|
||
set titlestring=%{utils#Get_titlestr()}
|
||
|
||
" Do not show "match xx of xx" and other messages during auto-completion
|
||
set shortmess+=c
|
||
|
||
" Do not show search match count on bottom right
|
||
set shortmess+=S
|
||
|
||
" Disable showing intro message (:intro)
|
||
set shortmess+=I
|
||
|
||
set messagesopt=hit-enter,history:500
|
||
|
||
" Completion behavior
|
||
" 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
|
||
|
||
set pumheight=10 " Maximum number of items to show in popup menu
|
||
set pumblend=5 " pseudo transparency for completion menu
|
||
|
||
set winblend=0 " pseudo transparency for floating window
|
||
set winborder=none
|
||
|
||
" Insert mode key word completion setting
|
||
set complete+=kspell complete-=w complete-=b complete-=u complete-=t
|
||
|
||
set spelllang=en,cjk " Spell languages
|
||
set spellsuggest+=9 " Show 9 spell suggestions at most
|
||
|
||
" Align indent to next multiple value of shiftwidth
|
||
set shiftround
|
||
|
||
" Virtual edit is useful for visual block edit
|
||
set virtualedit=block
|
||
|
||
" Correctly break multi-byte characters such as CJK
|
||
set formatoptions+=mM
|
||
|
||
" Text after this column number is not highlighted
|
||
set synmaxcol=250
|
||
|
||
set nostartofline
|
||
|
||
" External program to use for grep command
|
||
if executable('rg')
|
||
set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case
|
||
set grepformat=%f:%l:%c:%m
|
||
endif
|
||
|
||
" Enable true color support
|
||
set termguicolors
|
||
|
||
" Set up cursor color and shape in various modes, ref:
|
||
" https:;//github.com/neovim/neovim/wiki/FAQ#how-to-change-cursor-color-in-the-terminal
|
||
set guicursor=n-v-c:block-Cursor/lCursor,i-ci-ve:ver25-Cursor2/lCursor2,r-cr:hor20,o:hor20
|
||
|
||
set signcolumn=yes:1
|
||
|
||
" Remove certain character from file name pattern matching
|
||
set isfname-==
|
||
set isfname-=,
|
||
|
||
" diff options
|
||
set diffopt=
|
||
set diffopt+=vertical " show diff in vertical position
|
||
set diffopt+=filler " show filler for deleted lines
|
||
set diffopt+=closeoff " turn off
|
||
|
||
set shell=/bin/ash
|