This commit is contained in:
root
2025-08-10 20:24:22 +00:00
commit f470e78d1c
75 changed files with 4408 additions and 0 deletions

171
viml_conf/options.vim Normal file
View File

@@ -0,0 +1,171 @@
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

188
viml_conf/plugins.vim Normal file
View File

@@ -0,0 +1,188 @@
scriptencoding utf-8
lua require('plugin_specs')
call utils#Cabbrev('pi', 'Lazy install')
call utils#Cabbrev('pud', 'Lazy update')
call utils#Cabbrev('pc', 'Lazy clean')
call utils#Cabbrev('ps', 'Lazy sync')
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" configurations for vimscript plugins "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" UltiSnips settings
let g:UltiSnipsExpandTrigger='<c-j>'
let g:UltiSnipsEnableSnipMate = 0
let g:UltiSnipsJumpForwardTrigger='<c-j>'
let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'my_snippets']
" vlime settings
command! -nargs=0 StartVlime call jobstart(printf('sbcl --load %s/vlime/lisp/start-vlime.lisp', g:package_home))
" vista settings
let g:vista#renderer#icons = {
\ 'member': '',
\ }
let g:vista_echo_cursor = 0
let g:vista_stay_on_open = 0
nnoremap <silent> <Space>t :<c-u>Vista!!<cr>
" vim-mundo settings
let g:mundo_verbose_graph = 0
let g:mundo_width = 80
nnoremap <silent> <Space>u :MundoToggle<CR>
" better-escape.vim settings
let g:better_escape_interval = 200
" vim-xkbswitch settings
let g:XkbSwitchEnabled = 1
" markdown-preview settings
if g:is_win || g:is_mac
let g:mkdp_auto_close = 0
nnoremap <silent> <M-m> :<c-u>MarkdownPreview<cr>
nnoremap <silent> <M-S-m> :<c-u>MarkdownPreviewStop<cr>
endif
" vim-grammarous settings
if g:is_mac
let g:grammarous#languagetool_cmd = 'languagetool'
let g:grammarous#disabled_rules = {
\ '*': ['WHITESPACE_RULE', 'EN_QUOTES', 'ARROWS', 'SENTENCE_WHITESPACE',
\ 'WORD_CONTAINS_UNDERSCORE', 'COMMA_PARENTHESIS_WHITESPACE',
\ 'EN_UNPAIRED_BRACKETS', 'UPPERCASE_SENTENCE_START',
\ 'ENGLISH_WORD_REPEAT_BEGINNING_RULE', 'DASH_RULE', 'PLUS_MINUS',
\ 'PUNCTUATION_PARAGRAPH_END', 'MULTIPLICATION_SIGN', 'PRP_CHECKOUT',
\ 'CAN_CHECKOUT', 'SOME_OF_THE', 'DOUBLE_PUNCTUATION', 'HELL',
\ 'CURRENCY', 'POSSESSIVE_APOSTROPHE', 'ENGLISH_WORD_REPEAT_RULE',
\ 'NON_STANDARD_WORD', 'AU', 'DATE_NEW_YEAR'],
\ }
augroup grammarous_map
autocmd!
autocmd FileType markdown nmap <buffer> <leader>x <Plug>(grammarous-close-info-window)
autocmd FileType markdown nmap <buffer> <c-n> <Plug>(grammarous-move-to-next-error)
autocmd FileType markdown nmap <buffer> <c-p> <Plug>(grammarous-move-to-previous-error)
augroup END
endif
" unicode.vim settings
nmap ga <Plug>(UnicodeGA)
" vim-sandwich settings
nmap s <Nop>
omap s <Nop>
" vimtex settings
if executable('latex')
function! s:write_server_name() abort
let nvim_server_file = (has('win32') ? $TEMP : '/tmp') . '/vimtexserver.txt'
call writefile([v:servername], nvim_server_file)
endfunction
augroup vimtex_common
autocmd!
autocmd FileType tex call s:write_server_name()
autocmd FileType tex nmap <buffer> <F9> <Plug>(vimtex-compile)
augroup END
let g:vimtex_compiler_latexmk = {
\ 'build_dir' : 'build',
\ }
let g:vimtex_toc_config = {
\ 'name' : 'TOC',
\ 'layers' : ['content', 'todo', 'include'],
\ 'resize' : 1,
\ 'split_width' : 30,
\ 'todo_sorted' : 0,
\ 'show_help' : 1,
\ 'show_numbers': 1,
\ 'mode' : 2,
\ }
if g:is_win
let g:vimtex_view_general_viewer = 'SumatraPDF'
let g:vimtex_view_general_options = '-reuse-instance -forward-search @tex @line @pdf'
endif
if g:is_mac
let g:vimtex_view_general_viewer = '/Application/Skim.app/Contents/SharedSupport/displayline'
let g:vimtex_view_general_options = '-r @line @pdf @tex'
augroup vimtex_mac
autocmd!
autocmd User VimtexEventCompileSuccess call UpdateSkim()
augroup END
function! UpdateSkim() abort
let l:out = b:vimtex.out()
let l:src_file_path = expand('%:p')
let l:cmd = [g:vimtex_view_general_viewer, '-r']
if !empty(system('pgrep Skim'))
call extend(l:cmd, ['-g'])
endif
call jobstart(l:cmd + [line('.'), l:out, l:src_file_path])
endfunction
endif
endif
" vim-matchup settings
let g:matchup_matchparen_deferred = 1
let g:matchup_matchparen_timeout = 100
let g:matchup_matchparen_insert_timeout = 30
let g:matchup_override_vimtex = 1
let g:matchup_delim_noskips = 0
let g:matchup_matchparen_offscreen = {'method': 'popup'}
" asyncrun.vim settings
let g:asyncrun_open = 6
if g:is_win
let g:asyncrun_encs = 'gbk'
endif
" firenvim settings
if exists('g:started_by_firenvim') && g:started_by_firenvim
if g:is_mac
set guifont=Iosevka\ Nerd\ Font:h18
else
set guifont=Consolas
endif
let g:firenvim_config = {
\ 'globalSettings': {
\ 'alt': 'all',
\ },
\ 'localSettings': {
\ '.*': {
\ 'cmdline': 'neovim',
\ 'priority': 0,
\ 'selector': 'textarea',
\ 'takeover': 'never',
\ },
\ },
\ }
function s:setup_firenvim() abort
set signcolumn=no
set noruler
set noshowcmd
set laststatus=0
set showtabline=0
endfunction
augroup firenvim
autocmd!
autocmd BufEnter * call s:setup_firenvim()
autocmd BufEnter sqlzoo*.txt set filetype=sql
autocmd BufEnter github.com_*.txt set filetype=markdown
autocmd BufEnter stackoverflow.com_*.txt set filetype=markdown
augroup END
endif
" nvim-gdb settings
nnoremap <leader>dp :<c-u>GdbStartPDB python -m pdb %<cr>