├── .gitignore ├── README.md ├── assets └── readme2.png ├── autoload ├── common │ ├── common.vim │ └── functions.vim └── plug.vim ├── config.vim ├── config ├── base.vim ├── keymap.vim ├── layers.vim ├── layers │ ├── git.vim │ ├── lsp_coc.vim │ ├── lsp_completion-nvim.vim │ ├── lsp_lspsaga.vim │ ├── lsp_ycm.vim │ ├── plugin_list.vim │ ├── search_fzf.vim │ ├── search_telecope.vim │ ├── simple.vim │ └── theme.vim ├── other │ ├── UltiSnips │ │ ├── all.snippets │ │ ├── c.snippets │ │ ├── cpp.snippets │ │ ├── python.snippets │ │ ├── snippets.snippets │ │ └── tex.snippets │ ├── coc-settings.json │ ├── onestatus.json │ └── ycm_extra_conf.py ├── plugins │ ├── DoxygenToolkit.vim.vim │ ├── LanguageClient-neovim.vim │ ├── LeaderF.vim │ ├── MatchTagAlways.vim │ ├── ResizeWindow.vim.vim │ ├── YouCompleteMe.vim │ ├── accelerated-jk.vim │ ├── actionmenu.vim.vim │ ├── ale.vim │ ├── animate.vim.vim │ ├── asyncrun.vim.vim │ ├── auto-pairs.vim │ ├── auto-session.vim │ ├── barbar.nvim.vim │ ├── bclose.vim.vim │ ├── caw.vim.vim │ ├── clever-f.vim.vim │ ├── coc-fzf.vim │ ├── coc.nvim.vim │ ├── completion-nvim.vim │ ├── csv.vim │ ├── dashboard-nvim.vim │ ├── defx.nvim.vim │ ├── dict.vim.vim │ ├── eleline.vim.vim │ ├── far.vim.vim │ ├── fzf-preview.vim.vim │ ├── fzf.vim.vim │ ├── galaxyline.nvim.vim │ ├── gesture.nvim.vim │ ├── git-blame.nvim.vim │ ├── git.vim.vim │ ├── goyo.vim.vim │ ├── graphviz.vim.vim │ ├── hiPairs.vim │ ├── hop.nvim.vim │ ├── indent-guides.nvim.vim │ ├── indentLine.vim │ ├── jupyter-vim.vim │ ├── lens.vim.vim │ ├── lightline.vim.vim │ ├── limelight.vim.vim │ ├── lspsaga.nvim.vim │ ├── lualine.nvim.vim │ ├── lush.nvim.vim │ ├── ncm2.vim │ ├── neoformat.vim │ ├── nerdcommenter.vim │ ├── nerdtree.vim │ ├── nnn.vim.vim │ ├── nvim-bufferline.lua.vim │ ├── nvim-colorizer.lua.vim │ ├── nvim-compe.vim │ ├── nvim-lsp.vim │ ├── nvim-lspconfig.vim │ ├── nvim-scrollview.vim │ ├── nvim-tree.lua.vim │ ├── nvim-treesitter-refactor.vim │ ├── nvim-treesitter-textobjects.vim │ ├── nvim-treesitter.vim │ ├── nvim-ts-rainbow.vim │ ├── nvimux.vim │ ├── onestatus.vim │ ├── open-browser.vim.vim │ ├── pear-tree.vim │ ├── playground.vim │ ├── powerline.vim.vim │ ├── quick-scope.vim │ ├── rainbow.vim │ ├── ranger.vim.vim │ ├── rust.vim.vim │ ├── semshi.vim │ ├── spaceline.vim.vim │ ├── tagbar.vim │ ├── telescope.nvim.vim │ ├── tex-conceal.vim.vim │ ├── tlr.vim.vim │ ├── tmuxline.vim.vim │ ├── traces.vim.vim │ ├── ultisnips.vim │ ├── undotree.vim │ ├── vgit.nvim.vim │ ├── vim-LanguageTool.vim │ ├── vim-airline.vim │ ├── vim-anyfold.vim │ ├── vim-autoformat.vim │ ├── vim-barbaric.vim │ ├── vim-better-whitespace.vim │ ├── vim-bookmarks.vim │ ├── vim-choosewin.vim │ ├── vim-clap.vim │ ├── vim-closetag.vim │ ├── vim-crystalline.vim │ ├── vim-dispatch.vim │ ├── vim-doge.vim │ ├── vim-easy-align.vim │ ├── vim-easymotion.vim │ ├── vim-eft.vim │ ├── vim-emoji.vim.vim │ ├── vim-expand-region.vim │ ├── vim-floaterm.vim │ ├── vim-fugitive.vim │ ├── vim-gitgutter.vim │ ├── vim-hexokinase.vim │ ├── vim-indent-guides.vim │ ├── vim-keysound.vim │ ├── vim-latex-live-preview.vim │ ├── vim-markdown-runner.vim │ ├── vim-markdown-toc.vim │ ├── vim-markdown.vim │ ├── vim-matchup.vim │ ├── vim-medieval.vim │ ├── vim-move.vim │ ├── vim-mundo.vim │ ├── vim-polyglot.vim │ ├── vim-quickrun.vim │ ├── vim-sandwich.vim │ ├── vim-smooth-scroll.vim │ ├── vim-sneak.vim │ ├── vim-snip.vim │ ├── vim-startify.vim │ ├── vim-surround.vim │ ├── vim-table-mode.vim │ ├── vim-terminal-help.vim │ ├── vim-tmux-navigator.vim │ ├── vim-translate-me.vim.vim │ ├── vim-translator.vim │ ├── vim-visual-multi.vim │ ├── vim-vsnip.vim │ ├── vim-which-key.vim │ ├── vimade.vim │ ├── vimtex.vim │ ├── vimwiki.vim │ ├── vista.vim.vim │ └── zoomwintab.vim.vim └── theme │ ├── statusline.vim │ ├── tabline.vim │ └── theme.vim ├── ftplugin └── tex.vim ├── init.vim ├── plugin ├── alt.vim ├── note.vim └── session.vim ├── scripts └── preview.sh └── vimrc /.gitignore: -------------------------------------------------------------------------------- 1 | .netrwhist 2 | *.gif 3 | sessions/ 4 | pack/ 5 | *.bak 6 | *.bak2 7 | tags 8 | nerdtree_selected.json 9 | nerdtree.json 10 | *.old 11 | *~ 12 | test.vim 13 | -------------------------------------------------------------------------------- /assets/readme2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgheng/vime/18a361af51408298ddfdd2cb139ebbaa44a45216/assets/readme2.png -------------------------------------------------------------------------------- /autoload/common/common.vim: -------------------------------------------------------------------------------- 1 | " function! common#common#echo() abort 2 | " echom 'autoload#common#echo()' 3 | " endfunction 4 | 5 | " function! common#common#init() abort 6 | " " vimrc所在根目录 7 | " let g:vim_root_path = fnamemodify($MYVIMRC, ':h') . '/' 8 | " " 配置所在根目录 9 | " let g:config_root_path = g:vim_root_path . 'config/' 10 | " " 插件配置所在目录 11 | " let g:plugins_config_root_path = g:config_root_path . "plugins/" 12 | " let g:other_config_root_path = g:config_root_path . "other/" 13 | 14 | " " vim插件、缓存等数据根目录 15 | " let g:cache_root_path = $HOME . '/.cache/vim/' 16 | " " vim 插件安装目录 17 | " let g:plugins_install_path = g:cache_root_path . 'plugins/' 18 | " " session 保存目录 19 | " let g:session_dir = g:cache_root_path . 'sessions/' 20 | " " 撤销记录目录 21 | " let g:undo_dir = g:cache_root_path . 'undo/' 22 | 23 | " let g:os = systemlist('uname -s')[0] 24 | " let g:arch = systemlist('uname -m')[0] 25 | 26 | " " tmux配置文件目录 27 | " let g:tmux_config_path = $HOME . '/.tmux.conf' 28 | 29 | " " 脚本目录 30 | " let g:scripts_root_path = g:vim_root_path . "/scripts/" 31 | 32 | " " wiki笔记根目录 33 | " let g:vimwiki_path = $HOME . '/Documents/wiki/' 34 | 35 | " " 快速note文件 36 | " let g:quicknote_file = g:vimwiki_path . '/quicknote.md' 37 | " endfunction 38 | 39 | -------------------------------------------------------------------------------- /autoload/common/functions.vim: -------------------------------------------------------------------------------- 1 | """"""""""""""""""""""""""""""""""""""" 2 | " 3 | " 一些通用或者懒加载的自定义函数放到这里 4 | """"""""""""""""""""""""""""""""""""""" 5 | 6 | function! common#functions#PlugHasLoaded(plugName) abort 7 | " 判断插件是否已经载入 8 | return ( 9 | \ has_key(g:plugs, a:plugName) && 10 | \ stridx(&rtp, g:plugs[a:plugName].dir) >= 0) 11 | endfunction 12 | 13 | " TODO 应该先判断g:plugs_order是否存在 14 | function! common#functions#HasPlug(...) abort 15 | " 如果类型是列表,那么列表中的所有插件都要存在才可以 16 | " 其他情况如字符串,只需要存在一个即可 17 | " HasPlug("f", ["a", "b", "c"], "d", "e") 18 | " 需要f存在或者[a b c]都要存在或者d存在或者e存在 19 | 20 | if a:0 == 0 21 | return v:false 22 | endif 23 | 24 | " 如果有一个存在,那么就返回true 25 | for out_item in a:000 26 | " 如果类型是列表 27 | " 那么列表中的所有插件都要存在 28 | 29 | if type(out_item) == v:t_list 30 | 31 | let list_tag = v:true 32 | for item in out_item 33 | " 不存在 34 | if index(g:plugs_order, item) == -1 35 | let list_tag = v:false 36 | break 37 | endif 38 | endfor 39 | if list_tag 40 | return v:true 41 | endif 42 | 43 | " 否则,只需要检测是否存在 44 | elseif type(out_item) == v:t_string 45 | if index(g:plugs_order, out_item) > -1 46 | return v:true 47 | endif 48 | endif 49 | endfor 50 | 51 | 52 | " 插件列表中是否存在该插件 53 | " return (index(g:plugs_order, a:plugName) > -1 ? v:true : v:false) 54 | endfunction 55 | 56 | function! common#functions#HasInstall(plugName) abort 57 | " 判断插件是否已经安装在本地 58 | return (isdirectory(g:plugs[a:plugName].dir) ? v:true : v:false) 59 | endfunction 60 | 61 | function! common#functions#HasCocPlug(plugName) abort 62 | " 判断是否安装了coc插件 63 | if common#functions#HasPlug('coc.nvim') && has_key(g:, 'coc_global_extensions') && 64 | \ index(g:coc_global_extensions, a:plugName) > -1 65 | return v:true 66 | else 67 | return v:false 68 | endif 69 | endfunction 70 | 71 | function! common#functions#Wall() abort 72 | " 写入所有文件 73 | " 记录当前的tab以及window 74 | let tab = tabpagenr() 75 | let win = winnr() 76 | let seen = {} 77 | " 保存当前的buffer 78 | if !&readonly && expand("%") !=# '' 79 | let seen[bufnr('')] = 1 80 | write 81 | endif 82 | " 在每个标签页每个窗口执行 83 | tabdo windo if !&readonly && &buftype =~# '^\%(acwrite\)\=$' && expand('%') !=# '' && !has_key(seen, bufnr('')) | silent write | let seen[bufnr('')] = 1 | endif 84 | " 返回之前的tab和window 85 | execute 'tabnext '.tab 86 | execute win.'wincmd w' 87 | endfunction 88 | 89 | function! common#functions#MoveTabOrBuf(direction) abort 90 | " 移动buffer或者tab 91 | " 0 <- 1 -> 92 | 93 | let s:exclude_ft = ["coc-explorer", "vista"] 94 | if index(s:exclude_ft, &ft) != -1 | return | endif 95 | 96 | " 如果在floaterm中 97 | if &ft ==# "floaterm" 98 | if a:direction == 0 99 | exec "FloatermNext" 100 | else 101 | exec "FloatermPrev" 102 | endif 103 | 104 | return 105 | endif 106 | 107 | if tabpagenr('$') > 1 108 | call common#functions#moveTab(a:direction) 109 | else 110 | call common#functions#moveBuffer(a:direction) 111 | endif 112 | endfunction 113 | 114 | function! common#functions#moveTab(direction) abort 115 | if a:direction == 0 116 | exec 'tabprevious' 117 | elseif a:direction == 1 118 | exec 'tabnext' 119 | endif 120 | endfunction 121 | 122 | function! common#functions#moveBuffer(direction) abort 123 | if a:direction == 0 124 | exec 'bprevious' 125 | elseif a:direction == 1 126 | exec 'bnext' 127 | endif 128 | endfunction 129 | 130 | function! common#functions#OpenFileUsingSystemApp(filePath) abort 131 | " 使用系统应用打开当前文件 132 | exec 'silent !xdg-open ' . fnameescape(a:filePath) . ' > /dev/null' 133 | endfunction 134 | 135 | function! common#functions#ModeType() abort 136 | " 获得当前的模式 137 | " 返回n, i, v, R中的一种 138 | if mode() =~# '[nc]' 139 | return 'n' 140 | elseif mode() =~# '[it]' 141 | return 'i' 142 | elseif mode() =~# '[vVsS]' 143 | return 'v' 144 | elseif mode() ==# 'R' 145 | return 'R' 146 | endif 147 | return '' 148 | endfunction 149 | 150 | " TODO 更改为字典,if判断速度较慢 151 | function! common#functions#ModeLabel() abort 152 | " 获得模式的标签 153 | " 如NORMAL INSERT VISUAL等 154 | let l:mode = common#functions#ModeType() 155 | if l:mode ==? 'n' 156 | return 'NORMAL' 157 | elseif l:mode ==? 'i' 158 | return 'INSERT' 159 | elseif l:mode ==? 'v' 160 | return 'VISUAL' 161 | elseif l:mode ==? 'R' 162 | return 'REPLACE' 163 | else 164 | return '' 165 | endif 166 | endfunction 167 | 168 | function! common#functions#ModeLabelWithColor() abort 169 | " 获得模式的标签,带颜色 170 | " 如NORMAL INSERT VISUAL等 171 | let l:mode = common#functions#ModeType() 172 | if l:mode ==? 'n' 173 | return 'NORMAL' 174 | elseif l:mode ==? 'i' 175 | return 'INSERT' 176 | elseif l:mode ==? 'v' 177 | return 'VISUAL' 178 | elseif l:mode ==? 'R' 179 | return 'REPLACE' 180 | else 181 | return '' 182 | endif 183 | endfunction 184 | 185 | function! common#functions#FileType() abort 186 | " 获得一些特殊文件的类型 187 | return &filetype ==? 'help' ? '' : 188 | \ &filetype ==? 'defx' ? ' ' : 189 | \ &filetype ==? 'coc-explorer' ? ' ' : 190 | \ &filetype ==? 'denite' ? ' ' : 191 | \ &filetype ==? 'tagbar' ? ' ' : 192 | \ &filetype ==? 'vista_kind' ? ' ' : 193 | \ &filetype ==? 'vista' ? ' ' : 194 | \ &filetype =~? '\v^mundo(diff)?$' ? ' ' : 195 | \ &filetype 196 | endfunction 197 | 198 | function! common#functions#ReadOnly() abort 199 | " 判断是否只读 200 | if &readonly 201 | return "  " 202 | else 203 | return "" 204 | endif 205 | endfunction 206 | 207 | function! common#functions#GitBranch() abort 208 | " 根据不同的插件获取git分支 209 | 210 | let l:git_branch = get(g:, 'coc_git_status', '') 211 | if l:git_branch != '' 212 | return strlen(l:git_branch) > 0 ? l:git_branch : '' 213 | elseif exists('fugitive#head') 214 | return fugitive#head(8) 215 | elseif exists('*gitbranch#name') 216 | return gitbranch#name() 217 | elseif exists('*vcs#info') 218 | return vcs#info('%b') 219 | endif 220 | endfunction 221 | 222 | function! common#functions#GitCount() abort 223 | " Git修改计数 224 | let l:git_count=get(b:, 'coc_git_status', '') 225 | return l:git_count 226 | 227 | if empty(l:git_count) 228 | if exists('*GitGutterGetHunkSummary') 229 | let [a,m,r] = GitGutterGetHunkSummary() 230 | return printf('+%d ~%d -%d', a, m, r) 231 | else 232 | return '' 233 | endif 234 | else 235 | return l:git_count 236 | endif 237 | endfunction 238 | 239 | function! common#functions#MethodOrFunction() abort 240 | " 当前的方法或者函数 241 | return get(b:, 'vista_nearest_method_or_function', '') 242 | endfunction 243 | 244 | function! common#functions#BufLineAndColInfo() abort 245 | " 获得当前buffer的行,列等信息 246 | return printf(' %d%% ☰ %d:%d', 100*line('.')/line('$'), line('.'), col('.')) 247 | endfunction 248 | 249 | function! common#functions#getVisualSelection() abort 250 | " Why is this not a built-in Vim script function?! 251 | let [line_start, column_start] = getpos("'<")[1:2] 252 | let [line_end, column_end] = getpos("'>")[1:2] 253 | let lines = getline(line_start, line_end) 254 | if len(lines) == 0 255 | return '' 256 | endif 257 | let lines[-1] = lines[-1][: column_end - (&selection == 'inclusive' ? 1 : 2)] 258 | let lines[0] = lines[0][column_start - 1:] 259 | return join(lines, "\n") 260 | endfunction 261 | 262 | function! common#functions#CocError() abort 263 | if !common#functions#HasPlug('coc.nvim') 264 | return "" 265 | endif 266 | let error_sign = get(g:, 'coc_status_error_sign', has('mac') ? '❌ ' : 'E') 267 | let info = get(b:, 'coc_diagnostic_info', {}) 268 | if empty(info) 269 | return '' 270 | endif 271 | let errmsgs = [] 272 | if get(info, 'error', 0) 273 | call add(errmsgs, error_sign . info['error']) 274 | endif 275 | return join(errmsgs, ' ') 276 | endfunction 277 | 278 | function! common#functions#CocWarn() abort 279 | if !common#functions#HasPlug('coc.nvim') 280 | return "" 281 | endif 282 | let warning_sign = get(g:, 'coc_status_warning_sign') 283 | let info = get(b:, 'coc_diagnostic_info', {}) 284 | if empty(info) 285 | return '' 286 | endif 287 | let warnmsgs = [] 288 | if get(info, 'warning', 0) 289 | call add(warnmsgs, warning_sign . info['warning']) 290 | endif 291 | return join(warnmsgs, ' ') 292 | endfunction 293 | 294 | function! common#functions#CocFixes() abort 295 | if !common#functions#HasPlug('coc.nvim') 296 | return "" 297 | endif 298 | let b:coc_line_fixes = get(get(b:, 'coc_quickfixes', {}), line('.'), 0) 299 | return b:coc_line_fixes > 0 ? printf('%d ', b:coc_line_fixes) : '' 300 | endfunction 301 | 302 | function! common#functions#CocStatus() abort 303 | if !common#functions#HasPlug('coc.nvim') 304 | return "" 305 | endif 306 | return coc#status() 307 | endfunction 308 | -------------------------------------------------------------------------------- /config.vim: -------------------------------------------------------------------------------- 1 | " vimrc所在根目录 2 | let g:vim_root_path = fnamemodify($MYVIMRC, ':h') . '/' 3 | " 配置所在根目录 4 | let g:config_root_path = g:vim_root_path . 'config/' 5 | " 插件配置所在目录 6 | let g:plugins_config_root_path = g:config_root_path . "plugins/" 7 | let g:other_config_root_path = g:config_root_path . "other/" 8 | 9 | " vim插件、缓存等数据根目录 10 | let g:cache_root_path = $HOME . '/.cache/vim/' 11 | " vim 插件安装目录 12 | let g:plugins_install_path = g:cache_root_path . 'plugins/' 13 | " session 保存目录 14 | let g:session_dir = g:cache_root_path . 'sessions/' 15 | " 撤销记录目录 16 | let g:undo_dir = g:cache_root_path . 'undo/' 17 | 18 | let g:os = systemlist('uname -s')[0] 19 | let g:arch = systemlist('uname -m')[0] 20 | 21 | " tmux配置文件目录 22 | let g:tmux_config_path = $HOME . '/.tmux.conf' 23 | 24 | " 脚本目录 25 | let g:scripts_root_path = g:vim_root_path . "/scripts/" 26 | 27 | " wiki笔记根目录 28 | let g:vimwiki_path = $HOME . '/Documents/wiki/' 29 | 30 | " 快速note文件 31 | let g:quicknote_file = g:vimwiki_path . '/quicknote.md' 32 | -------------------------------------------------------------------------------- /config/base.vim: -------------------------------------------------------------------------------- 1 | " 基本配置 2 | if &compatible 3 | " 不要兼容vi 4 | set nocompatible 5 | endif 6 | 7 | if has('syntax') 8 | syntax enable 9 | syntax on 10 | endif 11 | 12 | if has('autocmd') 13 | filetype plugin indent on 14 | endif 15 | 16 | if has('multi_byte') 17 | set encoding=utf-8 18 | set fileencoding=utf-8 19 | set fileencodings=ucs-bom,utf-8,gb18030,cp936,latin1 20 | endif 21 | 22 | set number 23 | " 设置相对行号 24 | set relativenumber 25 | " 智能缩进 26 | set smartindent 27 | " 自动换行缩进 28 | set autoindent 29 | " 软折行 30 | set linebreak 31 | " 禁止生成swap文件 32 | set noswapfile 33 | " 终端隐藏后不结束 34 | set hidden 35 | " 忽略大小写 36 | set ignorecase 37 | " set smartcase 38 | " Adjust case in insert completion mode 39 | set infercase 40 | " 历史命令 41 | set history=500 42 | " 在下方分割 43 | set splitbelow 44 | " tab扩展为空格 45 | set expandtab 46 | set tabstop=4 47 | " 连续数量的空格看作一个制表符 48 | set softtabstop=4 49 | set shiftwidth=4 50 | set smarttab 51 | set shiftround 52 | if has('folding') 53 | set foldenable 54 | " 基于缩进的折叠 55 | " set foldmethod=indent 56 | set foldmethod=syntax 57 | " 默认打开所有缩进 58 | set foldlevel=99 59 | endif 60 | 61 | set nobackup 62 | set nowritebackup 63 | set shortmess+=c 64 | set sessionoptions+=globals 65 | " 文件在外部被修改过,重新读入 66 | set autoread 67 | " 自动写回 68 | set autowrite 69 | " 显示确认对话框 70 | set confirm 71 | set noshowmode 72 | set ttimeout 73 | set timeoutlen=500 74 | set ttimeoutlen=10 75 | " 更新时间100ms 默认4000ms 写入swap的时间 76 | set updatetime=100 77 | " 允许使用鼠标, normal生效,a则是全模式生效 78 | set mouse=n 79 | 80 | set winaltkeys=no 81 | " 延迟绘制,提升性能 82 | set lazyredraw 83 | 84 | set showmatch 85 | set matchtime=2 86 | " 文件换行符,默认使用unix换行符 87 | set ffs=unix,dos,mac 88 | " 与系统共用剪切板 89 | " 在某些系统上可能会出现vim打开时间长的问题 90 | set clipboard+=unnamedplus 91 | 92 | if has('nvim') == 0 && has('patch-8.1.2020') 93 | set cursorlineopt=number cursorline 94 | endif 95 | 96 | if has('patch-8.1.1564') 97 | set signcolumn=yes 98 | " set signcolumn=number 99 | else 100 | set signcolumn=yes 101 | endif 102 | 103 | " 定位到退出位置并移动到屏幕中央 104 | if has("autocmd") 105 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif | normal! zvzz 106 | endif 107 | 108 | " 以下内容来自韦大的配置 109 | " 文件搜索和补全时忽略下面的扩展名 110 | set suffixes=.bak,~,.o,.h,.info,.swp,.obj,.pyc,.pyo,.egg-info,.class 111 | "stuff to ignore when tab completing 112 | set wildignore=*.o,*.obj,*~,*.exe,*.a,*.pdb,*.lib 113 | set wildignore+=*.so,*.dll,*.swp,*.egg,*.jar,*.class,*.pyc,*.pyo,*.bin,*.dex 114 | " MacOSX/Linux 115 | set wildignore+=*.zip,*.7z,*.rar,*.gz,*.tar,*.gzip,*.bz2,*.tgz,*.xz 116 | set wildignore+=*DS_Store*,*.ipch 117 | set wildignore+=*.gem 118 | set wildignore+=*.png,*.jpg,*.gif,*.bmp,*.tga,*.pcx,*.ppm,*.img,*.iso 119 | set wildignore+=*.so,*.swp,*.zip,*/.Trash/**,*.pdf,*.dmg,*/.rbenv/** 120 | set wildignore+=*/.nx/**,*.app,*.git,.git 121 | set wildignore+=*.wav,*.mp3,*.ogg,*.pcm 122 | set wildignore+=*.mht,*.suo,*.sdf,*.jnlp 123 | set wildignore+=*.chm,*.epub,*.pdf,*.mobi,*.ttf 124 | set wildignore+=*.mp4,*.avi,*.flv,*.mov,*.mkv,*.swf,*.swc 125 | set wildignore+=*.ppt,*.pptx,*.docx,*.xlt,*.xls,*.xlsx,*.odt,*.wps 126 | set wildignore+=*.msi,*.crx,*.deb,*.vfd,*.apk,*.ipa,*.bin,*.msu 127 | set wildignore+=*.gba,*.sfc,*.078,*.nds,*.smd,*.smc 128 | set wildignore+=*.linux2,*.win32,*.darwin,*.freebsd,*.linux,*.android 129 | -------------------------------------------------------------------------------- /config/keymap.vim: -------------------------------------------------------------------------------- 1 | " 窗口相关快捷键 2 | noremap h 3 | noremap j 4 | noremap k 5 | noremap l 6 | tnoremap h 7 | tnoremap j 8 | tnoremap k 9 | tnoremap l 10 | if !common#functions#HasPlug('ResizeWindow.vim') 11 | " 更改窗口垂直大小 12 | nnoremap :resize +3 13 | nnoremap :resize -3 14 | " 更改窗口水平大小 15 | nnoremap :vertical resize -3 16 | nnoremap :vertical resize +3 17 | endif 18 | " 分割窗口 19 | nnoremap k :abo split 20 | nnoremap h :abo vsplit 21 | nnoremap j :rightbelow split 22 | nnoremap l :rightbelow vsplit 23 | " 关闭窗口 24 | nnoremap q :close 25 | vnoremap q :close 26 | 27 | " 使用回车打开关闭折叠 28 | nnoremap za 29 | " shift enter,为何不可以? 30 | nnoremap zMzo 31 | " 关闭搜索颜色 32 | nnoremap :nohl 33 | 34 | " 命令行移动 35 | cnoremap 36 | cnoremap 37 | " cnoremap 38 | " cnoremap 39 | 40 | " 使用alt q关闭当前buffer 41 | nnoremap :bdelete 42 | 43 | " 去除EX模式 44 | nmap Q 45 | " 使用Q进行宏录制 46 | noremap Q q 47 | 48 | " jk表示esc 49 | inoremap jk 50 | 51 | nmap << <<_ 52 | nmap >> >>_ 53 | 54 | nnoremap ! :! 55 | 56 | " 跳转到最后 57 | " 0是跳转到开头 58 | nnoremap 9 $ 59 | 60 | augroup vime_keymap_group 61 | autocmd! 62 | " 使用esc退出终端 63 | if has('nvim') 64 | au TermOpen term://* tnoremap " | startinsert 65 | " au BufEnter term://* startinsert 66 | else 67 | au TerminalOpen term://* tnoremap " | startinsert 68 | " au BufEnter term://* startinsert 69 | endif 70 | augroup END 71 | 72 | " 新建终端 73 | nnoremap tt :terminal 74 | 75 | " 插入模式下的一些快捷键 76 | inoremap o 77 | inoremap O 78 | " inoremap 79 | inoremap ^i 80 | inoremap 81 | inoremap 82 | inoremap 83 | inoremap 84 | inoremap 85 | 86 | function! s:writeCurrent() abort 87 | if !&readonly && &buftype =~# '^\%(acwrite\)\=$' && expand('%') !=# '' 88 | silent write 89 | endif 90 | endfunction 91 | " noremap :call common#functions#Wall() 92 | " noremap :call writeCurrent() 93 | " xnoremap :call writeCurrent() 94 | noremap :silent! write 95 | xnoremap :silent! write 96 | 97 | nnoremap j gj 98 | nnoremap k gk 99 | vnoremap j gj 100 | vnoremap k gk 101 | 102 | " 复制到末尾 103 | nnoremap Y y$ 104 | nnoremap vv ^vg_ 105 | 106 | if !common#functions#HasPlug('vim-airline') && !common#functions#HasPlug('vim-crystalline') 107 | nnoremap :call common#functions#MoveTabOrBuf(1) 108 | nnoremap :call common#functions#MoveTabOrBuf(0) 109 | tnoremap :call common#functions#MoveTabOrBuf(1) 110 | tnoremap :call common#functions#MoveTabOrBuf(0) 111 | endif 112 | nnoremap tn :tabnew 113 | nnoremap tc :tabclose 114 | nnoremap :tabmove +1 115 | nnoremap :tabmove -1 116 | tnoremap :tabmove +1 117 | tnoremap :tabmove -1 118 | 119 | " 使用系统应用打开当前buffer文件 120 | noremap :call common#functions#OpenFileUsingSystemApp(expand('%:p')) 121 | -------------------------------------------------------------------------------- /config/layers.vim: -------------------------------------------------------------------------------- 1 | " 插件组合 2 | 3 | " lsp插件选择 4 | " LoadScript layers/lsp_ycm.vim 5 | " LoadScript layers/lsp_lspsaga.vim 6 | " LoadScript layers/lsp_completion-nvim.vim 7 | LoadScript layers/lsp_coc.vim 8 | 9 | " git类插件组合 10 | LoadScript layers/git.vim 11 | 12 | " search 13 | " LoadScript layers/search_telecope.vim 14 | LoadScript layers/search_fzf.vim 15 | 16 | " theme 17 | LoadScript layers/theme.vim 18 | 19 | " 其他插件 20 | LoadScript layers/plugin_list.vim 21 | 22 | " 经过长时间的使用,我发现我常用的插件并不多,所以我经常使用下面的simple组合 23 | " LoadScript layers/simple.vim 24 | -------------------------------------------------------------------------------- /config/layers/git.vim: -------------------------------------------------------------------------------- 1 | " git插件 2 | Plug 'tpope/vim-fugitive' 3 | 4 | if has('nvim') 5 | Plug 'nvim-lua/plenary.nvim' | Plug 'tanvirtin/vgit.nvim' 6 | else 7 | Plug 'rbong/vim-flog' | Plug 'airblade/vim-gitgutter' 8 | " " Plug 'f-person/git-blame.nvim' 9 | endif 10 | -------------------------------------------------------------------------------- /config/layers/lsp_coc.vim: -------------------------------------------------------------------------------- 1 | Plug 'neoclide/coc.nvim', { 'branch': 'release' } 2 | 3 | Plug 'antoinemadec/coc-fzf', {'branch': 'release'} 4 | 5 | " coc插件列表,可根据需要进行删减 6 | let g:coc_global_extensions = [ 7 | \ 'coc-vimlsp', 8 | \ 'coc-xml', 9 | \ 'coc-yank', 10 | \ 'coc-sh', 11 | \ 'coc-yaml', 12 | \ 'coc-cmake', 13 | \ 'coc-snippets', 14 | \ 'coc-clangd', 15 | \ 'coc-json', 16 | \ 'coc-lists', 17 | \ 'coc-just-complete', 18 | \ 'coc-python', 19 | \ 'coc-marketplace', 20 | \ 'coc-java', 21 | \ ] 22 | -------------------------------------------------------------------------------- /config/layers/lsp_completion-nvim.vim: -------------------------------------------------------------------------------- 1 | Plug 'neovim/nvim-lspconfig' 2 | Plug 'nvim-lua/completion-nvim' 3 | -------------------------------------------------------------------------------- /config/layers/lsp_lspsaga.vim: -------------------------------------------------------------------------------- 1 | Plug 'neovim/nvim-lspconfig' 2 | Plug 'glepnir/lspsaga.nvim' 3 | -------------------------------------------------------------------------------- /config/layers/lsp_ycm.vim: -------------------------------------------------------------------------------- 1 | " 请参考https://github.com/ycm-core/YouCompleteMe#installation 2 | " 安装必要的依赖 3 | Plug 'ycm-core/YouCompleteMe', {'do': 'python3 install.py --all'} 4 | -------------------------------------------------------------------------------- /config/layers/plugin_list.vim: -------------------------------------------------------------------------------- 1 | " 检索 2 | Plug 'junegunn/fzf', { 'do': {-> fzf#install()} } 3 | " Plug 'fszymanski/fzf-gitignore', {'do': ':UpdateRemotePlugins'} 4 | Plug 'junegunn/fzf.vim' | Plug 'antoinemadec/coc-fzf', {'branch': 'release'} 5 | " c debug 6 | Plug 'puremourning/vimspector' 7 | " 注释插件 8 | Plug 'scrooloose/nerdcommenter' 9 | " 生成注释文档 10 | Plug 'kkoomen/vim-doge', {'do': {-> doge#install()}} 11 | " 数据库 12 | Plug 'tpope/vim-dadbod' | Plug 'kristijanhusak/vim-dadbod-ui' | Plug 'kristijanhusak/vim-dadbod-completion' 13 | " 全局替换插件 14 | Plug 'brooth/far.vim' 15 | 16 | " 顶栏和底栏 17 | " Plug 'romgrk/barbar.nvim' 18 | " Plug 'rbong/vim-crystalline' 19 | Plug 'itchyny/lightline.vim' 20 | " Plug 'liuchengxu/eleline.vim' 21 | " Plug 'hoob3rt/lualine.nvim' 22 | " 彩虹括号 23 | if has('nvim') 24 | Plug 'p00f/nvim-ts-rainbow' 25 | else 26 | Plug 'luochen1990/rainbow' 27 | endif 28 | " 函数列表 29 | Plug 'liuchengxu/vista.vim', {'on': ['Vista!!', 'Vista']} 30 | " 自动补全括号 31 | Plug 'jiangmiao/auto-pairs' 32 | if has("nvim") 33 | Plug 'andymass/vim-matchup' 34 | endif 35 | " 快速包围 36 | Plug 'tpope/vim-surround' 37 | " Plug 'machakann/vim-sandwich' 38 | " 重复上次的动作 39 | Plug 'tpope/vim-repeat' 40 | " 显示清除尾部空格 41 | Plug 'ntpeters/vim-better-whitespace' 42 | " 代码段 43 | Plug 'honza/vim-snippets' 44 | " Plug 'SirVer/ultisnips' 45 | " 快速选择窗口 46 | Plug 't9md/vim-choosewin' 47 | " 快速移动 48 | Plug 'easymotion/vim-easymotion', {'on': 49 | \ [ 50 | \ '(easymotion-bd-f)', '(easymotion-overwin-f)', 51 | \ '(easymotion-overwin-f2)', '(easymotion-bd-jk)', 52 | \ '(easymotion-overwin-line)', '(easymotion-bd-w)', 53 | \ '(easymotion-overwin-w)', '(easymotion-s)', 54 | \ ]} 55 | " 对齐 56 | Plug 'junegunn/vim-easy-align', {'on': ['EasyAlign', '(EasyAlign)']} 57 | " 缩进线 58 | " Plug 'Yggdroot/indentLine', {'on': 'IndentLinesEnable'} 59 | if has('nvim') 60 | " 缩进线 61 | Plug 'glepnir/indent-guides.nvim' 62 | endif 63 | " 多光标 64 | Plug 'mg979/vim-visual-multi' 65 | " csv插件 66 | Plug 'chrisbra/csv.vim', {'for': 'csv'} 67 | " 悬浮终端 68 | Plug 'voldikss/vim-floaterm', {'on': ['FloatermNew', 'FloatermToggle']} 69 | " 笔记插件,支持markdown 70 | Plug 'vimwiki/vimwiki' 71 | " Plug 'SidOfc/mkdx' 72 | " markdown 预览插件 73 | Plug 'iamcco/markdown-preview.nvim', { 'do': { -> mkdp#util#install() }, 'for': ['markdown', 'vim-plug', 'vimwiki'], 'on': 'MarkdownPreview'} 74 | " Plug 'mzlogin/vim-markdown-toc', {'on': ['GenTocGFM', 'GenTocRedcarpet', 'GenTocGitLab', 'GenTocMarked']} 75 | " 功能很强的折叠插件, zc zo 76 | " Plug 'pseewald/vim-anyfold', {'on': 'AnyFoldActivate'} 77 | " 起始界面 78 | Plug 'mhinz/vim-startify' 79 | " 翻译插件 80 | Plug 'iamcco/dict.vim', {'on': 81 | \ [ 82 | \ 'DictSearch', 'DictVSearch', 'DictWSearch', 83 | \ 'DictWVSearch', 'DictRSearch', 'DictRVSearch' 84 | \ ]} 85 | " 搜索显示数量 86 | Plug 'kevinhwang91/nvim-hlslens' 87 | " tmux相关插件 88 | if executable("tmux") && strlen($TMUX) 89 | " tmux与vim窗口间导航 90 | Plug 'christoomey/vim-tmux-navigator' 91 | " tmux.conf set -g focus-events on 92 | Plug 'tmux-plugins/vim-tmux-focus-events' 93 | " 在tmux和vim之间进行复制与粘贴 94 | " Plug 'roxma/vim-tmux-clipboard' 95 | " tmux补全插件 96 | Plug 'wellle/tmux-complete.vim' 97 | endif 98 | " 关闭buffer而不关闭窗口 99 | Plug 'rbgrouleff/bclose.vim', {'on': 'Bclose'} 100 | " latex插件 101 | Plug 'lervag/vimtex', {'for': 'tex'} 102 | Plug 'KeitaNakamura/tex-conceal.vim', {'for': 'tex'} 103 | " 平滑滚动 104 | Plug 'psliwka/vim-smoothie' 105 | " 在命令行使用linux命令新建文件文件夹重命名当前buffer等 106 | Plug 'tpope/vim-eunuch', {'on': ['Mkdir', 'Rename', 'Unlink', 'Delete', 'Move', 'Chmod', 'Cfind', 'Clocate', 'Lfine', 'Llocate', 'SudoEdit', 'SudoWrite', 'Wall', 'W']} 107 | " 最大化窗口,ctrl w o 108 | Plug 'troydm/zoomwintab.vim', {'on': 'ZoomWinTabToggle'} 109 | " vim中文文档 110 | Plug 'yianwillis/vimcdoc' 111 | if has('nvim') 112 | Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} 113 | Plug 'nvim-treesitter/nvim-treesitter-textobjects' 114 | Plug 'nvim-treesitter/nvim-treesitter-refactor' 115 | Plug 'romgrk/nvim-treesitter-context' 116 | else 117 | Plug 'sheerun/vim-polyglot' 118 | Plug 'octol/vim-cpp-enhanced-highlight' 119 | endif 120 | " 总是匹配tag 121 | Plug 'valloric/MatchTagAlways', {'for': ['html', 'css', 'xml']} 122 | " 显示颜色 例如: #654456 123 | if has('nvim') 124 | Plug 'norcalli/nvim-colorizer.lua' 125 | else 126 | Plug 'RRethy/vim-hexokinase', { 'do': 'make hexokinase' } 127 | endif 128 | " 加强版的 go to file 129 | Plug 'tpope/vim-apathy' 130 | " 查看启动时间 131 | Plug 'dstein64/vim-startuptime', {'on':'StartupTime'} 132 | " 专注阅读 133 | Plug 'junegunn/goyo.vim', { 'on': 'Goyo', 'for': 'markdown' } 134 | \ | Plug 'junegunn/limelight.vim', { 'on': 'Limelight' } 135 | Plug 'markonm/traces.vim' 136 | " 语法检查 137 | Plug 'rhysd/vim-grammarous', {'for': ['markdown', 'vimwiki', 'md', 'tex']} 138 | " 首先需要在config/plugin_list.vim中增加插件 139 | Plug 'matze/vim-move', {'on': [ 140 | \ 'MoveBlockDown', 141 | \ 'MoveBlockUp', 142 | \ 'MoveBlockRight', 143 | \ 'MoveBlockLeft']} 144 | if has("nvim") 145 | Plug 'simnalamburt/vim-mundo' 146 | endif 147 | if has('nvim') 148 | Plug 'kyazdani42/nvim-web-devicons' 149 | else 150 | Plug 'ryanoasis/vim-devicons' 151 | endif 152 | " 忘记sudo?使用sudowrite或sw 153 | Plug 'lambdalisue/suda.vim' 154 | Plug 'fgheng/ResizeWindow.vim' 155 | Plug 'tyru/open-browser.vim' 156 | " Plug 'ojroques/vim-scrollstatus' 157 | if has('nvim') 158 | Plug 'dstein64/nvim-scrollview' 159 | endif 160 | Plug 'ernstwi/vim-secret' 161 | Plug 'ZSaberLv0/ZFVimDirDiff' 162 | if has('nvim') 163 | Plug 'kyazdani42/nvim-tree.lua' 164 | endif 165 | -------------------------------------------------------------------------------- /config/layers/search_fzf.vim: -------------------------------------------------------------------------------- 1 | " 检索 2 | Plug 'junegunn/fzf', { 'do': {-> fzf#install()} } 3 | Plug 'fszymanski/fzf-gitignore', {'do': ':UpdateRemotePlugins'} 4 | Plug 'junegunn/fzf.vim' 5 | -------------------------------------------------------------------------------- /config/layers/search_telecope.vim: -------------------------------------------------------------------------------- 1 | Plug 'nvim-lua/popup.nvim' 2 | Plug 'nvim-lua/plenary.nvim' 3 | Plug 'nvim-telescope/telescope.nvim' 4 | -------------------------------------------------------------------------------- /config/layers/simple.vim: -------------------------------------------------------------------------------- 1 | " 注释插件 2 | Plug 'scrooloose/nerdcommenter' 3 | " 生成注释文档 4 | Plug 'kkoomen/vim-doge', {'do': {-> doge#install()}} 5 | 6 | " 主题 7 | Plug 'glepnir/zephyr-nvim' 8 | Plug 'rakr/vim-one' 9 | Plug 'npxbr/gruvbox.nvim' 10 | 11 | Plug 'hoob3rt/lualine.nvim' 12 | 13 | " 自动补全括号 14 | Plug 'jiangmiao/auto-pairs' 15 | 16 | " 代码段 17 | Plug 'honza/vim-snippets' 18 | 19 | " 快速选择窗口 20 | Plug 't9md/vim-choosewin' 21 | " 彩虹括号 22 | if has('nvim') 23 | Plug 'p00f/nvim-ts-rainbow' 24 | else 25 | Plug 'luochen1990/rainbow' 26 | endif 27 | 28 | if has('nvim') 29 | Plug 'kyazdani42/nvim-web-devicons' 30 | else 31 | Plug 'ryanoasis/vim-devicons' 32 | endif 33 | if has('nvim') 34 | Plug 'kyazdani42/nvim-tree.lua' 35 | endif 36 | Plug 'liuchengxu/vista.vim', {'on': ['Vista!!', 'Vista']} 37 | Plug 'mg979/vim-visual-multi' 38 | 39 | " tmux相关插件 40 | if executable("tmux") && strlen($TMUX) 41 | " tmux与vim窗口间导航 42 | Plug 'christoomey/vim-tmux-navigator' 43 | " 在tmux和vim之间进行复制与粘贴 44 | Plug 'roxma/vim-tmux-clipboard' 45 | " tmux补全插件 46 | Plug 'wellle/tmux-complete.vim' 47 | endif 48 | 49 | if has('nvim') 50 | Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} 51 | Plug 'nvim-treesitter/nvim-treesitter-textobjects' 52 | Plug 'nvim-treesitter/nvim-treesitter-refactor' 53 | Plug 'romgrk/nvim-treesitter-context' 54 | else 55 | Plug 'sheerun/vim-polyglot' 56 | Plug 'octol/vim-cpp-enhanced-highlight' 57 | endif 58 | 59 | Plug 'fgheng/ResizeWindow.vim' 60 | " 显示滚动条 61 | if has('nvim') 62 | Plug 'dstein64/nvim-scrollview' 63 | Plug 'norcalli/nvim-colorizer.lua' 64 | endif 65 | " 平滑滚动 66 | " Plug 'psliwka/vim-smoothie' 67 | Plug 'glepnir/indent-guides.nvim' 68 | " 重复上次的动作 69 | Plug 'tpope/vim-repeat' 70 | " 快速移动 71 | Plug 'phaazon/hop.nvim' 72 | " 翻译插件 73 | Plug 'iamcco/dict.vim', {'on': 74 | \ [ 75 | \ 'DictSearch', 'DictVSearch', 'DictWSearch', 76 | \ 'DictWVSearch', 'DictRSearch', 'DictRVSearch' 77 | \ ]} 78 | Plug 'rktjmp/lush.nvim' 79 | Plug 'ntpeters/vim-better-whitespace' 80 | Plug 'ZSaberLv0/ZFVimDirDiff' 81 | Plug 'junegunn/vim-easy-align' 82 | -------------------------------------------------------------------------------- /config/layers/theme.vim: -------------------------------------------------------------------------------- 1 | " 主题theme类插件 2 | Plug 'glepnir/zephyr-nvim' 3 | Plug 'ajmwagar/vim-deus' 4 | Plug 'rakr/vim-one' 5 | Plug 'arcticicestudio/nord-vim' 6 | Plug 'morhetz/gruvbox' 7 | Plug 'sainnhe/gruvbox-material' 8 | Plug 'npxbr/gruvbox.nvim' 9 | Plug 'sainnhe/forest-night' 10 | Plug 'srcery-colors/srcery-vim' 11 | Plug 'hardcoreplayers/oceanic-material' 12 | Plug 'chuling/ci_dark' 13 | Plug 'kristijanhusak/vim-hybrid-material' 14 | Plug 'mhartington/oceanic-next' 15 | Plug '986299679/space-vim-theme' 16 | Plug 'ayu-theme/ayu-vim' 17 | Plug 'w0ng/vim-hybrid' 18 | Plug 'NLKNguyen/papercolor-theme' 19 | Plug 'flrnd/candid.vim' 20 | Plug 'jaredgorski/spacecamp' 21 | Plug 'bluz71/vim-moonfly-colors' 22 | Plug 'cormacrelf/vim-colors-github' 23 | Plug 'arzg/vim-colors-xcode' 24 | Plug 'sainnhe/sonokai' 25 | Plug 'sonph/onehalf' 26 | Plug 'ghifarit53/tokyonight-vim' 27 | Plug 'sainnhe/edge' 28 | Plug 'reedes/vim-colors-pencil' 29 | Plug 'ChristianChiarulli/nvcode-color-schemes.vim' 30 | Plug 'arzg/vim-colors-xcode' 31 | Plug 'joshdick/onedark.vim' 32 | -------------------------------------------------------------------------------- /config/other/UltiSnips/all.snippets: -------------------------------------------------------------------------------- 1 | snippet Copy 2 | Copyright (c) ${1:`!v g:snips_author`} <${2:`!v g:snips_author_email`}>. All Rights Reserved. 3 | $0 4 | endsnippet 5 | 6 | 7 | 8 | snippet date 9 | `!v strftime("%Y-%m-%d %H:%M:%S")` 10 | endsnippet 11 | 12 | 13 | 14 | snippet datez 15 | `!v strftime("%Y-%m-%d %H:%M:%S %z")` 16 | endsnippet 17 | 18 | 19 | 20 | snippet ts 21 | vim: set ts=${1:4} sw=${2:$1}${3: MORE OPTIONS}:$0 22 | endsnippet 23 | 24 | 25 | 26 | snippet ddate 27 | `!v strftime("%B %d, %Y")` 28 | endsnippet 29 | 30 | snippet sdate 31 | `!v strftime("%Y.%m.%d")` 32 | endsnippet 33 | 34 | snippet blog 35 | Title: ${1} 36 | Slug: ${2} 37 | Date: ${3} 38 | Category: ${4} 39 | Tags: ${5} 40 | 41 | endsnippet 42 | 43 | 44 | snippet /td 45 | /* TODO: ${1} 46 | */ 47 | endsnippet 48 | 49 | snippet /mk 50 | /* MARK: ${1} 51 | */ 52 | endsnippet 53 | 54 | snippet mko 55 | ${_(u'')}${1} 56 | endsnippet 57 | 58 | snippet mkl 59 | ' + gettext("") + '${1} 60 | endsnippet 61 | 62 | snippet rms 63 | # TODO: remove this 64 | endsnippet 65 | 66 | snippet nqa 67 | # noqa 68 | endsnippet 69 | -------------------------------------------------------------------------------- /config/other/UltiSnips/c.snippets: -------------------------------------------------------------------------------- 1 | 2 | snippet mian 3 | int main(int argc, char *arg[]) { 4 | ${1} 5 | return 0; 6 | } 7 | endsnippet 8 | 9 | snippet cm "Comment Section" 10 | /* ${0} */ 11 | endsnippet 12 | -------------------------------------------------------------------------------- /config/other/UltiSnips/cpp.snippets: -------------------------------------------------------------------------------- 1 | 2 | snippet mian 3 | int main(int argc, char *arg[]) { 4 | ${1} 5 | return 0; 6 | } 7 | endsnippet 8 | 9 | snippet sc 10 | std::cout << ${1} << std::endl; 11 | endsnippet 12 | 13 | snippet extc 14 | extern "C" { 15 | ${1} 16 | } 17 | endsnippet 18 | -------------------------------------------------------------------------------- /config/other/UltiSnips/python.snippets: -------------------------------------------------------------------------------- 1 | 2 | ########### import 3 | snippet im "import" 4 | import ${1} 5 | endsnippet 6 | 7 | snippet imp "import" 8 | import ${1:module} 9 | ${2} 10 | endsnippet 11 | 12 | ########### single char 13 | snippet t "True" 14 | True${1} 15 | endsnippet 16 | 17 | snippet f "False" 18 | False${1} 19 | endsnippet 20 | 21 | snippet n "None" 22 | None${1} 23 | endsnippet 24 | 25 | snippet r "return" 26 | return ${1} 27 | endsnippet 28 | 29 | snippet s "self." 30 | self.${1} 31 | endsnippet 32 | 33 | snippet p "print" 34 | print(${1}) 35 | endsnippet 36 | 37 | snippet pr "print " 38 | print("${1}") 39 | endsnippet 40 | 41 | snippet pri "print ''" 42 | print('${1}') 43 | endsnippet 44 | -------------------------------------------------------------------------------- /config/other/UltiSnips/snippets.snippets: -------------------------------------------------------------------------------- 1 | snippet "snip(pet)?" "Snippet to create snippets" r 2 | snippet ${1:name}${2: ${3:"${4:$1 description}"}${5: ${6:}}} 3 | $0 4 | `!v "endsnippet"` 5 | endsnippet 6 | 7 | snippet ext 8 | extends ${0:what?} 9 | endsnippet 10 | -------------------------------------------------------------------------------- /config/other/UltiSnips/tex.snippets: -------------------------------------------------------------------------------- 1 | global !p 2 | def math(): 3 | return vim.eval('vimtex#syntax#in_mathzone()') == '1' 4 | 5 | def comment(): 6 | return vim.eval('vimtex#syntax#in_comment()') == '1' 7 | 8 | def env(name): 9 | [x,y] = vim.eval("vimtex#env#is_inside('" + name + "')") 10 | return x != '0' and x != '0' 11 | 12 | endglobal 13 | 14 | 15 | snippet template "Basic template" b 16 | \documentclass[a4paper]{article} 17 | 18 | \usepackage[utf8]{inputenc} 19 | \usepackage[T1]{fontenc} 20 | \usepackage{textcomp} 21 | \usepackage[dutch]{babel} 22 | \usepackage{amsmath, amssymb} 23 | 24 | 25 | % figure support 26 | \usepackage{import} 27 | \usepackage{xifthen} 28 | \pdfminorversion=7 29 | \usepackage{pdfpages} 30 | \usepackage{transparent} 31 | \newcommand{\incfig}[1]{% 32 | \def\svgwidth{\columnwidth} 33 | \import{./figures/}{#1.pdf_tex} 34 | } 35 | 36 | \pdfsuppresswarningpagegroup=1 37 | 38 | \begin{document} 39 | $0 40 | \end{document} 41 | endsnippet 42 | 43 | snippet beg "begin{} / end{}" bA 44 | \\begin{$1} 45 | $0 46 | \\end{$1} 47 | endsnippet 48 | 49 | priority 100 50 | snippet ... "ldots" iA 51 | \ldots 52 | endsnippet 53 | 54 | snippet table "Table environment" b 55 | \begin{table}[${1:htpb}] 56 | \centering 57 | \caption{${2:caption}} 58 | \label{tab:${3:label}} 59 | \begin{tabular}{${5:c}} 60 | $0${5/((?<=.)c|l|r)|./(?1: & )/g} 61 | \end{tabular} 62 | \end{table} 63 | endsnippet 64 | 65 | snippet fig "Figure environment" b 66 | \begin{figure}[${1:htpb}] 67 | \centering 68 | ${2:\includegraphics[width=0.8\textwidth]{$3}} 69 | \caption{${4:$3}} 70 | \label{fig:${5:${3/\W+/-/g}}} 71 | \end{figure} 72 | endsnippet 73 | 74 | snippet enum "Enumerate" bA 75 | \begin{enumerate} 76 | \item $0 77 | \end{enumerate} 78 | endsnippet 79 | 80 | snippet item "Itemize" bA 81 | \begin{itemize} 82 | \item $0 83 | \end{itemize} 84 | endsnippet 85 | 86 | snippet desc "Description" b 87 | \begin{description} 88 | \item[$1] $0 89 | \end{description} 90 | endsnippet 91 | 92 | snippet pac "Package" b 93 | \usepackage[${1:options}]{${2:package}}$0 94 | endsnippet 95 | 96 | snippet => "implies" Ai 97 | \implies 98 | endsnippet 99 | 100 | snippet =< "implied by" Ai 101 | \impliedby 102 | endsnippet 103 | 104 | context "math()" 105 | snippet iff "iff" Ai 106 | \iff 107 | endsnippet 108 | 109 | snippet mk "Math" wA 110 | $${1}$`!p 111 | if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']: 112 | snip.rv = ' ' 113 | else: 114 | snip.rv = '' 115 | `$2 116 | endsnippet 117 | 118 | snippet dm "Math" wA 119 | \[ 120 | ${1:${VISUAL}} 121 | .\] $0 122 | endsnippet 123 | 124 | snippet ali "Align" bA 125 | \begin{align*} 126 | ${1:${VISUAL}} 127 | .\end{align*} 128 | endsnippet 129 | 130 | 131 | context "math()" 132 | snippet // "Fraction" iA 133 | \\frac{$1}{$2}$0 134 | endsnippet 135 | 136 | snippet / "Fraction" i 137 | \\frac{${VISUAL}}{$1}$0 138 | endsnippet 139 | 140 | context "math()" 141 | snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "symbol frac" wrA 142 | \\frac{`!p snip.rv = match.group(1)`}{$1}$0 143 | endsnippet 144 | 145 | priority 1000 146 | context "math()" 147 | snippet '^.*\)/' "() frac" wrA 148 | `!p 149 | stripped = match.string[:-1] 150 | depth = 0 151 | i = len(stripped) - 1 152 | while True: 153 | if stripped[i] == ')': depth += 1 154 | if stripped[i] == '(': depth -= 1 155 | if depth == 0: break; 156 | i-=1 157 | snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}" 158 | `{$1}$0 159 | endsnippet 160 | 161 | context "math()" 162 | snippet '([A-Za-z])(\d)' "auto subscript" wrA 163 | `!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)` 164 | endsnippet 165 | 166 | context "math()" 167 | snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA 168 | `!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`} 169 | endsnippet 170 | 171 | 172 | snippet sympy "sympyblock " w 173 | sympy $1 sympy$0 174 | endsnippet 175 | 176 | priority 10000 177 | snippet 'sympy(.*)sympy' "sympy" wr 178 | `!p 179 | from sympy import * 180 | x, y, z, t = symbols('x y z t') 181 | k, m, n = symbols('k m n', integer=True) 182 | f, g, h = symbols('f g h', cls=Function) 183 | init_printing() 184 | snip.rv = eval('latex(' + match.group(1).replace('\\', '').replace('^', '**').replace('{', '(').replace('}', ')') + ')') 185 | ` 186 | endsnippet 187 | 188 | priority 1000 189 | snippet math "mathematicablock" w 190 | math $1 math$0 191 | endsnippet 192 | 193 | priority 10000 194 | snippet 'math(.*)math' "math" wr 195 | `!p 196 | import subprocess 197 | code = match.group(1) 198 | code = 'ToString[' + code + ', TeXForm]' 199 | snip.rv = subprocess.check_output(['wolframscript', '-code', code]) 200 | ` 201 | endsnippet 202 | 203 | snippet == "equals" iA 204 | &= $1 \\\\ 205 | endsnippet 206 | 207 | snippet != "equals" iA 208 | \neq 209 | endsnippet 210 | 211 | context "math()" 212 | snippet ceil "ceil" iA 213 | \left\lceil $1 \right\rceil $0 214 | endsnippet 215 | 216 | context "math()" 217 | snippet floor "floor" iA 218 | \left\lfloor $1 \right\rfloor$0 219 | endsnippet 220 | 221 | snippet pmat "pmat" iA 222 | \begin{pmatrix} $1 \end{pmatrix} $0 223 | endsnippet 224 | 225 | snippet bmat "bmat" iA 226 | \begin{bmatrix} $1 \end{bmatrix} $0 227 | endsnippet 228 | 229 | context "math()" 230 | snippet () "left( right)" iA 231 | \left( ${1:${VISUAL}} \right) $0 232 | endsnippet 233 | 234 | snippet lr "left( right)" i 235 | \left( ${1:${VISUAL}} \right) $0 236 | endsnippet 237 | 238 | snippet lr( "left( right)" i 239 | \left( ${1:${VISUAL}} \right) $0 240 | endsnippet 241 | 242 | snippet lr| "left| right|" i 243 | \left| ${1:${VISUAL}} \right| $0 244 | endsnippet 245 | 246 | snippet lr{ "left\{ right\}" i 247 | \left\\{ ${1:${VISUAL}} \right\\} $0 248 | endsnippet 249 | 250 | snippet lrb "left\{ right\}" i 251 | \left\\{ ${1:${VISUAL}} \right\\} $0 252 | endsnippet 253 | 254 | snippet lr[ "left[ right]" i 255 | \left[ ${1:${VISUAL}} \right] $0 256 | endsnippet 257 | 258 | snippet lra "leftangle rightangle" iA 259 | \left<${1:${VISUAL}} \right>$0 260 | endsnippet 261 | 262 | context "math()" 263 | snippet conj "conjugate" iA 264 | \overline{$1}$0 265 | endsnippet 266 | 267 | snippet sum "sum" w 268 | \sum_{n=${1:1}}^{${2:\infty}} ${3:a_n z^n} 269 | endsnippet 270 | 271 | snippet taylor "taylor" w 272 | \sum_{${1:k}=${2:0}}^{${3:\infty}} ${4:c_$1} (x-a)^$1 $0 273 | endsnippet 274 | 275 | snippet lim "limit" w 276 | \lim_{${1:n} \to ${2:\infty}} 277 | endsnippet 278 | 279 | snippet limsup "limsup" w 280 | \limsup_{${1:n} \to ${2:\infty}} 281 | endsnippet 282 | 283 | snippet prod "product" w 284 | \prod_{${1:n=${2:1}}}^{${3:\infty}} ${4:${VISUAL}} $0 285 | endsnippet 286 | 287 | snippet part "d/dx" w 288 | \frac{\partial ${1:V}}{\partial ${2:x}} $0 289 | endsnippet 290 | 291 | context "math()" 292 | snippet sq "\sqrt{}" iA 293 | \sqrt{${1:${VISUAL}}} $0 294 | endsnippet 295 | 296 | context "math()" 297 | snippet sr "^2" iA 298 | ^2 299 | endsnippet 300 | 301 | context "math()" 302 | snippet cb "^3" iA 303 | ^3 304 | endsnippet 305 | 306 | context "math()" 307 | snippet td "to the ... power" iA 308 | ^{$1}$0 309 | endsnippet 310 | 311 | context "math()" 312 | snippet rd "to the ... power" iA 313 | ^{($1)}$0 314 | endsnippet 315 | 316 | snippet __ "subscript" iA 317 | _{$1}$0 318 | endsnippet 319 | 320 | snippet ooo "\infty" iA 321 | \infty 322 | endsnippet 323 | 324 | snippet rij "mrij" i 325 | (${1:x}_${2:n})_{${3:$2}\\in${4:\\N}}$0 326 | endsnippet 327 | 328 | snippet <= "leq" iA 329 | \le 330 | endsnippet 331 | 332 | snippet >= "geq" iA 333 | \ge 334 | endsnippet 335 | 336 | context "math()" 337 | snippet EE "geq" iA 338 | \exists 339 | endsnippet 340 | 341 | context "math()" 342 | snippet AA "forall" iA 343 | \forall 344 | endsnippet 345 | 346 | context "math()" 347 | snippet xnn "xn" iA 348 | x_{n} 349 | endsnippet 350 | 351 | context "math()" 352 | snippet ynn "yn" iA 353 | y_{n} 354 | endsnippet 355 | 356 | 357 | context "math()" 358 | snippet xii "xi" iA 359 | x_{i} 360 | endsnippet 361 | 362 | context "math()" 363 | snippet yii "yi" iA 364 | y_{i} 365 | endsnippet 366 | 367 | context "math()" 368 | snippet xjj "xj" iA 369 | x_{j} 370 | endsnippet 371 | 372 | context "math()" 373 | snippet yjj "yj" iA 374 | y_{j} 375 | endsnippet 376 | 377 | context "math()" 378 | snippet xp1 "x" iA 379 | x_{n+1} 380 | endsnippet 381 | 382 | context "math()" 383 | snippet xmm "x" iA 384 | x_{m} 385 | endsnippet 386 | 387 | snippet R0+ "R0+" iA 388 | \\R_0^+ 389 | endsnippet 390 | 391 | snippet plot "Plot" w 392 | \begin{figure}[$1] 393 | \centering 394 | \begin{tikzpicture} 395 | \begin{axis}[ 396 | xmin= ${2:-10}, xmax= ${3:10}, 397 | ymin= ${4:-10}, ymax = ${5:10}, 398 | axis lines = middle, 399 | ] 400 | \addplot[domain=$2:$3, samples=${6:100}]{$7}; 401 | \end{axis} 402 | \end{tikzpicture} 403 | \caption{$8} 404 | \label{${9:$8}} 405 | \end{figure} 406 | endsnippet 407 | 408 | snippet nn "Tikz node" w 409 | \node[$5] (${1/[^0-9a-zA-Z]//g}${2}) ${3:at (${4:0,0}) }{$${1}$}; 410 | $0 411 | endsnippet 412 | 413 | context "math()" 414 | snippet mcal "mathcal" iA 415 | \mathcal{$1}$0 416 | endsnippet 417 | 418 | snippet lll "l" iA 419 | \ell 420 | endsnippet 421 | 422 | context "math()" 423 | snippet nabl "nabla" iA 424 | \nabla 425 | endsnippet 426 | 427 | context "math()" 428 | snippet xx "cross" iA 429 | \times 430 | endsnippet 431 | 432 | priority 100 433 | snippet ** "cdot" iA 434 | \cdot 435 | endsnippet 436 | 437 | context "math()" 438 | snippet norm "norm" iA 439 | \|$1\|$0 440 | endsnippet 441 | 442 | priority 100 443 | context "math()" 444 | snippet '(? "to" iA 464 | \to 465 | endsnippet 466 | 467 | priority 200 468 | context "math()" 469 | snippet <-> "leftrightarrow" iA 470 | \leftrightarrow 471 | endsnippet 472 | 473 | context "math()" 474 | snippet !> "mapsto" iA 475 | \mapsto 476 | endsnippet 477 | 478 | context "math()" 479 | snippet invs "inverse" iA 480 | ^{-1} 481 | endsnippet 482 | 483 | context "math()" 484 | snippet compl "complement" iA 485 | ^{c} 486 | endsnippet 487 | 488 | context "math()" 489 | snippet \\\ "setminus" iA 490 | \setminus 491 | endsnippet 492 | 493 | snippet >> ">>" iA 494 | \gg 495 | endsnippet 496 | 497 | snippet << "<<" iA 498 | \ll 499 | endsnippet 500 | 501 | 502 | snippet ~~ "~" iA 503 | \sim 504 | endsnippet 505 | 506 | context "math()" 507 | snippet set "set" wA 508 | \\{$1\\} $0 509 | endsnippet 510 | 511 | snippet || "mid" iA 512 | \mid 513 | endsnippet 514 | 515 | 516 | context "math()" 517 | snippet cc "subset" Ai 518 | \subset 519 | endsnippet 520 | 521 | snippet notin "not in " iA 522 | \not\in 523 | endsnippet 524 | 525 | context "math()" 526 | snippet inn "in " iA 527 | \in 528 | endsnippet 529 | 530 | snippet NN "n" iA 531 | \N 532 | endsnippet 533 | 534 | snippet Nn "cap" iA 535 | \cap 536 | endsnippet 537 | 538 | snippet UU "cup" iA 539 | \cup 540 | endsnippet 541 | 542 | snippet uuu "bigcup" iA 543 | \bigcup_{${1:i \in ${2: I}}} $0 544 | endsnippet 545 | 546 | snippet nnn "bigcap" iA 547 | \bigcap_{${1:i \in ${2: I}}} $0 548 | endsnippet 549 | 550 | snippet OO "emptyset" iA 551 | \O 552 | endsnippet 553 | 554 | snippet RR "real" iA 555 | \R 556 | endsnippet 557 | 558 | snippet QQ "Q" iA 559 | \Q 560 | endsnippet 561 | 562 | snippet ZZ "Z" iA 563 | \Z 564 | endsnippet 565 | 566 | snippet "hokje" iA 571 | \diamond 572 | endsnippet 573 | 574 | 575 | context "math()" 576 | snippet '(? 30 | 31 | import os.path as p 32 | import subprocess 33 | 34 | DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) ) 35 | DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' ) 36 | 37 | 38 | def GetStandardLibraryIndexInSysPath( sys_path ): 39 | for index, path in enumerate( sys_path ): 40 | if p.isfile( p.join( path, 'os.py' ) ): 41 | return index 42 | raise RuntimeError( 'Could not find standard library path in Python path.' ) 43 | 44 | 45 | def PythonSysPath( **kwargs ): 46 | sys_path = kwargs[ 'sys_path' ] 47 | 48 | dependencies = [ p.join( DIR_OF_THIS_SCRIPT, 'python' ), 49 | p.join( DIR_OF_THIRD_PARTY, 'requests-futures' ), 50 | p.join( DIR_OF_THIRD_PARTY, 'ycmd' ), 51 | p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'idna' ), 52 | p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'chardet' ), 53 | p.join( DIR_OF_THIRD_PARTY, 54 | 'requests_deps', 55 | 'urllib3', 56 | 'src' ), 57 | p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'certifi' ), 58 | p.join( DIR_OF_THIRD_PARTY, 'requests_deps', 'requests' ) ] 59 | 60 | # The concurrent.futures module is part of the standard library on Python 3. 61 | interpreter_path = kwargs[ 'interpreter_path' ] 62 | major_version = int( subprocess.check_output( [ 63 | interpreter_path, '-c', 'import sys; print( sys.version_info[ 0 ] )' ] 64 | ).rstrip().decode( 'utf8' ) ) 65 | if major_version == 2: 66 | dependencies.append( p.join( DIR_OF_THIRD_PARTY, 'pythonfutures' ) ) 67 | 68 | sys_path[ 0:0 ] = dependencies 69 | sys_path.insert( GetStandardLibraryIndexInSysPath( sys_path ) + 1, 70 | p.join( DIR_OF_THIRD_PARTY, 'python-future', 'src' ) ) 71 | 72 | return sys_path 73 | -------------------------------------------------------------------------------- /config/plugins/DoxygenToolkit.vim.vim: -------------------------------------------------------------------------------- 1 | let g:DoxygenToolkit_briefTag_pre="@brief: " 2 | let g:DoxygenToolkit_paramTag_pre="@param " 3 | let g:DoxygenToolkit_returnTag= "@return " 4 | let g:DoxygenToolkit_authorName="fgh" 5 | let g:DoxygenToolkit_companyName="bupt" 6 | 7 | nmap d :Dox 8 | -------------------------------------------------------------------------------- /config/plugins/LanguageClient-neovim.vim: -------------------------------------------------------------------------------- 1 | set hidden 2 | 3 | let g:LanguageClient_serverCommands = { 4 | \ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'], 5 | \ 'javascript': ['typescript-language-server'], 6 | \ 'python': ['~/Software/anaconda3/envs/keras/bin/pyls'], 7 | \ 'cpp': ['ccls'], 8 | \ 'c': ['ccls'] 9 | \ } 10 | 11 | nnoremap l :call LanguageClient_contextMenu() 12 | nnoremap K :call LanguageClient#textDocument_hover() 13 | nnoremap gd :call LanguageClient#textDocument_definition() 14 | nnoremap rn :call LanguageClient#textDocument_rename() 15 | -------------------------------------------------------------------------------- /config/plugins/LeaderF.vim: -------------------------------------------------------------------------------- 1 | " fzf优先 2 | highlight Lf_hl_rgHighlight guifg=#FFFF00 guibg=NONE ctermfg=yellow ctermbg=NONE 3 | highlight Lf_hl_match gui=bold guifg=Red cterm=bold ctermfg=21 4 | highlight Lf_hl_matchRefine gui=bold guifg=Magenta cterm=bold ctermfg=201 5 | 6 | let g:Lf_HideHelp = 1 7 | " 使用leaderf file path的时候不更改目录到path 8 | let g:Lf_NoChdir = 1 9 | let g:Lf_UseCache = 0 10 | let g:Lf_UseVersionControlTool = 0 11 | let g:Lf_IgnoreCurrentBufferName = 1 12 | " popup mode 13 | let g:Lf_WindowPosition = 'popup' 14 | let g:Lf_PreviewInPopup = 1 15 | let g:Lf_StlSeparator = { 'left': "\ue0b0", 'right': "\ue0b2", 'font': "DejaVu Sans Mono for Powerline" } 16 | let g:Lf_PreviewResult = {'Function': 0, 'BufTag': 0 } 17 | let g:Lf_GtagsAutoGenerate = 0 18 | let g:Lf_Gtagslabel = 'native-pygments' 19 | 20 | function! LeaderfFileWithWiki(query) abort 21 | if empty(a:query) && &ft ==? 'vimwiki' && match(expand('%'), expand(g:vimwiki_path)) > -1 22 | exec "LeaderfFile " . g:vimwiki_path 23 | else 24 | exec "LeaderfFile " . a:query 25 | endif 26 | endfunction 27 | 28 | function! LeaderfRgWithWiki(query) abort 29 | if &ft ==? 'vimwiki' && match(expand('%'), expand(g:vimwiki_path)) > -1 30 | exec 'Leaderf rg -F -e "" ' . g:vimwiki_path 31 | else 32 | exec 'Leaderf rg -F -e ' . leaderf#Rg#visual() 33 | endif 34 | endfunction 35 | 36 | nnoremap :call LeaderfFileWithWiki("") 37 | nnoremap :call LeaderfFileWithWiki($HOME) 38 | nnoremap :call LeaderfRgWithWiki("") 39 | nnoremap :=printf("Leaderf buffer %s", "") 40 | nnoremap :LeaderfCommand 41 | nnoremap :=printf("Leaderf bufTag %s", "") 42 | nnoremap :LeaderfBufTagAll 43 | nnoremap ? :LeaderfLineAll 44 | nnoremap :=printf("Leaderf mru %s", "") 45 | nnoremap :=printf("Leaderf! window %s", "") 46 | -------------------------------------------------------------------------------- /config/plugins/MatchTagAlways.vim: -------------------------------------------------------------------------------- 1 | " let g:mta_filetypes = { 2 | " \ 'html' : 1, 3 | " \ 'htm' : 1, 4 | " \ 'xhtml' : 1, 5 | " \ 'xml' : 1, 6 | " \ 'jinja' : 1, 7 | " \} 8 | -------------------------------------------------------------------------------- /config/plugins/ResizeWindow.vim.vim: -------------------------------------------------------------------------------- 1 | nmap (resize_window_down) 2 | nmap (resize_window_up) 3 | nmap (resize_window_left) 4 | nmap (resize_window_right) 5 | -------------------------------------------------------------------------------- /config/plugins/YouCompleteMe.vim: -------------------------------------------------------------------------------- 1 | " 全局的.ycm_extra_conf.py路径 2 | let g:ycm_global_ycm_extra_conf = g:other_config_root_path . "/ycm_extra_conf.py" 3 | " 最少触发提示单词数量 4 | let g:ycm_min_num_of_chars_for_completion = 1 5 | " 补全列表可见候选条目数量 6 | let g:ycm_max_num_candidates = 20 7 | let g:ycm_max_num_identifier_candidates = 20 8 | 9 | let g:ycm_add_preview_to_completeopt = 2 10 | 11 | " 开启语法检查 12 | let g:ycm_show_diagnostics_ui = 1 13 | let g:ycm_enable_diagnostic_highlighting = 2 14 | let g:ycm_enable_diagnostic_signs = 2 15 | " 错误和警告标志 16 | let g:ycm_error_symbol = '■' 17 | let g:ycm_warning_symbol = '▲' 18 | 19 | "在注释输入中也能补全 20 | let g:ycm_complete_in_comments = 1 21 | "注释和字符串中的文字也会被收入补全 22 | let g:ycm_collect_identifiers_from_comments_and_strings = 1 23 | 24 | " 自定义python解释器路径 25 | " let g:ycm_server_python_interpreter = '~/Software/anaconda3/bin/python3.8' 26 | 27 | let g:ycm_add_preview_to_completeopt = 1 28 | let g:ycm_autoclose_preview_window_after_completion = 1 29 | 30 | let g:ycm_key_detailed_diagnostics = 'a' 31 | 32 | " 黑名单,不启用ycm 33 | let g:ycm_filetype_blacklist = { 34 | \ 'tagbar': 1, 35 | \ 'netrw': 1, 36 | \ 'unite': 1, 37 | \ 'pandoc': 1, 38 | \ 'infolog': 1, 39 | \ 'coc-explorer': 1, 40 | \ 'vista': 1, 41 | \ 'leaderf': 1, 42 | \ 'startify': 1 43 | \ } 44 | 45 | " 仅关闭语义补全不关闭标识符补全 46 | let g:ycm_filetype_specific_completion_to_disable = { 47 | \ 'gitcommit': 1, 48 | \ 'markdown': 1, 49 | \ 'mail': 1, 50 | \ 'text': 1, 51 | \ 'vimwiki': 1, 52 | \ 'notes': 1, 53 | \ } 54 | 55 | let g:ycm_language_server = 56 | \ [ 57 | \ { 58 | \ 'name': 'clangd', 59 | \ 'cmdline': [ 'clangd'], 60 | \ 'filetypes': [ 'cc', 'c', 'h', 'cpp', 'hpp', 'cuda' ], 61 | \ 'project_root_files': ['.git', "compile_commands.json", "compile_flags.txt"] 62 | \ }, 63 | \ ] 64 | 65 | nmap gd :YcmCompleter GoToDefinition 66 | nmap gy :YcmCompleter GoToType 67 | nmap gi :YcmCompleter GoToImplementation 68 | nmap gr :YcmCompleter GoToReferences 69 | nmap gs :YcmCompleter GoToSymbol 70 | 71 | nmap f :YcmCompleter FixIt 72 | nmap rn :YcmCompleter RefactorRename 73 | nmap a :YcmDiags 74 | nmap A :YcmShowDetailedDiagnostic 75 | 76 | " 不自动显示悬浮窗口 77 | let g:ycm_auto_hover = "" 78 | nmap K (YCMHover) 79 | -------------------------------------------------------------------------------- /config/plugins/accelerated-jk.vim: -------------------------------------------------------------------------------- 1 | let g:accelerated_jk_acceleration_limit = 10 2 | 3 | nmap j (accelerated_jk_gj) 4 | nmap k (accelerated_jk_gk) 5 | 6 | " nmap j (accelerated_jk_gj_position) 7 | " nmap k (accelerated_jk_gk_position) 8 | -------------------------------------------------------------------------------- /config/plugins/actionmenu.vim.vim: -------------------------------------------------------------------------------- 1 | let s:code_actions = [] 2 | 3 | 4 | func! ActionMenuCodeActions() abort 5 | let s:code_actions = CocAction('codeActions') 6 | let l:menu_items = map(copy(s:code_actions), { index, item -> item['title'] }) 7 | call actionmenu#open(l:menu_items, 'ActionMenuCodeActionsCallback') 8 | endfunc 9 | 10 | func! ActionMenuCodeActionsCallback(index, item) abort 11 | if a:index >= 0 12 | let l:selected_code_action = s:code_actions[a:index] 13 | let l:response = CocAction('doCodeAction', l:selected_code_action) 14 | endif 15 | endfunc 16 | -------------------------------------------------------------------------------- /config/plugins/ale.vim: -------------------------------------------------------------------------------- 1 | echom 'here is ale config' 2 | let g:ale_sign_column_always = 1 3 | 4 | let g:ale_linters = { 5 | \ '*': ['remove_trailing_lines', 'trim_whitespace'], 6 | \ 'asm': ['gcc'], 7 | \ 'nasm': ['nasm'], 8 | \ 'c': ['cppcheck'], 9 | \ 'cpp': ['cppcheck'], 10 | \ 'cuda': ['nvcc'], 11 | \ 'java': ['javac'], 12 | \ 'javascript': ['eslint'], 13 | \ 'lua': ['luac'], 14 | \ 'yaml': ['prettier'], 15 | \ 'latex': ['alex'], 16 | \ } 17 | " \ 'python': ['pylint', 'flake8'], 18 | 19 | 20 | " 使用开启列标志 21 | let g:ale_sign_column_always = 1 22 | " only run linters named in ale_linters seetings 23 | let g:ale_linters_explicit = 1 24 | 25 | " 高亮显示错误地方 26 | "let g:ale_set_highlights = 1 27 | "自定义error和warning图标 28 | let g:ale_sign_error = 'hhhE' 29 | let g:ale_sign_warning = 'W' 30 | "状态栏设置,状态栏中整合ale 31 | let g:ale_statusline_format = ['ㄨ %d', 'ϟ %d', '✔ OK'] 32 | "提示栏设置,显示Linter名称,出错或警告等相关信息 33 | let g:ale_echo_msg_format = '[%severity% %linter%] -> %s' 34 | let g:ale_echo_msg_error_str = 'ㄨ' 35 | let g:ale_echo_msg_warning_str = 'ϟ' 36 | " highlight clear ALEErrorSign 37 | " highlight clear ALEWarningSign 38 | 39 | "ccls 40 | let g:ale_cpp_ccls_init_options = { 41 | \ 'cache': { 42 | \ 'directory': '/tmp/ccls/cache', 43 | \ }, 44 | \ } 45 | let g:ale_completion_enabled = 1 46 | 47 | " 快捷键 48 | nmap gd :ALEGoToDefinition 49 | nmap gr :ALEFindReferences 50 | 51 | nmap K :ALEHover 52 | -------------------------------------------------------------------------------- /config/plugins/animate.vim.vim: -------------------------------------------------------------------------------- 1 | let g:fzf_layout = { 2 | \ 'window': 'new | wincmd J | resize 1 | call animate#window_percent_height(0.5)' 3 | \ } 4 | 5 | function! OpenAnimatedHtop() abort 6 | " Open a htop in terminal 7 | new term://htop 8 | " Send window to bottom and start with small height 9 | wincmd J | resize 1 10 | " Animate height to 66% 11 | call animate#window_percent_height(0.66) 12 | endfunction 13 | -------------------------------------------------------------------------------- /config/plugins/asyncrun.vim.vim: -------------------------------------------------------------------------------- 1 | " 设置runner,可以使用floaterm或者外部的terminal等 2 | " https://github.com/skywind3000/asyncrun.vim/wiki/Customize-Runner 3 | " https://github.com/voldikss/vim-floaterm#asynctasksvim 4 | let g:asyncrun_open = 6 5 | -------------------------------------------------------------------------------- /config/plugins/auto-pairs.vim: -------------------------------------------------------------------------------- 1 | " let g:AutoPairsShortcutJump = '' 2 | " let g:AutoPairsShortcutBackInsert = '' 3 | 4 | "Default: '' 5 | "Fast wrap the word. all pairs will be consider as a block (include <>). 6 | "(|)'hello' after fast wrap at |, the word will be ('hello') 7 | "(|) after fast wrap at |, the word will be () 8 | 9 | " 自定义了c-h用来在插入模式进行光标移动 10 | " 避免冲突 11 | let g:AutoPairsMapCh = 0 12 | 13 | augroup vime_auto_paris_group 14 | autocmd! 15 | au FileType php let b:AutoPairs = AutoPairsDefine({'', ''}) 16 | au FileType rust let b:AutoPairs = AutoPairsDefine({'\w\zs<': '>'}) 17 | " add pair and remove '{' for html file 18 | au FileType html let b:AutoPairs = AutoPairsDefine({''}) 19 | au FileType md let b:AutoPairs = AutoPairsDefine({'```':'```'}) 20 | augroup END 21 | -------------------------------------------------------------------------------- /config/plugins/auto-session.vim: -------------------------------------------------------------------------------- 1 | let g:auto_session_root_dir = g:session_dir 2 | 3 | let g:auto_session_pre_save_cmds = ["tabdo NERDTreeClse", "tabdo NvimTreeClose"] 4 | -------------------------------------------------------------------------------- /config/plugins/barbar.nvim.vim: -------------------------------------------------------------------------------- 1 | let bufferline = {} 2 | 3 | " let bufferline.icons = v:false 4 | let bufferline.maximum_padding = 1 5 | -------------------------------------------------------------------------------- /config/plugins/bclose.vim.vim: -------------------------------------------------------------------------------- 1 | " let b:bclose_no_plugin_maps = true 2 | function! s:buffer_close() abort 3 | redir => val 4 | exec "buffers" 5 | redir end 6 | if len(val) > 0 7 | exec "Bclose" 8 | endif 9 | endfunction 10 | nnoremap Q :silent call buffer_close() 11 | -------------------------------------------------------------------------------- /config/plugins/caw.vim.vim: -------------------------------------------------------------------------------- 1 | " 更改快捷键 2 | nmap c (caw:prefix) 3 | xmap c (caw:prefix) 4 | -------------------------------------------------------------------------------- /config/plugins/clever-f.vim.vim: -------------------------------------------------------------------------------- 1 | " 多行搜索 2 | let g:clever_f_across_no_line=0 3 | let g:clever_f_smart_case=1 4 | "let g:clever_f_mark_char_color= 5 | let g:clever_f_show_prompt=1 6 | -------------------------------------------------------------------------------- /config/plugins/coc-fzf.vim: -------------------------------------------------------------------------------- 1 | let g:coc_fzf_preview = 'up:50%:wrap' 2 | let g:coc_fzf_opts = [] 3 | 4 | " 因为要配合coc,因此快捷键放到了coc.nvim.vim文件中了 5 | " 6 | " nnoremap a :CocFzfList diagnostics 7 | " nnoremap b :CocFzfList diagnostics --current-buf 8 | " nnoremap c :CocFzfList commands 9 | " nnoremap e :CocFzfList extensions 10 | " nnoremap l :CocFzfList 11 | " " nnoremap l :CocFzfList location 12 | " nnoremap o :CocFzfList outline 13 | " nnoremap O :CocFzfList symbols 14 | " nnoremap s :CocFzfList services 15 | " nnoremap p :CocFzfListResume 16 | -------------------------------------------------------------------------------- /config/plugins/completion-nvim.vim: -------------------------------------------------------------------------------- 1 | let g:completion_enable_auto_popup = 1 2 | let g:completion_enable_auto_hover = 1 3 | let g:completion_enable_auto_signature = 0 4 | let g:completion_enable_snippet = 'vim-vsnip' 5 | let g:completion_trigger_character = ['.', '::'] 6 | let g:completion_auto_change_source = 1 7 | 8 | let g:completion_chain_complete_list = { 9 | \ 'default': [ 10 | \ {'complete_items': ['lsp', 'tags', 'buffers', 'tmux', 'snippet']}, 11 | \ ]} 12 | 13 | lua require'lspconfig'.clangd.setup{on_attach=require'completion'.on_attach} 14 | lua require'lspconfig'.pyls.setup{on_attach=require'completion'.on_attach} 15 | lua require'lspconfig'.bashls.setup{on_attach=require'completion'.on_attach} 16 | lua require'lspconfig'.vimls.setup{on_attach=require'completion'.on_attach} 17 | lua require'lspconfig'.tsserver.setup{on_attach=require'completion'.on_attach} 18 | lua require'lspconfig'.yamlls.setup{on_attach=require'completion'.on_attach} 19 | lua require'lspconfig'.rls.setup{on_attach=require'completion'.on_attach} 20 | 21 | " autocmd BufEnter * lua require'completion'.on_attach() 22 | 23 | inoremap pumvisible() ? "\" : "\" 24 | inoremap pumvisible() ? "\" : "\" 25 | inoremap pumvisible() ? "\" : "\" 26 | inoremap pumvisible() ? "\" : "\" 27 | 28 | imap (completion_smart_tab) 29 | imap (completion_smart_s_tab) 30 | 31 | " Set completeopt to have a better completion experience 32 | set completeopt=menuone,noinsert,noselect 33 | 34 | " Avoid showing message extra message when using completion 35 | set shortmess+=c 36 | 37 | let g:completion_confirm_key = "" 38 | imap pumvisible() ? complete_info()["selected"] != "-1" ? 39 | \ "\(completion_confirm_completion)" : "\\" : "\" 40 | -------------------------------------------------------------------------------- /config/plugins/csv.vim: -------------------------------------------------------------------------------- 1 | " 使用所有行的最大宽度作为本列的最大宽度,默认是10000,即前10000行 2 | let b:csv_arrange_user_all_rows = 1 3 | " 对齐方式,r右对齐,l左对齐,c中心对齐,.小数对齐 4 | " 一个元素代表一列使用*表示从当前到最后 5 | "let b:csv_arrange_align = 'lc.l' 6 | let b:csv_arrange_align = 'l*' 7 | -------------------------------------------------------------------------------- /config/plugins/dashboard-nvim.vim: -------------------------------------------------------------------------------- 1 | let g:dashboard_default_executive ='fzf' 2 | let g:dashboard_default_header='superman' 3 | 4 | let g:dashboard_custom_shortcut={ 5 | \ 'last_session' : '', 6 | \ 'find_history' : '', 7 | \ 'find_file' : '', 8 | \ 'change_colorscheme' : '', 9 | \ 'find_word' : '', 10 | \ 'book_marks' : '', 11 | \ } 12 | 13 | augroup vime_dash_group 14 | autocmd! 15 | autocmd VimLeavePre * :SessionSave 16 | augroup END 17 | 18 | -------------------------------------------------------------------------------- /config/plugins/defx.nvim.vim: -------------------------------------------------------------------------------- 1 | let g:defx_icons_enable_syntax_highlight = 1 2 | let g:defx_icons_column_length = 2 3 | 4 | let s:columns = "" 5 | if common#functions#HasPlug('defx-git') 6 | call defx#custom#column('git', { 7 | \ 'indicators': { 8 | \ 'Modified' : '•', 9 | \ 'Staged' : '✚', 10 | \ 'Untracked' : 'ᵁ', 11 | \ 'Renamed' : 'R', 12 | \ 'Unmerged' : '≠', 13 | \ 'Ignored' : 'ⁱ', 14 | \ 'Deleted' : '✖', 15 | \ 'Unknown' : '⁇' 16 | \ } 17 | \ }) 18 | let s:columns = "indent:mark:git:icon:icons:filename:type" 19 | else 20 | let s:columns = "indent:mark:icon:icons:filename:type" 21 | endif 22 | 23 | call defx#custom#column('icon', { 24 | \ 'directory_icon': '▸', 25 | \ 'opened_icon': '▾', 26 | \ 'root_icon': '/', 27 | \ }) 28 | call defx#custom#column('mark', { 29 | \ 'selected_icon': '✓', 30 | \ 'readonly_icon': '🔒', 31 | \ }) 32 | 33 | function! DefxOpen(where) abort 34 | if a:where 35 | let s:before_winnr = winnr() 36 | call defx#custom#option('_', { 37 | \ 'split': 'floating', 38 | \ 'wincol': 0, 39 | \ 'winrow': 0, 40 | \ 'winrelative': 'win', 41 | \ 'winwidth': winwidth(0), 42 | \ 'winheight': winheight(0)+1, 43 | \ 'show_ignored_files': 0, 44 | \ 'buffer_name': '', 45 | \ 'toggle': 1, 46 | \ 'resume': 1, 47 | \ 'columns': s:columns, 48 | \ }) 49 | else 50 | call defx#custom#option('_', { 51 | \ 'split': 'vertical', 52 | \ 'direction': 'topleft', 53 | \ 'winwidth': 30, 54 | \ 'listed': 1, 55 | \ 'show_ignored_files': 0, 56 | \ 'buffer_name': 'defx', 57 | \ 'toggle': 1, 58 | \ 'resume': 1, 59 | \ 'columns': s:columns 60 | \ }) 61 | endif 62 | exec "Defx " 63 | endf 64 | 65 | " 选择窗口 66 | function! s:selectWindow(filepath) 67 | if tabpagewinnr(tabpagenr(), '$') > 2 68 | if exists(':ChooseWin') == 2 69 | ChooseWin 70 | else 71 | if has('nvim') 72 | let input = input({ 73 | \ 'prompt' : 'ChooseWin No.: ', 74 | \ 'cancelreturn': 0, 75 | \ }) 76 | if input == 0 | return | endif 77 | else 78 | let input = input('ChooseWin No.: ') 79 | endif 80 | if input == winnr() | return | endif 81 | exec input . 'wincmd w' 82 | endif 83 | 84 | if &ft == 'defx' 85 | return 86 | else 87 | exec 'e' a:filepath 88 | endif 89 | 90 | else 91 | exec 'wincmd w' 92 | exec 'e' a:filepath 93 | endif 94 | endfunction 95 | 96 | function! DefxSmartCr(_) 97 | " 悬浮和非悬浮行为不一样 98 | " 进入目录或者打开文件 99 | let l:split = a:_['split'] 100 | 101 | if defx#is_directory() 102 | call defx#call_action('open_directory') 103 | " 如果是悬浮窗口,不应该更改cwd 104 | if l:split !=? 'floating' 105 | call defx#call_action('change_vim_cwd') 106 | echom "Tab's CWD is: " . getcwd() 107 | endif 108 | else 109 | let l:filepath = defx#get_candidate()['action__path'] 110 | if l:split ==? 'floating' 111 | exec s:before_winnr . 'wincmd w' 112 | exec 'e' l:filepath 113 | exec "Defx -close" 114 | else 115 | call s:selectWindow(l:filepath) 116 | endif 117 | endif 118 | 119 | endfunction 120 | 121 | function! DefxSmartL(_) abort 122 | " 展开树或者打开文件 123 | if defx#is_directory() 124 | call defx#call_action('open_tree') 125 | normal! j 126 | else 127 | " return defx#call_action('drop') 128 | let l:filepath = defx#get_candidate()['action__path'] 129 | 130 | let l:split = a:_['split'] 131 | if l:split ==? 'floating' 132 | " 先关闭悬浮窗口 133 | exec "Defx -close" 134 | endif 135 | 136 | call s:selectWindow(l:filepath) 137 | endif 138 | endfunction 139 | 140 | function! DefxSmartH(_) abort 141 | " 第一行或者没有行,那么返回上一级目录 142 | if line('.') ==# 1 || line('$') ==# 1 143 | return defx#call_action('cd', ['..']) 144 | endif 145 | 146 | return defx#call_action('close_tree') 147 | endfunction 148 | 149 | function! DefxSmartBackSpace(_) abort 150 | " 回到上一级并将上一级设置为工作目录 151 | call defx#call_action('cd', ['..']) 152 | call defx#call_action('change_vim_cwd') 153 | echom "Tab's CWD is: " . getcwd() 154 | endfunction 155 | 156 | function! s:defx_close_tab(tabnr) 157 | " When a tab is closed, find and delete any associated defx buffers 158 | for l:nr in range(1, bufnr('$')) 159 | let l:defx = getbufvar(l:nr, 'defx') 160 | if empty(l:defx) 161 | continue 162 | endif 163 | let l:context = get(l:defx, 'context', {}) 164 | if get(l:context, 'buffer_name', '') ==# 'tab' . a:tabnr 165 | silent! execute 'bdelete '.l:nr 166 | break 167 | endif 168 | endfor 169 | endfunction 170 | 171 | " 自定义快捷键 172 | " nnoremap :call OpenDefxCurWin() 173 | " nnoremap :call OpenDefxLeft() 174 | nnoremap :call DefxOpen(v:false) 175 | if !common#functions#HasPlug('ranger.vim') 176 | nnoremap f :call DefxOpen(v:true) 177 | endif 178 | 179 | function! s:defx_custom_settings() abort 180 | nnoremap N defx#do_action('new_file') " 新建文件/文件夹 181 | nnoremap D defx#do_action('remove_trash') " 删除 182 | nnoremap Y defx#do_action('copy') " 复制 183 | nnoremap P defx#do_action('paste') " 粘贴 184 | nnoremap dd defx#do_action('move') " 剪切 185 | nnoremap R defx#do_action('rename') " 重命名 186 | nnoremap v defx#do_action('toggle_select') . 'j' " 选择 187 | nnoremap V defx#do_action('toggle_select') . 'k' " 选择 188 | nnoremap * defx#do_action('toggle_select') " 选择但不移动 189 | nnoremap x defx#do_action('execute_system') " 执行 190 | nnoremap yp defx#do_action('yank_path') " 复制路径 191 | nnoremap h defx#do_action('call', 'DefxSmartH') " 关闭节点或者返回上一层目录,但不设置cwd 192 | nnoremap l defx#do_action('call', 'DefxSmartL') " 展开或者打开文件 193 | nnoremap L defx#do_action('open_tree_recursive') " 递归展开 194 | nnoremap q defx#do_action('quit') " 关闭的defx 195 | nnoremap r defx#do_action('redraw') 196 | nnoremap defx#do_action('call', 'DefxSmartCr') " 打开文件或者进入目录 197 | nnoremap defx#do_action('call', 'DefxSmartBackSpace') " 返回上一级目录并设置cwd 198 | nnoremap W defx#do_action('drop', 'vsplit') 199 | nnoremap w defx#do_action('drop', 'split') 200 | nnoremap t defx#do_action('drop', 'tabedit') 201 | nnoremap . defx#do_action('toggle_ignored_files') " 显示隐藏文件 202 | nnoremap s defx#do_action('toggle_sort') " 排序 203 | nnoremap ~ defx#do_action('cd') 204 | nnoremap x defx#do_action('execute_command') 205 | nnoremap ` defx#do_action('cd', getcwd()) " 回到工作目录 206 | nnoremap cd defx#do_action('change_vim_cwd') " 将当前目录设置为工作目录 207 | nnoremap f defx#do_action('search') 208 | endfunction 209 | 210 | augroup vime_defx_group 211 | autocmd! 212 | " Delete defx if it's the only buffer left in the window 213 | autocmd WinEnter * if &filetype == 'defx' && winnr('$') == 1 | q | endif 214 | " Move focus to the next window if current buffer is defx 215 | autocmd TabLeave * if &filetype == 'defx' | wincmd w | endif 216 | autocmd TabClosed * call s:defx_close_tab(expand('')) 217 | " Define defx window mappings 218 | autocmd FileType defx call s:defx_custom_settings() 219 | 220 | autocmd FileType defx setlocal nobuflisted 221 | autocmd FileType defx setlocal nonumber 222 | autocmd FileType defx setlocal norelativenumber 223 | " autocmd FileType defx setlocal laststatus=0 224 | augroup END 225 | -------------------------------------------------------------------------------- /config/plugins/dict.vim.vim: -------------------------------------------------------------------------------- 1 | nmap e DictSearch 2 | vmap e DictVSearch 3 | 4 | nmap w DictWSearch 5 | vmap w DictWVSearch 6 | 7 | nmap r DictRSearch 8 | vmap r DictRVSearch 9 | -------------------------------------------------------------------------------- /config/plugins/eleline.vim.vim: -------------------------------------------------------------------------------- 1 | set laststatus=2 2 | let g:eleline_powerline_fonts = 1 3 | -------------------------------------------------------------------------------- /config/plugins/far.vim.vim: -------------------------------------------------------------------------------- 1 | " Far {pattern} {replace-with} {file-mask} [params] 2 | " F {pattern} {file-mask} [params] find only 3 | set lazyredraw 4 | set regexpengine=1 5 | -------------------------------------------------------------------------------- /config/plugins/fzf-preview.vim.vim: -------------------------------------------------------------------------------- 1 | let g:fzf_preview_floating_window_rate = 0.6 2 | let g:fzf_preview_default_fzf_options = { '--reverse': v:true, '--preview-window': 'wrap' } 3 | " jump to the buffers by default, when possible 4 | let g:fzf_preview_buffers_jump = 1 5 | let g:fzf_preview_fzf_preview_window_option = 'up:50%' 6 | " let g:fzf_preview_command = g:scripts_root_path . '/preview.sh' 7 | let g:fzf_preview_use_dev_icons = 1 8 | let g:fzf_preview_dev_icon_prefix_string_length = 3 9 | let g:fzf_preview_grep_cmd = 'rg --column --line-number --no-heading --color=always --smart-case' 10 | let g:fzf_preview_cache_directory = g:cache_root_path . 'fzf_preview' 11 | " let g:fzf_preview_preview_key_bindings = 'ctrl-f:preview-page-down,ctrl-b:preview-page-up,?:toggle-preview,ctrl-d:' 12 | 13 | augroup vime_fzf_preview_group 14 | autocmd! 15 | au FileType fzf tnoremap 16 | au FileType fzf tnoremap 17 | au FileType fzf tunmap 18 | augroup END 19 | 20 | function! s:RipgrepFzfWithWiki(query, fullscreen) 21 | " 这个是在安装了vimwiki插件后使用的功能,需要配置一下g:vimwiki_path路径 22 | if common#functions#HasPlug('vimwiki') && &ft ==? 'vimwiki' && match(expand('%:p'), expand(g:vimwiki_path)) > -1 23 | let wiki_path = g:vimwiki_path 24 | else 25 | let wiki_path = "" 26 | endif 27 | execute 'FzfPreviewProjectGrep .' . ' ' . wiki_path 28 | endfunction 29 | command! -nargs=* -bang GrepWithWiki call s:RipgrepFzfWithWiki(, 0) 30 | 31 | function! s:FilesWithWiki(query, fullscreen) 32 | let l:q=a:query 33 | if empty(l:q) && common#functions#HasPlug('vimwiki') && &ft ==? 'vimwiki' && match(expand('%:p'), expand(g:vimwiki_path)) > -1 34 | let l:q=g:vimwiki_path 35 | endif 36 | exec 'FzfPreviewDirectoryFiles' . ' ' . l:q 37 | endfunction 38 | command! -bang -nargs=? -complete=dir FWW call s:FilesWithWiki(, 0) 39 | 40 | nnoremap :FWW 41 | nnoremap :FWW $HOME 42 | nnoremap :FzfPreviewAllBuffers 43 | if common#functions#HasPlug('vista.vim') 44 | nnoremap :FzfPreviewVistaBufferCtags 45 | nnoremap :FzfPreviewVistaCtags 46 | else 47 | nnoremap :FzfPreviewBufferTags 48 | nnoremap :FzfPreviewCtags 49 | endif 50 | " 使用rg搜索工作目录或者笔记目录 51 | nnoremap :GrepWithWiki 52 | " 模糊搜索所有buffer 53 | nnoremap ? :FzfPreviewLines 54 | if executable('bat') 55 | nnoremap * :FzfPreviewLines --add-fzf-arg=--no-sort --add-fzf-arg=--query="'=expand('')" 56 | endif 57 | nnoremap :FzfPreviewMruFiles 58 | nnoremap :FzfPreviewCommandPalette 59 | nnoremap :FzfPreviewChanges 60 | if common#functions#HasPlug('vim-bookmarks') 61 | nnoremap :FzfPreviewBookmarks 62 | else 63 | nnoremap :FzfPreviewMarks 64 | endif 65 | if common#functions#HasPlug('yankround.vim') 66 | nnoremap :FzfPreviewYankround 67 | endif 68 | nnoremap :FzfPreviewJumps 69 | " nnoremap :FzfPreviewQuickFix 70 | " nnoremap :FzfPreviewLocationList 71 | nnoremap :FzfPreviewQuickFix 72 | nnoremap :FzfPreviewLocationList 73 | 74 | " git相关 75 | nnoremap gf :FzfPreviewGitFiles 76 | nnoremap gs :FzfPreviewGitStatus 77 | nnoremap ga :FzfPreviewGitActions 78 | nnoremap gb :FzfPreviewBlamePR 79 | nnoremap gl :FzfPreviewGitLogs 80 | -------------------------------------------------------------------------------- /config/plugins/fzf.vim.vim: -------------------------------------------------------------------------------- 1 | "----------------------------------------------------------------------------- 2 | " 全局配置 3 | "----------------------------------------------------------------------------- 4 | if exists('g:loaded_config_fzf_vim_vim') 5 | finish 6 | endif 7 | let g:loaded_config_fzf_vim_vim = 1 8 | 9 | " fzf文件夹 10 | let g:fzf_dir = g:cache_root_path . '/fzf' 11 | " fzf history 文件 12 | let g:fzf_history_dir = g:fzf_dir . "/fzf-history" 13 | 14 | " 输入框在顶部 15 | let $FZF_DEFAULT_OPTS = '--layout=reverse --info=inline' 16 | let $FZF_DEFAULT_COMMAND = "rg --files --hidden" 17 | 18 | " fzf外观 19 | " coc-fzf也使用这个变量 20 | let g:fzf_layout = { 21 | \ 'window': { 22 | \ 'up': '~90%', 'width': 0.6, 'height': 0.8, 'yoffset':0.5, 23 | \ 'xoffset': 0.5, 'highlight': 'Todo', 'border': 'sharp' 24 | \ } 25 | \ } 26 | 27 | " 预览窗口配置 28 | let s:preview_window_config = 'up:50%:wrap' 29 | let s:preview_window = '--preview-window=' . s:preview_window_config 30 | let g:fzf_preview_window = s:preview_window_config 31 | " 自定义窗口预览程序 32 | let s:preview_program = g:scripts_root_path . "/preview.sh" 33 | 34 | " 如果存在buffer,那么跳转过去 35 | let g:fzf_buffers_jump = 1 36 | 37 | "----------------------------------------------------------------------------- 38 | " 主题配置 39 | "----------------------------------------------------------------------------- 40 | " 配色与主题同色 41 | " fg表示未选中行的前景色 42 | " hl表示搜索到的文字的颜色 43 | " fg+表示选中的行的前景色 44 | " hl+表示选中的行的搜索文字颜色 45 | let g:fzf_colors = { 46 | \ 'fg': ['fg', 'Normal'], 47 | \ 'bg': ['bg', 'Normal'], 48 | \ 'hl': ['fg', 'Directory'], 49 | \ 'fg+': ['fg', 'CursorLine', 'CursorColumn', 'Normal'], 50 | \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], 51 | \ 'hl+': ['fg', 'WarningMsg'], 52 | \ 'info': ['fg', 'PreProc'], 53 | \ 'border': ['fg', 'Ignore'], 54 | \ 'prompt': ['fg', 'Conditional'], 55 | \ 'pointer': ['fg', 'Exception'], 56 | \ 'marker': ['fg', 'Keyword'], 57 | \ 'spinner': ['fg', 'Label'], 58 | \ 'header': ['fg', 'Comment'] } 59 | 60 | "----------------------------------------------------------------------------- 61 | " 使用ctrl jk上下移动选项 62 | "----------------------------------------------------------------------------- 63 | augroup vime_fzf_group 64 | autocmd! 65 | au FileType fzf tnoremap 66 | au FileType fzf tnoremap 67 | au FileType fzf tnoremap 68 | augroup END 69 | 70 | "----------------------------------------------------------------------------- 71 | " 一些函数 72 | "----------------------------------------------------------------------------- 73 | " ref https://github.com/junegunn/fzf.vim/issues/379 74 | " 使用系统应用打开文件 75 | function! s:SystemExecute(lines) 76 | for line in a:lines 77 | exec 'silent !xdg-open ' . fnameescape(line) . ' > /dev/null' 78 | endfor 79 | endfunction 80 | 81 | function! s:DeleteBuffer(lines) 82 | for l:line in a:lines 83 | " exec 'bd ' . line 84 | endfor 85 | endfunction 86 | 87 | let g:fzf_action = { 88 | \ 'ctrl-t': 'tab split', 89 | \ 'ctrl-s': 'split', 90 | \ 'ctrl-v': 'vsplit', 91 | \ 'alt-x': function('s:SystemExecute'), 92 | \ } 93 | 94 | "----------------------------------------------------------------------------- 95 | " 内容检索 96 | "----------------------------------------------------------------------------- 97 | function! s:RipgrepFzfWithWiki(query, fullscreen) abort 98 | let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case %s %s || true' 99 | 100 | " 这个是在安装了vimwiki插件后使用的功能,需要配置一下g:vimwiki_path路径 101 | if &ft ==? 'vimwiki' && match(expand('%:p'), expand(g:vimwiki_path)) > -1 102 | let l:path = g:vimwiki_path 103 | else 104 | let l:path = "" 105 | endif 106 | 107 | let initial_command = printf(command_fmt, shellescape(a:query), l:path) 108 | let reload_command = printf(command_fmt, '{q}', l:path) 109 | let spec = {'options': [ 110 | \ '--phony', 111 | \ '--query', a:query, 112 | \ '--bind', 'change:reload:'.reload_command, 113 | \ '--preview', s:preview_program . ' {}', 114 | \ s:preview_window 115 | \ ]} 116 | 117 | call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen) 118 | endfunction 119 | 120 | function! s:RipgrepFzfWithWikiVisual(fullscreen) abort range 121 | call s:RipgrepFzfWithWiki(common#functions#getVisualSelection(), a:fullscreen) 122 | endfunction 123 | " TODO 还需要优化,尽量合并成一个函数,通过参数来操作 124 | command! -nargs=* -bang GrepWithWiki call s:RipgrepFzfWithWiki(, 0) 125 | command! -range=% -bang GrepWithWikiVisual ,call s:RipgrepFzfWithWikiVisual(0) 126 | 127 | "----------------------------------------------------------------------------- 128 | " 文件检索 129 | "----------------------------------------------------------------------------- 130 | function! s:FilesWithWiki(query, fullscreen) 131 | let spec = {'options': [ 132 | \ '--info=inline', 133 | \ '--preview', s:preview_program . ' {}', 134 | \ s:preview_window 135 | \ ]} 136 | 137 | if empty(a:query) && &ft ==? 'vimwiki' && match(expand('%:p'), expand(g:vimwiki_path)) > -1 138 | let l:path = g:vimwiki_path 139 | elseif a:query == '' 140 | let l:path = getcwd() 141 | else 142 | let l:path = a:query 143 | endif 144 | call fzf#vim#files(l:path, spec, a:fullscreen) 145 | endfunction 146 | command! -bang -nargs=? -complete=dir FWW call s:FilesWithWiki(, 0) 147 | 148 | "----------------------------------------------------------------------------- 149 | " quickfix 与 locallist 150 | "----------------------------------------------------------------------------- 151 | function! s:error_type(type, nr) abort 152 | if a:type ==? 'W' | let l:msg = ' warning' 153 | elseif a:type ==? 'I' | let l:msg = ' info' 154 | elseif a:type ==? 'E' || (a:type ==# "\0" && a:nr > 0) | let l:msg = ' error' 155 | elseif a:type ==# "\0" || a:type ==# "\1" | let l:msg = '' 156 | else | let l:msg = ' ' . a:type | endif 157 | 158 | if a:nr <= 0 | return l:msg | endif 159 | 160 | return printf('%s %3d', l:msg, a:nr) 161 | endfunction 162 | 163 | function! s:formatError(item) abort 164 | return (a:item.bufnr ? bufname(a:item.bufnr) : '') 165 | \ . ':' . (a:item.lnum ? a:item.lnum : '') 166 | \ . ':' . (a:item.col ? ' col ' . a:item.col : '') 167 | \ . ' | ' . s:error_type(a:item.type, a:item.nr) 168 | \ . ' | ' . substitute(a:item.text, '\v^\s*', ' ', '') 169 | endfunction 170 | 171 | function! s:quickfixOrLocalListHandler(err) abort 172 | let l:err_list = split(a:err, '|') 173 | let l:fn_ln = split(l:err_list[0], ':') 174 | let l:file_name = l:fn_ln[0] 175 | let l:line = "" 176 | let l:col = 0 177 | if len(l:fn_ln) == 2 178 | let l:line = l:fn_ln[1] 179 | elseif len(l:fn_ln) == 3 180 | let l:line = l:fn_ln[1] 181 | let l:col = l:fn_ln[2] 182 | endif 183 | 184 | if bufnr(l:file_name) != bufnr("%") 185 | execute 'buffer'.bufnr(l:file_name) 186 | endif 187 | 188 | if !empty(l:line) && str2nr(l:line) > -1 189 | call cursor(str2nr(l:line), str2nr(l:col)) 190 | else | return | endif 191 | normal! zvzz 192 | return 193 | endfunction 194 | 195 | " TODO 编写高亮 196 | function! s:FzfQuickfixOrLocalList(...) abort 197 | call fzf#run(fzf#wrap({ 198 | \ 'source': map(a:1 ? getloclist(0) : getqflist(), 's:formatError(v:val)'), 199 | \ 'sink': function('quickfixOrLocalListHandler'), 200 | \ 'options': [ 201 | \ (a:1 ? '--prompt=LocList' : '--prompt=QfList'), 202 | \ '--info=inline', 203 | \ '--preview', s:preview_program . ' {1}', 204 | \ s:preview_window 205 | \ ], 206 | \ })) 207 | endfunction 208 | command! FzfQuickfix call FzfQuickfixOrLocalList(0) 209 | command! FzfLocationList call FzfQuickfixOrLocalList(1) 210 | 211 | "----------------------------------------------------------------------------- 212 | " jumps 213 | "----------------------------------------------------------------------------- 214 | " TODO 增加颜色 215 | " TODO 定位当前所在的位置而不是总是置顶 216 | " 当前jump所在的位置 217 | " let s:jump_current_line = 0 218 | function! s:jumpListFormat(val) abort 219 | let l:file_name = bufname('%') 220 | let l:file_name = empty(l:file_name) ? 'Unknown file name' : l:file_name 221 | let l:curpos = getcurpos() 222 | let l:l = matchlist(a:val, '\(>\?\)\s*\(\d*\)\s*\(\d*\)\s*\(\d*\) \?\(.*\)') 223 | let [l:mark, l:jump, l:line, l:col, l:content] = l:l[1:5] 224 | if empty(trim(l:mark)) | let l:mark = '-' | endif 225 | 226 | if filereadable(expand(fnameescape(l:content))) 227 | let l:file_name = expand(l:content) 228 | let l:bn = bufnr(l:file_name) 229 | if l:bn > -1 && buflisted(l:bn) > 0 230 | let l:content = getbufline(l:bn, l:line) 231 | let l:content = empty(l:content) ? "" : l:content[0] 232 | else 233 | let l:content = system("sed -n " . l:line . "p " . l:file_name) 234 | endif 235 | elseif empty(trim(l:content)) 236 | if empty(trim(l:line)) 237 | let [l:line, l:col] = l:curpos[1:2] 238 | endif 239 | let l:content = getline(l:line, l:line)[0] 240 | endif 241 | return l:mark . " " . l:file_name . ":" . l:line . ":" . l:col . " " . l:content 242 | endfunction 243 | 244 | function! s:jumpList() abort 245 | let l:jl = execute('jumps') 246 | return map(reverse(split(l:jl, '\n')[1:]), 's:jumpListFormat(v:val)') 247 | endfunction 248 | 249 | function! s:jumpHandler(jp) 250 | let l:l = matchlist(a:jp, '\(.\)\s\(.*\):\(\d\+\):\(\d\+\)\(.*\)') 251 | let [l:file_name, l:line, l:col, l:content] = l:l[2:5] 252 | 253 | if empty(l:file_name) || empty(l:line) | return | endif 254 | " 判断文件是否已经存在buffer中 255 | let l:bn = bufnr(l:file_name) 256 | " 未打开 257 | if l:bn == -1 | if filereadable(l:file_name) | execute 'e ' . 'l:file_name' | endif 258 | else | execute 'buffer ' . l:bn | endif 259 | call cursor(str2nr(l:line), str2nr(l:col)) 260 | normal! zvzz 261 | endfunction 262 | 263 | function! s:FzfJumps() abort 264 | call fzf#run(fzf#wrap({ 265 | \ 'source': s:jumpList(), 266 | \ 'sink': function('jumpHandler'), 267 | \ 'options': [ 268 | \ '--prompt=Jumps', 269 | \ '--preview', s:preview_program . ' {2}', 270 | \ s:preview_window 271 | \ ], 272 | \ })) 273 | endfunction 274 | command! -bang -nargs=* FzfJumps call s:FzfJumps() 275 | 276 | 277 | "----------------------------------------------------------------------------- 278 | " marks 279 | "----------------------------------------------------------------------------- 280 | function! s:marksListFormat(val) 281 | let l:l = matchlist(a:val, '\s*\(.\)\s*\(\d\+\)\s*\(\d\+\)\(.*\)') 282 | let [l:mark, l:line, l:col, l:content] = l:l[1:4] 283 | 284 | let l:file_name = bufname('%') 285 | if filereadable(l:content) 286 | let l:file_name = l:content 287 | let l:bn = bufnr(l:file_name) 288 | if l:bn > -1 && buflisted(l:bn) > 0 289 | let l:content = getbufline(l:bn, l:line)[0] 290 | else 291 | let l:content = system("sed -n " . l:line . "p " . l:file_name) 292 | endif 293 | endif 294 | return l:mark . ' ' . l:file_name . ':' . l:line . ':' . l:col . ' ' . l:content 295 | endfunction 296 | 297 | function! s:marksList() abort 298 | let l:ms = execute('marks') 299 | return map(split(l:ms, '\n')[1:], 'marksListFormat(v:val)') 300 | endfunction 301 | 302 | function! s:marksHandler(mr) abort 303 | let l:l = matchlist(a:mr, '\(.\)\s*\(.*\):\(\d\+\):\(\d\+\)\s*\(.*\)') 304 | let [l:mark, l:file_name, l:line, l:col, l:content] = l:l[1:5] 305 | 306 | let l:bn = bufnr(l:file_name) 307 | if l:bn == -1 308 | if filereadable(l:file_name) | execute 'e ' . l:file_name | endif 309 | else | execute 'buffer' . l:bn | endif 310 | call cursor(str2nr(l:line), str2nr(l:col)) 311 | normal! zvzz 312 | endfunction 313 | 314 | function! s:FzfMarks() abort 315 | call fzf#run(fzf#wrap({ 316 | \ 'source': s:marksList(), 317 | \ 'sink': function('marksHandler'), 318 | \ 'options': [ 319 | \ '--prompt=Marks', 320 | \ '--preview', s:preview_program . ' {2}', 321 | \ s:preview_window 322 | \ ], 323 | \ })) 324 | endfunction 325 | command! -bang -nargs=* FzfMarks call s:FzfMarks() 326 | 327 | 328 | "----------------------------------------------------------------------------- 329 | " buffer lines 330 | "----------------------------------------------------------------------------- 331 | function! s:blinesHandler(lines) abort 332 | if len(a:lines) < 2 333 | return 334 | endif 335 | execute split(a:lines, '\t')[0] 336 | normal! zvzz 337 | endfunction 338 | 339 | function! s:blinesList() abort 340 | let fmtexpr = 'printf("%4d\t%s", v:key + 1, v:val)' 341 | let lines = getline(1, '$') 342 | return map(lines, fmtexpr) 343 | endfunction 344 | 345 | function! s:FzfBLines(...) abort 346 | if a:0 == 0 347 | let l:query = "" 348 | else 349 | let l:query = a:1 350 | endif 351 | 352 | let l:cur_buf_name = expand('%') 353 | if empty(l:cur_buf_name) 354 | let l:preview = 'echo please save first to preview' 355 | else 356 | let l:preview = s:preview_program . ' ' . l:cur_buf_name . ':{1}' 357 | endif 358 | call fzf#run(fzf#wrap({ 359 | \ 'source': s:blinesList(), 360 | \ 'sink': function('blinesHandler'), 361 | \ 'options': [ 362 | \ '--prompt=BLines>', 363 | \ '--query', l:query, 364 | \ '--preview', l:preview, 365 | \ s:preview_window 366 | \ ], 367 | \ })) 368 | endfunction 369 | function s:FzfBLinesVisual() abort 370 | call s:FzfBLines(common#functions#getVisualSelection()) 371 | endfunction 372 | command! -bang -nargs=* FzfBLines call s:FzfBLines() 373 | command! -range=% -bang FzfBLinesVisual ,call s:FzfBLinesVisual() 374 | 375 | "----------------------------------------------------------------------------- 376 | " yank depends on coc-yank 377 | "----------------------------------------------------------------------------- 378 | 379 | "----------------------------------------------------------------------------- 380 | " register 381 | "----------------------------------------------------------------------------- 382 | 383 | "----------------------------------------------------------------------------- 384 | " 自定义快捷键 385 | "----------------------------------------------------------------------------- 386 | nnoremap :FWW 387 | nnoremap :FWW $HOME 388 | nnoremap :Buffers 389 | if common#functions#HasPlug('vista.vim') 390 | let g:vista_fzf_preview = ['up:50%:wrap'] 391 | noremap :Vista finder 392 | else 393 | nnoremap :BTags 394 | endif 395 | nnoremap :Tags 396 | nnoremap :GrepWithWiki 397 | vnoremap :GrepWithWikiVisual 398 | " 模糊搜索当前buffer 399 | nnoremap ? :FzfBLines 400 | vnoremap ? :FzfBLinesVisual 401 | nnoremap :History 402 | " TODO 增加changes 需要自定义 403 | nnoremap :Commands 404 | " 如果coc-fzf支持marks的话就用coc-fzf+coc-bookmarks 405 | nnoremap :FzfMarks 406 | " nnoremap :Marks 407 | nnoremap :Maps 408 | nnoremap :Windows 409 | if common#functions#HasPlug('coc-fzf') 410 | nnoremap :CocFzfList yank 411 | endif 412 | " TODO 编写高亮 413 | nnoremap :FzfJumps 414 | 415 | " TODO 编写高亮 416 | " quickfix与locationlist 417 | nnoremap :FzfQuickfix 418 | nnoremap :FzfLocationList 419 | -------------------------------------------------------------------------------- /config/plugins/galaxyline.nvim.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | EOF 3 | -------------------------------------------------------------------------------- /config/plugins/gesture.nvim.vim: -------------------------------------------------------------------------------- 1 | set mouse=a 2 | nnoremap Gesture draw 3 | nnoremap Gesture finish 4 | lua << EOF 5 | local gesture = require('gesture') 6 | gesture.register({ 7 | name = "scroll to bottom", 8 | inputs = { gesture.up(), gesture.down() }, 9 | action = "normal! G" 10 | }) 11 | gesture.register({ 12 | name = "scroll up", 13 | inputs = { gesture.up() }, 14 | action = "normal! " 15 | }) 16 | gesture.register({ 17 | name = "scroll down", 18 | inputs = { gesture.down() }, 19 | action = "normal! " 20 | }) 21 | gesture.register({ 22 | name = "next tab", 23 | inputs = { gesture.right() }, 24 | action = "tabnext" 25 | }) 26 | gesture.register({ 27 | name = "previous tab", 28 | inputs = { gesture.left() }, 29 | action = function() -- also can use function 30 | vim.cmd("tabprevious") 31 | end, 32 | }) 33 | EOF 34 | -------------------------------------------------------------------------------- /config/plugins/git-blame.nvim.vim: -------------------------------------------------------------------------------- 1 | let g:gitblame_date_format = '%y/%m/%d' 2 | let g:gitblame_message_template = ' ➤ ' 3 | -------------------------------------------------------------------------------- /config/plugins/git.vim.vim: -------------------------------------------------------------------------------- 1 | " git相关的插件都在这里 2 | " 3 | """""""""git-messenger""""""""" 4 | " :GitMessenger 5 | -------------------------------------------------------------------------------- /config/plugins/goyo.vim.vim: -------------------------------------------------------------------------------- 1 | let g:goyo_width = '100' 2 | let g:goyo_height = '85%' 3 | let g:goyo_linenr = 0 4 | 5 | function! s:goyo_enter() 6 | if executable('tmux') && strlen($TMUX) 7 | silent !tmux set status off 8 | silent !tmux list-panes -F '\#F' | grep -q Z || tmux resize-pane -Z 9 | endif 10 | set noshowmode 11 | set noshowcmd 12 | set scrolloff=999 13 | if common#functions#HasPlug('limelight.vim') 14 | Limelight 15 | endif 16 | if common#functions#HasPlug('nvim-scrollview') 17 | exec "ScrollViewDisable" 18 | endif 19 | endfunction 20 | 21 | function! s:goyo_leave() 22 | if executable('tmux') && strlen($TMUX) 23 | silent !tmux set status on 24 | silent !tmux list-panes -F '\#F' | grep -q Z && tmux resize-pane -Z 25 | endif 26 | set showmode 27 | set showcmd 28 | set scrolloff=5 29 | if common#functions#HasPlug('limelight.vim') 30 | Limelight! 31 | endif 32 | if common#functions#HasPlug('nvim-scrollview') 33 | exec "ScrollViewEnable" 34 | endif 35 | endfunction 36 | 37 | augroup vime_user_plugin_goyo 38 | autocmd! 39 | autocmd! User GoyoEnter 40 | autocmd! User GoyoLeave 41 | autocmd User GoyoEnter nested call goyo_enter() 42 | autocmd User GoyoLeave nested call goyo_leave() 43 | augroup END 44 | 45 | nnoremap :Goyo 46 | -------------------------------------------------------------------------------- /config/plugins/graphviz.vim.vim: -------------------------------------------------------------------------------- 1 | let g:graphviz_viewer = 'open' 2 | let g:graphviz_output_format = 'png' 3 | -------------------------------------------------------------------------------- /config/plugins/hiPairs.vim: -------------------------------------------------------------------------------- 1 | " 取消(neo)vim默认的匹配功能 2 | let g:hiPairs_enable_matchParen = 0 3 | 4 | let g:hiPairs_timeout = 100 5 | 6 | " 匹配的括号的颜色 7 | let g:hiPairs_hl_matchPair = { 8 | \ 'term' : 'underline,bold', 9 | \ 'cterm' : 'bold', 10 | \ 'ctermfg' : '0', 11 | \ 'ctermbg' : '180', 12 | \ 'gui' : 'bold', 13 | \ 'guifg' : 'Red', 14 | \ 'guibg' : '#D3B17D' 15 | \ } 16 | 17 | " 不匹配的括号的颜色 18 | let g:hiPairs_hl_unmatchPair = { 19 | \ 'term' : 'underline,italic', 20 | \ 'cterm' : 'italic', 21 | \ 'ctermfg' : '15', 22 | \ 'ctermbg' : '12', 23 | \ 'gui' : 'italic', 24 | \ 'guifg' : 'White', 25 | \ 'guibg' : 'Red' 26 | \ } 27 | -------------------------------------------------------------------------------- /config/plugins/hop.nvim.vim: -------------------------------------------------------------------------------- 1 | 2 | " 一个字符 3 | map f :HopChar1 4 | nmap f :HopChar1 5 | 6 | " 移动到行 7 | map gl :HopLine 8 | nmap gl :HopLine 9 | 10 | " map / :HopPattern 11 | " nmap / :HopPattern 12 | -------------------------------------------------------------------------------- /config/plugins/indent-guides.nvim.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | require('indent_guides').setup({ 3 | indent_levels = 30; 4 | indent_guide_size = 1; 5 | indent_start_level = 1; 6 | indent_space_guides = true; 7 | indent_tab_guides = false; 8 | indent_soft_pattern = '\\s'; 9 | exclude_filetypes = {'help','dashboard','dashpreview','NvimTree','vista','sagahover', 'startify', 'markdown', 'md'}; 10 | even_colors = { fg ='#2E323A',bg='#34383F' }; 11 | odd_colors = {fg='#34383F',bg='#2E323A'}; 12 | }) 13 | EOF 14 | -------------------------------------------------------------------------------- /config/plugins/indentLine.vim: -------------------------------------------------------------------------------- 1 | " let g:indentLine_char_list = ['|', '┆', '┊', '│', '⎸', '|'] 2 | " let g:indentLine_setColors = 0 3 | " let g:indentLine_bgcolor_term = 202 4 | " let g:indentLine_color_term = 120 5 | " let g:indentLine_leadingSpaceEanbled = 1 6 | " let g:indentLine_leadingSpaceChar = '·' 7 | let g:indentLine_char = '┊' 8 | " let g:indentLine_first_char = '*' 9 | 10 | " 使用自己的conceal设置而不是由indentline进行设置 11 | " let g:indentLine_setConceal = 0 12 | let g:indentLine_concealcursor = 'inc' 13 | let g:indentLine_conceallevel = 1 14 | let g:indentLine_bufTypeExclude = ["help", "quickfix", "terminal", "prompt", "nofile"] 15 | let g:indentLine_fileTypeExclude = [ 16 | \ 'terminal', 17 | \ 'defx', 18 | \ 'startify', 19 | \ 'terminal', 20 | \ 'coc-explorer', 21 | \ 'json', 22 | \ 'jsonc', 23 | \ 'vista', 24 | \ 'help', 25 | \ 'nerdtree', 26 | \ 'tagbar', 27 | \ 'vimfiler', 28 | \ 'markdown', 29 | \ 'minimap', 30 | \ 'dashboard', 31 | \ 'tex', 32 | \ 'vimwiki', 33 | \ 'man', 34 | \ 'vista_markdown', 35 | \] 36 | 37 | " autocmd FileType markdown,vimwiki,tex let g:indentLine_enabled=0 38 | -------------------------------------------------------------------------------- /config/plugins/jupyter-vim.vim: -------------------------------------------------------------------------------- 1 | " 取消默认按键 2 | let g:jupyter_mapkeys = 0 3 | if has('nvim') 4 | "let g:python3_host_prog = '~/Software/anaconda3/bin/python' 5 | else 6 | set pyxversion=3 7 | 8 | " OSX 9 | set pythonthreedll=/Library/Frameworks/Python.framework/Versions/3.6/Python 10 | 11 | " Windows 12 | set pythonthreedll=python37.dll 13 | set pythonthreehome=C:\Python37 14 | endif 15 | 16 | nnoremap , :JupyterSendCount 17 | vnoremap , :JupyterSendRange 18 | 19 | "" Run current file 20 | "nnoremap R :JupyterRunFile 21 | "nnoremap I :JupyterImportThisFile 22 | 23 | "" Change to directory of current file 24 | "nnoremap d :JupyterCd %:p:h 25 | 26 | "" Send a selection of lines 27 | "nnoremap X :JupyterSendCell 28 | "nnoremap E :JupyterSendRange 29 | "nmap e JupyterRunTextObj 30 | "vmap e JupyterRunVisual 31 | 32 | "nnoremap U :JupyterUpdateShell 33 | 34 | "" Debugging maps 35 | "nnoremap b :PythonSetBreak 36 | -------------------------------------------------------------------------------- /config/plugins/lens.vim.vim: -------------------------------------------------------------------------------- 1 | let g:lens#disabled_filetypes = ['nerdtree', 'fzf', 'coc-explorer'] 2 | 3 | " 重新设定高与宽 4 | let g:lens#height_resize_max = 40 5 | let g:lens#height_resize_min = 5 6 | let g:lens#width_resize_max = 90 7 | let g:lens#width_resize_min = 20 8 | -------------------------------------------------------------------------------- /config/plugins/lightline.vim.vim: -------------------------------------------------------------------------------- 1 | if &laststatus < 2 2 | " 窗口一直有状态行 3 | set laststatus=2 4 | endif 5 | 6 | 7 | function! s:lightline_is_lean() abort 8 | return &filetype =~? '\v^defx|mundo(diff)?$' 9 | endfunction 10 | 11 | function! s:lightline_is_plain() abort 12 | return &buftype ==? 'terminal' || &filetype =~? '\v^help|coc-explorer|denite|defx|vista_kind|vista|tagbar$' 13 | endfunction 14 | 15 | function! LightlineLineinfo() abort 16 | return &filetype ==? 'help' ? '' : 17 | \ &filetype ==? 'defx' ? ' ' : 18 | \ &filetype ==? 'coc-explorer' ? ' ' : 19 | \ &filetype ==? 'denite' ? ' ' : 20 | \ &filetype ==? 'tagbar' ? ' ' : 21 | \ &filetype ==? 'vista_kind' ? ' ' : 22 | \ &filetype ==? 'vista' ? ' ' : 23 | \ &filetype =~? '\v^mundo(diff)?$' ? ' ' : 24 | \ s:lightline_is_lean() || s:lightline_is_plain() ? ' ' : 25 | \ printf(' %3ld%% ☰ %3ld:%4ld', 100*line('.')/line('$'), line('.'), col('.')) 26 | endfunction 27 | 28 | function! LightLineGitInfo()abort 29 | if &filetype ==? 'defx' || &filetype ==? 'vista' 30 | return "" 31 | endif 32 | let gitbranch=get(g:, 'coc_git_status', '') 33 | let gitcount=get(b:, 'coc_git_status', '') 34 | let gitinfo = [] 35 | if empty(gitbranch) 36 | let gitbranch="" 37 | endif 38 | if empty(gitcount) 39 | let gitcount="" 40 | endif 41 | call add(gitinfo,gitbranch) 42 | call add(gitinfo,gitcount) 43 | return trim(join(gitinfo,'')) 44 | endfunction 45 | 46 | let g:lightline = { 47 | \ 'colorscheme': 'edge', 48 | \ 'enable': { 49 | \ 'tabline': 0 50 | \}, 51 | \ 'active': { 52 | \ 'left': [ [ 'mode', 'paste' ], 53 | \ [ 'readonly', 'filename', 'modified'], 54 | \ [ 'gitinfo', 'method', 'cocstatus'] 55 | \ ], 56 | \ 'right': [ 57 | \ ['cocerror'], ['cocwarn'], ['cocfix'], 58 | \ [ 'filetype', 'fileencoding', 'fileformat', 'hex', 'asc', 'lineinfo'], 59 | \ [ 'percent' ] 60 | \ ] 61 | \ }, 62 | \ 'component': { 63 | \ 'asc': '%03.3b', 64 | \ 'hex': '0x%hhhB', 65 | \ }, 66 | \ 'component_function': { 67 | \ 'cocstatus': 'coc#status', 68 | \ 'lineinfo': 'LightlineLineinfo', 69 | \ 'readonly': 'common#functions#ReadOnly', 70 | \ 'gitinfo': 'LightLineGitInfo', 71 | \ 'cocerror': 'common#functions#CocError', 72 | \ 'cocwarn' : 'common#functions#CocWarn', 73 | \ 'cocfix': 'common#functions#CocFix', 74 | \ 'percent': 'ScrollStatus' 75 | \ }, 76 | \ 'component_expand': { 77 | \ }, 78 | \ 'separator': { 'left': "\ue0b8", 'right': "\ue0ba"}, 79 | \ 'subseparator': { 'left': "\ue0b9", 'right': "\ue0bb"} 80 | \ } 81 | -------------------------------------------------------------------------------- /config/plugins/limelight.vim.vim: -------------------------------------------------------------------------------- 1 | let g:limelight_conceal_ctermfg = 'gray' 2 | let g:limelight_conceal_ctermfg = 240 3 | let g:limelight_conceal_guifg = 'DarkGray' 4 | let g:limelight_conceal_guifg = '#777777' 5 | let g:limelight_default_coefficient = 0.7 6 | 7 | " 上下多少行 8 | let g:limelight_paragraph_span = 1 9 | 10 | " Beginning/end of paragraph 11 | " When there's no empty line between the paragraphs 12 | " and each paragraph starts with indentation 13 | let g:limelight_bop = '^\s' 14 | let g:limelight_eop = '\ze\n^\s' 15 | 16 | " 默认10,设置成-1灰色部分也高亮显示 17 | let g:limelight_priority = -1 18 | 19 | augroup vime_limelight_group 20 | " 启动goyo的时候自动启动limelight 21 | autocmd! User GoyoEnter Limelight 22 | autocmd! User GoyoLeave Limelight! 23 | augroup END 24 | -------------------------------------------------------------------------------- /config/plugins/lspsaga.nvim.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | 3 | local saga = require 'lspsaga' 4 | saga.init_lsp_saga { 5 | use_saga_diagnostic_sign = true, 6 | error_sign = '', 7 | warn_sign = '', 8 | hint_sign = '', 9 | infor_sign = '', 10 | dianostic_header_icon = '  ', 11 | code_action_icon = ' ', 12 | code_action_prompt = { 13 | enable = true, 14 | sign = true, 15 | sign_priority = 20, 16 | virtual_text = true, 17 | }, 18 | finder_definition_icon = ' ', 19 | finder_reference_icon = ' ', 20 | max_preview_lines = 10, -- preview lines of lsp_finder and definition preview 21 | finder_action_keys = { 22 | open = 'o', vsplit = 's',split = 'i',quit = 'q',scroll_down = '', scroll_up = '' -- quit can be a table 23 | }, 24 | code_action_keys = { 25 | quit = 'q',exec = '' 26 | }, 27 | rename_action_keys = { 28 | quit = '',exec = '' -- quit can be a table 29 | }, 30 | definition_preview_icon = ' ', 31 | -- "single" "double" "round" "plus" 32 | border_style = "single", 33 | rename_prompt_prefix = '➤', 34 | -- if you don't use nvim-lspconfig you must pass your server name and 35 | -- the related filetypes into this table 36 | -- like server_filetype_map = {metals = {'sbt', 'scala'}} 37 | -- server_filetype_map = {} 38 | } 39 | 40 | EOF 41 | " go to definition 42 | nnoremap gd :Lspsaga lsp_finder 43 | " show documents 44 | nnoremap K :Lspsaga hover_doc 45 | " signature help 46 | nnoremap gs :Lspsaga signature_help 47 | " fix 48 | nnoremap f :Lspsaga code_action 49 | vnoremap f :Lspsaga range_code_action 50 | " rename 51 | nnoremap rn :Lspsaga rename 52 | " preview definition 53 | nnoremap gp :Lspsaga preview_definition 54 | " jump diagnostic 55 | nnoremap :Lspsaga diagnostic_jump_next 56 | nnoremap :Lspsaga diagnostic_jump_prev 57 | -------------------------------------------------------------------------------- /config/plugins/lualine.nvim.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | -- Eviline config for lualine 3 | -- Author: shadmansaleh 4 | -- Credit: glepnir 5 | local lualine = require 'lualine' 6 | 7 | -- Color table for highlights 8 | local colors = { 9 | bg = '#202328', 10 | fg = '#bbc2cf', 11 | yellow = '#ECBE7B', 12 | cyan = '#008080', 13 | darkblue = '#081633', 14 | green = '#98be65', 15 | orange = '#FF8800', 16 | violet = '#a9a1e1', 17 | magenta = '#c678dd', 18 | blue = '#51afef', 19 | red = '#ec5f67' 20 | } 21 | 22 | local conditions = { 23 | buffer_not_empty = function() return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 end, 24 | hide_in_width = function() return vim.fn.winwidth(0) > 80 end, 25 | check_git_workspace = function() 26 | local filepath = vim.fn.expand('%:p:h') 27 | local gitdir = vim.fn.finddir('.git', filepath .. ';') 28 | return gitdir and #gitdir > 0 and #gitdir < #filepath 29 | end 30 | } 31 | 32 | -- Config 33 | local config = { 34 | options = { 35 | -- Disable sections and component separators 36 | component_separators = "", 37 | section_separators = "", 38 | theme = { 39 | -- We are going to use lualine_c an lualine_x as left and 40 | -- right section. Both are highlighted by c theme . So we 41 | -- are just setting default looks o statusline 42 | normal = {c = {fg = colors.fg, bg = colors.bg}}, 43 | inactive = {c = {fg = colors.fg, bg = colors.bg}} 44 | } 45 | }, 46 | sections = { 47 | -- these are to remove the defaults 48 | lualine_a = {}, 49 | lualine_b = {}, 50 | lualine_y = {}, 51 | lualine_z = {}, 52 | -- These will be filled later 53 | lualine_c = {}, 54 | lualine_x = {} 55 | }, 56 | inactive_sections = { 57 | -- these are to remove the defaults 58 | lualine_a = {}, 59 | lualine_v = {}, 60 | lualine_y = {}, 61 | lualine_z = {}, 62 | lualine_c = {}, 63 | lualine_x = {} 64 | } 65 | } 66 | 67 | -- Inserts a component in lualine_c at left section 68 | local function ins_left(component) 69 | table.insert(config.sections.lualine_c, component) 70 | end 71 | 72 | -- Inserts a component in lualine_x ot right section 73 | local function ins_right(component) 74 | table.insert(config.sections.lualine_x, component) 75 | end 76 | 77 | ins_left { 78 | function() return '▊' end, 79 | color = {fg = colors.blue}, -- Sets highlighting of component 80 | left_padding = 0 -- We don't need space before this 81 | } 82 | 83 | ins_left { 84 | -- mode component 85 | function() 86 | -- auto change color according to neovims mode 87 | local mode_color = { 88 | n = colors.red, 89 | i = colors.green, 90 | v = colors.blue, 91 | [''] = colors.blue, 92 | V = colors.blue, 93 | c = colors.magenta, 94 | no = colors.red, 95 | s = colors.orange, 96 | S = colors.orange, 97 | [''] = colors.orange, 98 | ic = colors.yellow, 99 | R = colors.violet, 100 | Rv = colors.violet, 101 | cv = colors.red, 102 | ce = colors.red, 103 | r = colors.cyan, 104 | rm = colors.cyan, 105 | ['r?'] = colors.cyan, 106 | ['!'] = colors.red, 107 | t = colors.red 108 | } 109 | vim.api.nvim_command( 110 | 'hi! LualineMode guifg=' .. mode_color[vim.fn.mode()] .. " guibg=" .. 111 | colors.bg) 112 | return '' 113 | end, 114 | color = "LualineMode", 115 | left_padding = 0 116 | } 117 | 118 | ins_left { 119 | -- filesize component 120 | function() 121 | local function format_file_size(file) 122 | local size = vim.fn.getfsize(file) 123 | if size <= 0 then return '' end 124 | local sufixes = {'b', 'k', 'm', 'g'} 125 | local i = 1 126 | while size > 1024 do 127 | size = size / 1024 128 | i = i + 1 129 | end 130 | return string.format('%.1f%s', size, sufixes[i]) 131 | end 132 | local file = vim.fn.expand('%:p') 133 | if string.len(file) == 0 then return '' end 134 | return format_file_size(file) 135 | end, 136 | condition = conditions.buffer_not_empty 137 | } 138 | 139 | ins_left { 140 | 'filename', 141 | condition = conditions.buffer_not_empty, 142 | color = {fg = colors.magenta, gui = 'bold'} 143 | } 144 | 145 | ins_left {'location'} 146 | 147 | ins_left {'progress', color = {fg = colors.fg, gui = 'bold'}} 148 | 149 | ins_left { 150 | 'diagnostics', 151 | sources = {'coc'}, 152 | symbols = {error = ' ', warn = ' ', info = ' '}, 153 | color_error = colors.red, 154 | color_warn = colors.yellow, 155 | color_info = colors.cyan 156 | } 157 | 158 | -- Insert mid section. You can make any number of sections in neovim :) 159 | -- for lualine it's any number greater then 2 160 | ins_left {function() return '%=' end} 161 | 162 | ins_left { 163 | -- Lsp server name . 164 | function() 165 | local msg = 'No Active Lsp' 166 | local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') 167 | local clients = vim.lsp.get_active_clients() 168 | if next(clients) == nil then return msg end 169 | for _, client in ipairs(clients) do 170 | local filetypes = client.config.filetypes 171 | if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then 172 | return client.name 173 | end 174 | end 175 | return msg 176 | end, 177 | icon = ' LSP:', 178 | color = {fg = '#ffffff', gui = 'bold'} 179 | } 180 | 181 | -- Add components to right sections 182 | ins_right { 183 | 'o:encoding', -- option component same as &encoding in viml 184 | upper = true, -- I'm not sure why it's upper case either ;) 185 | condition = conditions.hide_in_width, 186 | color = {fg = colors.green, gui = 'bold'} 187 | } 188 | 189 | ins_right { 190 | 'fileformat', 191 | upper = true, 192 | icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh 193 | color = {fg = colors.green, gui = 'bold'} 194 | } 195 | 196 | ins_right { 197 | 'branch', 198 | icon = '', 199 | condition = conditions.check_git_workspace, 200 | color = {fg = colors.violet, gui = 'bold'} 201 | } 202 | 203 | ins_right { 204 | 'diff', 205 | -- Is it me or the symbol for modified us really weird 206 | symbols = {added = ' ', modified = '柳 ', removed = ' '}, 207 | color_added = colors.green, 208 | color_modified = colors.orange, 209 | color_removed = colors.red, 210 | condition = conditions.hide_in_width 211 | } 212 | 213 | ins_right { 214 | function() return '▊' end, 215 | color = {fg = colors.blue}, 216 | right_padding = 0 217 | } 218 | 219 | -- Now don't forget to initialize lualine 220 | lualine.setup(config) 221 | EOF 222 | -------------------------------------------------------------------------------- /config/plugins/lush.nvim.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgheng/vime/18a361af51408298ddfdd2cb139ebbaa44a45216/config/plugins/lush.nvim.vim -------------------------------------------------------------------------------- /config/plugins/ncm2.vim: -------------------------------------------------------------------------------- 1 | " enable ncm2 for all buffers 2 | autocmd BufEnter * call ncm2#enable_for_buffer() 3 | 4 | " IMPORTANT: :help Ncm2PopupOpen for more information 5 | set completeopt=noinsert,menuone,noselect 6 | 7 | " suppress the annoying 'match x of y', 'The only match' and 'Pattern not 8 | " found' messages 9 | set shortmess+=c 10 | 11 | " CTRL-C doesn't trigger the InsertLeave autocmd . map to instead. 12 | inoremap 13 | 14 | " When the key is pressed while the popup menu is visible, it only 15 | " hides the menu. Use this mapping to close the menu and also start a new 16 | " line. 17 | inoremap (pumvisible() ? "\\" : "\") 18 | 19 | " Use to select the popup menu: 20 | inoremap pumvisible() ? "\" : "\" 21 | inoremap pumvisible() ? "\" : "\" 22 | 23 | " wrap existing omnifunc 24 | " Note that omnifunc does not run in background and may probably block the 25 | " editor. If you don't want to be blocked by omnifunc too often, you could 26 | " add 180ms delay before the omni wrapper: 27 | " 'on_complete': ['ncm2#on_complete#delay', 180, 28 | " \ 'ncm2#on_complete#omni', 'csscomplete#CompleteCSS'], 29 | au User Ncm2Plugin call ncm2#register_source({ 30 | \ 'name' : 'css', 31 | \ 'priority': 9, 32 | \ 'subscope_enable': 1, 33 | \ 'scope': ['css','scss'], 34 | \ 'mark': 'css', 35 | \ 'word_pattern': '[\w\-]+', 36 | \ 'complete_pattern': ':\s*', 37 | \ 'on_complete': ['ncm2#on_complete#omni', 'csscomplete#CompleteCSS'], 38 | \ }) 39 | let g:ncm2_jedi#python_version=3 40 | -------------------------------------------------------------------------------- /config/plugins/neoformat.vim: -------------------------------------------------------------------------------- 1 | 2 | augroup vime_neoformat_group 3 | " 保存时自动格式化 4 | autocmd! 5 | autocmd BufWritePre * undojoin | Neoformat 6 | augroup END 7 | 8 | command! -nargs=0 Format exec 'Neoformat' 9 | -------------------------------------------------------------------------------- /config/plugins/nerdcommenter.vim: -------------------------------------------------------------------------------- 1 | let g:NERDSpaceDelims = 1 2 | let g:NERDToggleCheckAllLines = 1 3 | -------------------------------------------------------------------------------- /config/plugins/nerdtree.vim: -------------------------------------------------------------------------------- 1 | let NERDTreeMinimalUI = 1 " 最小化显示,不显示问号 2 | let NERDTreeDirArrows = 1 3 | let NERDChristmasTree = 1 4 | 5 | " nerdtree的git插件 6 | if common#functions#HasPlug('nerdtree-git-plugin') 7 | let g:NERDTreeGitStatusIndicatorMapCustom = { 8 | \ "Modified" : "✹", 9 | \ "Staged" : "✚", 10 | \ "Untracked" : "✭", 11 | \ "Renamed" : "➜", 12 | \ "Unmerged" : "═", 13 | \ "Deleted" : "✖", 14 | \ "Dirty" : "✗", 15 | \ "Clean" : "✔︎", 16 | \ 'Ignored' : '☒', 17 | \ "Unknown" : "?" 18 | \ } 19 | endif 20 | 21 | " 如果使用vim-plug的话,加上这一句可以避免光标在nerdtree 22 | " 中的时候进行插件升级而导致nerdtree崩溃 23 | let g:plug_window = 'noautocmd vertical topleft new' 24 | " 在nerdtree中删除文件之后,自动删除vim中相应的buffer 25 | let NERDTreeAutoDeleteBuffer = 1 26 | " 进入目录自动将workspace更改为此目录 27 | let g:NERDTreeChDirMode = 2 28 | 29 | function! s:NERDTreeCustomCROpen(node) abort 30 | let l:newRoot = a:node.GetSelected() 31 | 32 | if l:newRoot.path.isDirectory 33 | call b:NERDTree.changeRoot(l:newRoot) 34 | else 35 | call l:newRoot.activate({'reuse': 'all', 'where': 'p'}) 36 | endif 37 | endfunction 38 | 39 | function! NERDTreeYankCurrentNode(node) 40 | " let n = g:NERDTreeFileNode.GetSelected() 41 | let l:s = a:node.GetSelected() 42 | if l:s != {} 43 | call setreg('"', l:s.path.str()) 44 | endif 45 | endfunction 46 | 47 | " 自定义快捷键 48 | map :NERDTreeFocus 49 | " 水平或者垂直窗口打开 50 | let g:NERDTreeMapOpenSplit = "w" 51 | let g:NERDTreeMapOpenVSplit = "W" 52 | " 展开与关闭节点或者打开文件 53 | let g:NERDTreeMapActivateNode = 'l' 54 | let g:NERDTreeMapOpenRecursively = 'L' 55 | let g:NERDTreeMapCloseDir = 'h' 56 | " 显示隐藏文件 57 | let g:NERDTreeMapToggleHidden = '.' 58 | " 回到上一级目录 59 | let g:NERDTreeMapUpdirKeepOpen = '' 60 | " 在新的tab打开 61 | let g:NERDTreeMapOpenInTab = 't' 62 | " 在节点之间跳转,无效 63 | let g:NERDTreeMapJumpNextSibling = 'J' 64 | let g:NERDTreeMapJumpPrevSibling = 'K' 65 | 66 | augroup vime_nerdtree_group 67 | autocmd! 68 | " 只有一个窗口和nerdtree的时候,退出窗口即退出vim而不保留nerdtree 69 | autocmd BUFENTER * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif 70 | 71 | " 避免在nerdtree中打开文件 72 | autocmd BufEnter * if bufname('#') =~# "^NERD_tree_" && winnr('$') > 1 | b# | endif 73 | 74 | autocmd FileType nerdtree nmap bb 75 | 76 | " 自定义打开目录操作 77 | " TODO 如何直接定义作为快捷键? 78 | autocmd VimEnter * call NERDTreeAddKeyMap({ 79 | \ 'key': 'bb', 80 | \ 'callback': function('NERDTreeCustomCROpen'), 81 | \ 'quickhelpText': 'go to dir and change cwd to it or open a file', 82 | \ 'scope': 'Node', 83 | \ 'override': 1, 84 | \ }) 85 | 86 | " 复制路径 87 | autocmd VimEnter * call NERDTreeAddKeyMap({ 88 | \ 'key': 'yp', 89 | \ 'callback': 'NERDTreeYankCurrentNode', 90 | \ 'quickhelpText': 'put full path of current node into the default register', 91 | \ 'scope': 'Node', 92 | \ 'override': 1, 93 | \ }) 94 | augroup END 95 | -------------------------------------------------------------------------------- /config/plugins/nnn.vim.vim: -------------------------------------------------------------------------------- 1 | " Disable default mappings 2 | let g:nnn#set_default_mappings = 0 3 | 4 | " Then set your own 5 | "nnoremap :NnnPicker 6 | 7 | " Start nnn in the current file's directory 8 | nnoremap :NnnPicker '%:p:h' 9 | 10 | " Opens the nnn window in a split 11 | "let g:nnn#layout = 'new' " or vnew, tabnew etc. 12 | "" Or pass a dictionary with window size 13 | "let g:nnn#layout = { 'left': '~20%' } " or right, up, down 14 | -------------------------------------------------------------------------------- /config/plugins/nvim-bufferline.lua.vim: -------------------------------------------------------------------------------- 1 | set termguicolors 2 | 3 | lua << EOF 4 | require'bufferline'.setup{ 5 | options = { 6 | view = "multiwindow", 7 | numbers = "buffer_id", 8 | number_style = "superscript", 9 | mappings = true, 10 | buffer_close_icon= '', 11 | modified_icon = '●', 12 | close_icon = '', 13 | left_trunc_marker = '', 14 | right_trunc_marker = '', 15 | max_name_length = 18, 16 | max_prefix_length = 15, -- prefix used when a buffer is deduplicated 17 | tab_size = 18, 18 | diagnostics = "nvim_lsp", 19 | -- diagnostics_indicator = function(count, level) 20 | -- return "("..count..")" 21 | -- end, 22 | show_buffer_close_icons = true, 23 | persist_buffer_sort = true, -- whether or not custom sorted buffers should persist 24 | -- can also be a table containing 2 custom separators 25 | -- [focused and unfocused]. eg: { '|', '|' } 26 | separator_style = "slant", 27 | enforce_regular_tabs = true, 28 | always_show_bufferline = true, 29 | sort_by = 'relative_directory', 30 | 31 | diagnostics_indicator = function(_, _, diagnostics_dict) 32 | local s = " " 33 | for e, n in pairs(diagnostics_dict) do 34 | local sym = e == "error" and " " 35 | or (e == "warning" and " " or "" ) 36 | s = s .. n .. sym 37 | end 38 | return s 39 | end 40 | } 41 | } 42 | EOF 43 | 44 | nnoremap :BufferLineCycleNext 45 | nnoremap :BufferLineCyclePrev 46 | tnoremap :BufferLineCycleNext 47 | tnoremap :BufferLineCyclePrev 48 | 49 | " These commands will move the current buffer backwards or forwards in the bufferline 50 | nnoremap :BufferLineMoveNext 51 | nnoremap :BufferLineMovePrev 52 | tnoremap :BufferLineMoveNext 53 | tnoremap :BufferLineMovePrev 54 | 55 | nnoremap gb :BufferLinePick 56 | -------------------------------------------------------------------------------- /config/plugins/nvim-colorizer.lua.vim: -------------------------------------------------------------------------------- 1 | if has('termguicolors') 2 | set termguicolors 3 | else 4 | finish 5 | endif 6 | 7 | lua << EOF 8 | 9 | require'colorizer'.setup() 10 | 11 | EOF 12 | -------------------------------------------------------------------------------- /config/plugins/nvim-compe.vim: -------------------------------------------------------------------------------- 1 | set completeopt=menu,menuone,noselect 2 | 3 | let g:compe = {} 4 | let g:compe.enabled = v:true 5 | let g:compe.autocomplete = v:true 6 | let g:compe.debug = v:false 7 | let g:compe.min_length = 1 8 | let g:compe.preselect = 'enable' 9 | let g:compe.throttle_time = 80 10 | let g:compe.source_timeout = 200 11 | let g:compe.incomplete_delay = 400 12 | let g:compe.max_abbr_width = 100 13 | let g:compe.max_kind_width = 100 14 | let g:compe.max_menu_width = 100 15 | let g:compe.documentation = v:true 16 | 17 | let g:compe.source = {} 18 | let g:compe.source.path = v:true 19 | let g:compe.source.buffer = v:true 20 | let g:compe.source.calc = v:true 21 | let g:compe.source.vsnip = v:true 22 | let g:compe.source.nvim_lsp = v:true 23 | let g:compe.source.nvim_lua = v:true 24 | let g:compe.source.spell = v:true 25 | let g:compe.source.tags = v:true 26 | let g:compe.source.snippets_nvim = v:true 27 | let g:compe.source.treesitter = v:true 28 | 29 | 30 | -------------------------------------------------------------------------------- /config/plugins/nvim-lsp.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgheng/vime/18a361af51408298ddfdd2cb139ebbaa44a45216/config/plugins/nvim-lsp.vim -------------------------------------------------------------------------------- /config/plugins/nvim-lspconfig.vim: -------------------------------------------------------------------------------- 1 | if !exist("g:lspconfig") 2 | finish 3 | endif 4 | 5 | lua << EOF 6 | -- clangd 7 | require'lspconfig'.clangd.setup{ 8 | cmd = {"clangd", "--background-index"}, 9 | filetypes = { "c", "cpp", "objc", "objcpp" }, 10 | -- root_dir = root_pattern("compile_commands.json", "compile_flags.txt", ".git") 11 | } 12 | EOF 13 | -------------------------------------------------------------------------------- /config/plugins/nvim-scrollview.vim: -------------------------------------------------------------------------------- 1 | " 只在当前窗口显示 2 | let g:scrollview_current_only = 1 3 | let g:scrollview_winblend = 50 4 | " 让滚动条与高亮列重合 5 | " let g:scrollview_base = 'buffer' 6 | " let g:scrollview_column = 80 7 | 8 | highlight ScrollView ctermbg=159 guibg=LightCyan 9 | 10 | " augroup vime_nvim_scrollview 11 | " autocmd! 12 | " autocmd WinClosed * ScrollViewRefresh 13 | " augroup END 14 | -------------------------------------------------------------------------------- /config/plugins/nvim-tree.lua.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | local tree_cb = require'nvim-tree.config'.nvim_tree_callback 3 | -- following options are the default 4 | require'nvim-tree'.setup { 5 | -- disables netrw completely 6 | disable_netrw = true, 7 | -- hijack netrw window on startup 8 | hijack_netrw = true, 9 | -- open the tree when running this setup function 10 | open_on_setup = false, 11 | -- will not open on setup if the filetype is in this list 12 | ignore_ft_on_setup = {}, 13 | -- closes neovim automatically when the tree is the last **WINDOW** in the view 14 | auto_close = false, 15 | -- opens the tree when changing/opening a new tab if the tree wasn't previously opened 16 | open_on_tab = false, 17 | -- hijacks new directory buffers when they are opened. 18 | update_to_buf_dir = { 19 | enable = true, 20 | auto_open = true, 21 | }, 22 | -- hijack the cursor in the tree to put it at the start of the filename 23 | hijack_cursor = false, 24 | -- updates the root directory of the tree on `DirChanged` (when your run `:cd` usually) 25 | update_cwd = true, 26 | -- update the focused file on `BufEnter`, un-collapses the folders recursively until it finds the file 27 | update_focused_file = { 28 | -- enables the feature 29 | enable = true, 30 | -- update the root directory of the tree to the one of the folder containing the file if the file is not under the current root directory 31 | -- only relevant when `update_focused_file.enable` is true 32 | update_cwd = false, 33 | -- list of buffer names / filetypes that will not update the cwd if the file isn't found under the current root directory 34 | -- only relevant when `update_focused_file.update_cwd` is true and `update_focused_file.enable` is true 35 | ignore_list = {} 36 | }, 37 | -- configuration options for the system open command (`s` in the tree by default) 38 | system_open = { 39 | -- the command to run this, leaving nil should work in most cases 40 | cmd = "xdg-open", 41 | -- the command arguments as a list 42 | args = {} 43 | }, 44 | filters = { 45 | -- hides files and folders starting with a dot `.` 46 | dotfiles = true, 47 | custom = {} 48 | }, 49 | 50 | view = { 51 | -- width of the window, can be either a number (columns) or a string in `%` 52 | width = 40, 53 | -- side of the tree, can be one of 'left' | 'right' | 'top' | 'bottom' 54 | side = 'left', 55 | -- if true the tree will resize itself after opening a file 56 | auto_resize = false, 57 | mappings = { 58 | -- custom only false will merge the list with the default mappings 59 | -- if true, it will only use your list to set the mappings 60 | custom_only = false, 61 | -- list of mappings to set on the tree manually 62 | list = { 63 | { key = {"", "o", "<2-LeftMouse>", "l"}, cb = tree_cb("edit") }, 64 | { key = {"<2-RightMouse>", ""}, cb = tree_cb("cd") }, 65 | { key = "", cb = tree_cb("vsplit") }, 66 | { key = "", cb = tree_cb("split") }, 67 | { key = "", cb = tree_cb("tabnew") }, 68 | { key = "h", cb = tree_cb("close_node") }, 69 | { key = "<", cb = tree_cb("prev_sibling") }, 70 | { key = ">", cb = tree_cb("next_sibling") }, 71 | { key = "", cb = tree_cb("preview") }, 72 | { key = "K", cb = tree_cb("first_sibling") }, 73 | { key = "J", cb = tree_cb("last_sibling") }, 74 | { key = "I", cb = tree_cb("toggle_ignored") }, 75 | { key = ".", cb = tree_cb("toggle_dotfiles") }, 76 | { key = "r", cb = tree_cb("refresh") }, 77 | { key = "pp", cb = tree_cb("parent_node") }, 78 | { key = "", cb = tree_cb("close_node") }, 79 | { key = "N", cb = tree_cb("create") }, 80 | { key = "D", cb = tree_cb("remove") }, 81 | { key = "R", cb = tree_cb("rename") }, 82 | -- { key = "", cb = tree_cb("full_rename") }, 83 | { key = "dd", cb = tree_cb("cut") }, 84 | { key = "yy", cb = tree_cb("copy") }, 85 | { key = "Y", cb = tree_cb("copy_path") }, 86 | { key = "y", cb = tree_cb("copy_name") }, 87 | { key = "gy", cb = tree_cb("copy_absolute_path") }, 88 | { key = "P", cb = tree_cb("paste") }, 89 | { key = "gk", cb = tree_cb("prev_git_item") }, 90 | { key = "gj", cb = tree_cb("next_git_item") }, 91 | { key = "", cb = tree_cb("dir_up") }, 92 | { key = "q", cb = tree_cb("close") }, 93 | { key = "?", cb = tree_cb("toggle_help") }, 94 | { key = "", cb = tree_cb("vsplit") }, 95 | { key = "", cb = tree_cb("split") }, 96 | { key = "", cb = tree_cb("tabnew") }, 97 | { key = "x", cb = tree_cb("system_open") }, 98 | } 99 | } 100 | } 101 | } 102 | EOF 103 | 104 | " let g:nvim_tree_ignore = [ '.git', 'node_modules', '.cache' ] " empty by default 105 | " let g:nvim_tree_gitignore = 1 " 0 by default 106 | " let g:nvim_tree_quit_on_open = 0 " 0 by default, closes the tree when you open a file 107 | " let g:nvim_tree_indent_markers = 1 " 0 by default, this option shows indent markers when folders are open 108 | let g:nvim_tree_git_hl = 1 " 0 by default, will enable file highlight for git attributes (can be used without the icons). 109 | let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories. 110 | let g:nvim_tree_root_folder_modifier = ':~' "This is the default. See :help filename-modifiers for more options 111 | let g:nvim_tree_add_trailing = 1 "0 by default, append a trailing slash to folder names 112 | let g:nvim_tree_group_empty = 1 " 0 by default, compact folders that only contain a single folder into one node in the file tree 113 | let g:nvim_tree_disable_window_picker = 1 "0 by default, will disable the window picker. 114 | let g:nvim_tree_icon_padding = ' ' "one space by default, used for rendering the space between the icon and the filename. Use with caution, it could break rendering if you set an empty string depending on your font. 115 | " let g:nvim_tree_symlink_arrow = ' >> ' " defaults to ' ➛ '. used as a separator between symlinks' source and target. 116 | let g:nvim_tree_respect_buf_cwd = 1 "0 by default, will change cwd of nvim-tree to that of new buffer's when opening nvim-tree. 117 | let g:nvim_tree_create_in_closed_folder = 0 "1 by default, When creating files, sets the path of a file when cursor is on a closed folder to the parent folder when 0, and inside the folder when 1. 118 | " let g:nvim_tree_refresh_wait = 500 "1000 by default, control how often the tree can be refreshed, 1000 means the tree can be refresh once per 1000ms. 119 | let g:nvim_tree_window_picker_exclude = { 120 | \ 'filetype': [ 121 | \ 'notify', 122 | \ 'packer', 123 | \ 'qf' 124 | \ ], 125 | \ 'buftype': [ 126 | \ 'terminal' 127 | \ ] 128 | \ } 129 | " Dictionary of buffer option names mapped to a list of option values that 130 | " indicates to the window picker that the buffer's window should not be 131 | " selectable. 132 | let g:nvim_tree_special_files = { 'README.md': 1, 'Makefile': 1, 'MAKEFILE': 1, 'readme.md': 1} " List of filenames that gets highlighted with NvimTreeSpecialFile 133 | let g:nvim_tree_show_icons = { 134 | \ 'git': 1, 135 | \ 'folders': 1, 136 | \ 'files': 1, 137 | \ 'folder_arrows': 1, 138 | \ } 139 | "If 0, do not show the icons for one of 'git' 'folder' and 'files' 140 | "1 by default, notice that if 'files' is 1, it will only display 141 | "if nvim-web-devicons is installed and on your runtimepath. 142 | "if folder is 1, you can also tell folder_arrows 1 to show small arrows next to the folder icons. 143 | "but this will not work when you set indent_markers (because of UI conflict) 144 | 145 | " default will show icon by default if no icon is provided 146 | " default shows no icon by default 147 | let g:nvim_tree_icons = { 148 | \ 'default': '', 149 | \ 'symlink': '', 150 | \ 'git': { 151 | \ 'unstaged': "✗", 152 | \ 'staged': "✓", 153 | \ 'unmerged': "", 154 | \ 'renamed': "➜", 155 | \ 'untracked': "★", 156 | \ 'deleted': "", 157 | \ 'ignored': "◌" 158 | \ }, 159 | \ 'folder': { 160 | \ 'arrow_open': "", 161 | \ 'arrow_closed': "", 162 | \ 'default': "", 163 | \ 'open': "", 164 | \ 'empty': "", 165 | \ 'empty_open': "", 166 | \ 'symlink': "", 167 | \ 'symlink_open': "", 168 | \ }, 169 | \ 'lsp': { 170 | \ 'hint': "", 171 | \ 'info': "", 172 | \ 'warning': "", 173 | \ 'error': "", 174 | \ } 175 | \ } 176 | 177 | nnoremap :NvimTreeToggle 178 | " NvimTreeOpen, NvimTreeClose, NvimTreeFocus and NvimTreeResize are also available if you need them 179 | 180 | set termguicolors " this variable must be enabled for colors to be applied properly 181 | 182 | " a list of groups can be found at `:help nvim_tree_highlight` 183 | highlight NvimTreeFolderIcon guibg=blue 184 | -------------------------------------------------------------------------------- /config/plugins/nvim-treesitter-refactor.vim: -------------------------------------------------------------------------------- 1 | lua <a"] = "@parameter.inner", 50 | }, 51 | swap_previous = { 52 | ["A"] = "@parameter.inner", 53 | }, 54 | }, 55 | 56 | 57 | move = { 58 | enable = true, 59 | goto_next_start = { 60 | ["]m"] = "@function.outer", 61 | ["]]"] = "@class.outer", 62 | }, 63 | goto_next_end = { 64 | ["]M"] = "@function.outer", 65 | ["]["] = "@class.outer", 66 | }, 67 | goto_previous_start = { 68 | ["[m"] = "@function.outer", 69 | ["[["] = "@class.outer", 70 | }, 71 | goto_previous_end = { 72 | ["[M"] = "@function.outer", 73 | ["[]"] = "@class.outer", 74 | }, 75 | }, 76 | 77 | lsp_interop = { 78 | enable = false, 79 | peek_definition_code = { 80 | ["df"] = "@function.outer", 81 | ["dF"] = "@class.outer", 82 | }, 83 | }, 84 | }, 85 | } 86 | EOF 87 | -------------------------------------------------------------------------------- /config/plugins/nvim-treesitter.vim: -------------------------------------------------------------------------------- 1 | " set foldmethod=expr 2 | " set foldexpr=nvim_treesitter#foldexpr() 3 | 4 | lua << EOF 5 | require'nvim-treesitter.configs'.setup { 6 | -- 解析器的安装,all全部安装 7 | ensure_installed = 'maintained', -- one of 'all', 'language', or a list of languages 8 | 9 | -- 高亮配置 10 | highlight = { 11 | enable = true, -- false将禁用整个插件 12 | disable = {}, -- 不使用该插件的语言 13 | custom_captures = { -- 自定义高亮组 14 | -- ["foo.bar"] = "Identifier" 15 | }, 16 | }, 17 | 18 | -- 块选择,还不太会使用,暂时保留 19 | incremental_selection = { 20 | enable = true, 21 | disable = {}, 22 | keymaps = { -- mappings for incremental selection (visual mappings) 23 | init_selection = 'gnn', -- maps in normal mode to init the node/scope selection 24 | node_incremental = "grn", -- increment to the upper named parent 25 | scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm) 26 | node_decremental = "grm", -- decrement to the previous node 27 | } 28 | }, 29 | 30 | -- indent 31 | indent = { 32 | enable = false 33 | }, 34 | 35 | -- rainbow 36 | rainbow = { 37 | enable = true, 38 | disable = {'bash'} 39 | } 40 | 41 | } 42 | EOF 43 | 44 | " treesitter经常在进行一些操作之后丢失渲染,比如撤销操作等 45 | " 使用下面的命令可以恢复 46 | " function s:render() abort 47 | " exec "write | edit | TSBufEnable highlight" 48 | " endfunc 49 | " nmap :call render() 50 | -------------------------------------------------------------------------------- /config/plugins/nvim-ts-rainbow.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | 3 | require'nvim-treesitter.configs'.setup { 4 | rainbow = { 5 | enable = true, 6 | extended_mode = true, -- Highlight also non-parentheses delimiters, boolean or table: lang -> boolean 7 | } 8 | } 9 | 10 | EOF 11 | -------------------------------------------------------------------------------- /config/plugins/nvimux.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | local nvimux = require('nvimux') 3 | 4 | -- Nvimux configuration 5 | nvimux.config.set_all{ 6 | prefix = '', 7 | new_window = 'enew', -- Use 'term' if you want to open a new term for every new window 8 | new_tab = nil, -- Defaults to new_window. Set to 'term' if you want a new term for every new tab 9 | new_window_buffer = 'single', 10 | quickterm_direction = 'botright', 11 | quickterm_orientation = 'vertical', 12 | quickterm_scope = 't', -- Use 'g' for global quickterm 13 | quickterm_size = '80', 14 | } 15 | 16 | -- Nvimux custom bindings 17 | nvimux.bindings.bind_all{ 18 | {'s', ':NvimuxHorizontalSplit', {'n', 'v', 'i', 't'}}, 19 | {'v', ':NvimuxVerticalSplit', {'n', 'v', 'i', 't'}}, 20 | } 21 | 22 | -- Required so nvimux sets the mappings correctly 23 | nvimux.bootstrap() 24 | EOF 25 | -------------------------------------------------------------------------------- /config/plugins/onestatus.vim: -------------------------------------------------------------------------------- 1 | set laststatus=0 2 | set showtabline=2 3 | set noshowmode noruler 4 | 5 | let g:onestatus_config_path = g:other_config_root_path . "onestatus.json" 6 | 7 | fun g:LineNow() 8 | let l:lineCur = line('.') 9 | let l:lineTotal = line('$') 10 | return l:lineCur . "/" . l:lineTotal 11 | endfunc 12 | 13 | augroup vime_onestatus_group 14 | au! 15 | au BufEnter * :OneStatus 16 | au CursorMoved * :OneStatus 17 | exec 'au ExitPre * :!tmux source ' . g:tmux_config_path 18 | augroup END 19 | -------------------------------------------------------------------------------- /config/plugins/open-browser.vim.vim: -------------------------------------------------------------------------------- 1 | " 覆盖默认的gx 2 | nmap gx (openbrowser-smart-search) 3 | xmap gx (openbrowser-smart-search) 4 | -------------------------------------------------------------------------------- /config/plugins/pear-tree.vim: -------------------------------------------------------------------------------- 1 | let g:pear_tree_smart_openers = 1 2 | let g:pear_tree_smart_closers = 1 3 | let g:pear_tree_smart_backspace = 1 4 | 5 | let g:pear_tree_repeatable_expand = 0 6 | let g:pear_tree_map_special_keys = 1 7 | -------------------------------------------------------------------------------- /config/plugins/playground.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | require "nvim-treesitter.configs".setup { 3 | playground = { 4 | enable = false, 5 | disable = {}, 6 | updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code 7 | persist_queries = false -- Whether the query persists across vim sessions 8 | } 9 | } 10 | EOF 11 | -------------------------------------------------------------------------------- /config/plugins/powerline.vim.vim: -------------------------------------------------------------------------------- 1 | "set guifont=PowerlineSymbols\ for\ Powerline 2 | "set nocompatible 3 | "set t_Co=256 4 | "let g:Powerline_symbols = 'fancy' 5 | -------------------------------------------------------------------------------- /config/plugins/quick-scope.vim: -------------------------------------------------------------------------------- 1 | " 按下下面的这些按键触发查询高亮 2 | let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] 3 | 4 | " 自定义颜色 5 | augroup vime_qs_colors_group 6 | autocmd! 7 | autocmd ColorScheme * highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline 8 | autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline 9 | augroup END 10 | -------------------------------------------------------------------------------- /config/plugins/rainbow.vim: -------------------------------------------------------------------------------- 1 | let g:rainbow_active = 1 2 | 3 | let g:rainbow_conf = { 4 | \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'], 5 | \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta'], 6 | \ 'operators': '_,_', 7 | \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], 8 | \ 'separately': { 9 | \ '*': {}, 10 | \ 'tex': { 11 | \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'], 12 | \ }, 13 | \ 'lisp': { 14 | \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'], 15 | \ }, 16 | \ 'vim': { 17 | \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'], 18 | \ }, 19 | \ 'html': { 20 | \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold'], 21 | \ }, 22 | \ 'css': 0, 23 | \ } 24 | \} 25 | 26 | " 'guifgs': 一个guifg的列表 (:h highlight-guifg), 即GUI界面的括号颜色, 将按顺序循环使用 27 | " 'guis': 一个gui的列表 (:h highlight-gui), 将按顺序循环使用 28 | " 'ctermfgs': 一个ctermfg的列表 (:h highlight-ctermfg), 即终端下的括号颜色 29 | " 'cterms': 一个cterm的列表 (:h highlight-cterm) 30 | " 'operators': 描述你希望哪些运算符跟着与它同级的括号一起高亮(注意:留意需要转义的特殊字符,更多样例见这里, 你也可以读vim帮助 :syn-pattern) 31 | " 'parentheses': 一个关于括号定义的列表, 每一个括号的定义包含形如以下的部分: start=/(/, step=/,/, stop=/)/, fold, contained, containedin=someSynNames, contains=@Spell. 各个部分具体含义可参考 :h syntax, 其中 step 为本插件的扩展定义, 表示括号中间需要高亮的运算符. 32 | " 'separately': 针对文件类型(由&ft决定)作不同的配置,未被单独设置的文件类型使用*下的配置,值为0表示仅对该类型禁用插件,值为"default"表示使用针对该类型的默认兼容配置 (注意, 默认兼容配置可能随着该插件版本的更新而改变, 如果你不希望它改变, 那么你应该将它拷贝一份放到你的vimrc文件里). 33 | " 省略某个字段以使用默认设置 34 | 35 | " let g:rainbow_conf = { 36 | " \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick'], 37 | " \ 'ctermfgs': ['lightblue', 'lightyellow', 'lightcyan', 'lightmagenta', 'orange'], 38 | " \ 'operators': '_,_', 39 | " \ 'parentheses': ['start=/(/ end=/)/ fold', 'start=/\[/ end=/\]/ fold', 'start=/{/ end=/}/ fold'], 40 | " \ 'separately': { 41 | " \ '*': {}, 42 | " \ 'tex': { 43 | " \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/'], 44 | " \ }, 45 | " \ 'lisp': { 46 | " \ 'guifgs': ['royalblue3', 'darkorange3', 'seagreen3', 'firebrick', 'darkorchid3'], 47 | " \ }, 48 | " \ 'vim': { 49 | " \ 'parentheses': ['start=/(/ end=/)/', 'start=/\[/ end=/\]/', 'start=/{/ end=/}/ fold', 'start=/(/ end=/)/ containedin=vimFuncBody', 'start=/\[/ end=/\]/ containedin=vimFuncBody', 'start=/{/ end=/}/ fold containedin=vimFuncBody'], 50 | " \ }, 51 | " \ 'html': { 52 | " \ 'parentheses': ['start=/\v\<((area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)[ >])@!\z([-_:a-zA-Z0-9]+)(\s+[-_:a-zA-Z0-9]+(\=("[^"]*"|'."'".'[^'."'".']*'."'".'|[^ '."'".'"><=`]*))?)*\>/ end=## fold'], 53 | " \ }, 54 | " \ 'css': 0, 55 | " \ } 56 | " \} 57 | -------------------------------------------------------------------------------- /config/plugins/ranger.vim.vim: -------------------------------------------------------------------------------- 1 | " let g:ranger_map_keys = 0 " 取消默认的leader f 2 | 3 | let g:NERDTreeHijackNetrw = 0 4 | let g:ranger_replace_netrw = 1 5 | 6 | " 显示隐藏文件 7 | let ranger_command_override = 'ranger --cmd "set show_hidden=true"' 8 | noremap f :RangerCurrentFile 9 | " noremap w :RangerWorkingDirectory 10 | -------------------------------------------------------------------------------- /config/plugins/rust.vim.vim: -------------------------------------------------------------------------------- 1 | 2 | let g:rustfmt_autosave = 1 " rust 保存时自动格式化 3 | 4 | -------------------------------------------------------------------------------- /config/plugins/semshi.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgheng/vime/18a361af51408298ddfdd2cb139ebbaa44a45216/config/plugins/semshi.vim -------------------------------------------------------------------------------- /config/plugins/spaceline.vim.vim: -------------------------------------------------------------------------------- 1 | let g:spaceline_seperate_style= 'curve' "可选 slant-fade none arrow arrow-fade curve slant 2 | let g:spaceline_line_symbol = 0 " 1 不显示太多信息 3 | let g:spaceline_colorscheme = "space" " 主题 4 | 5 | " let g:spaceline_custom_vim_status = { 6 | " \ "n": "N", 7 | " \ "V":"V", 8 | " \ "v":"v", 9 | " \ "\": "C-V", 10 | " \ "i":"I","R":"🅡 ","s":"🅢 ","t":"🅣 ","c":"🅒 ","!":"SE"} 11 | -------------------------------------------------------------------------------- /config/plugins/tagbar.vim: -------------------------------------------------------------------------------- 1 | if common#functions#HasPlug('tagbar') 2 | let g:tagbar_width = 35 3 | function! Tagbar_Toggle() 4 | let a:bufnr = bufnr('__vista__') 5 | let a:bufwinnr = bufwinnr(a:bufnr) 6 | 7 | " 如果存在这个buf 8 | if a:bufnr > -1 9 | " 如果正在窗口中显示 10 | if a:bufwinnr > -1 11 | " 如果当前在这个窗口这里 12 | if winnr() == a:bufwinnr 13 | " 关闭 14 | exe "TagbarClose" 15 | else 16 | " 跳转过去 17 | exe a:bufwinnr . " wincmd w" 18 | endif 19 | else 20 | exe "TagbarOpen" 21 | endif 22 | else 23 | exe "TagbarOpen" 24 | "let s:tagNr = bufnr('__Tagbar__') 25 | "let s:tagNa = bufname('__Tagbar__') 26 | endif 27 | endfunction 28 | 29 | nnoremap :call Tagbar_Toggle() 30 | "nnoremap :TagbarToggle 31 | endif 32 | -------------------------------------------------------------------------------- /config/plugins/telescope.nvim.vim: -------------------------------------------------------------------------------- 1 | 2 | lua << EOF 3 | require('telescope').setup{ 4 | defaults = { 5 | vimgrep_arguments = { 6 | 'rg', 7 | '--color=never', 8 | '--no-heading', 9 | '--with-filename', 10 | '--line-number', 11 | '--column', 12 | '--smart-case' 13 | }, 14 | prompt_prefix = "> ", 15 | selection_caret = "> ", 16 | entry_prefix = " ", 17 | initial_mode = "insert", 18 | selection_strategy = "reset", 19 | sorting_strategy = "descending", 20 | layout_strategy = "horizontal", 21 | layout_config = { 22 | horizontal = { 23 | mirror = false, 24 | }, 25 | vertical = { 26 | mirror = false, 27 | }, 28 | }, 29 | file_sorter = require'telescope.sorters'.get_fuzzy_file, 30 | file_ignore_patterns = {}, 31 | generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter, 32 | winblend = 0, 33 | border = {}, 34 | borderchars = { '─', '│', '─', '│', '╭', '╮', '╯', '╰' }, 35 | color_devicons = true, 36 | use_less = true, 37 | path_display = {}, 38 | set_env = { ['COLORTERM'] = 'truecolor' }, -- default = nil, 39 | file_previewer = require'telescope.previewers'.vim_buffer_cat.new, 40 | grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, 41 | qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, 42 | } 43 | } 44 | EOF 45 | " Find files using Telescope command-line sugar. 46 | nnoremap Telescope find_files theme=get_dropdown 47 | nnoremap Telescope live_grep theme=get_dropdown 48 | nnoremap Telescope buffers theme=get_dropdown 49 | nnoremap Telescope help_tags theme=get_dropdown 50 | -------------------------------------------------------------------------------- /config/plugins/tex-conceal.vim.vim: -------------------------------------------------------------------------------- 1 | let g:tex_superscripts= "[0-9a-zA-W.,:;+-<>/()=]" 2 | let g:tex_subscripts= "[0-9aehijklmnoprstuvx,+-/().]" 3 | let g:tex_conceal_frac=1 4 | 5 | augroup vime_vimtex_group 6 | autocmd! 7 | autocmd FileType tex setl conceallevel=2 8 | augroup END 9 | -------------------------------------------------------------------------------- /config/plugins/tlr.vim.vim: -------------------------------------------------------------------------------- 1 | " 该插件有点bug 2 | nmap (tlr-down) 3 | nmap (tlr-up) 4 | nmap (tlr-left) 5 | nmap (tlr-right) 6 | -------------------------------------------------------------------------------- /config/plugins/tmuxline.vim.vim: -------------------------------------------------------------------------------- 1 | " 让tmux的状态栏与vim一致 2 | execute "Tmuxline" 3 | -------------------------------------------------------------------------------- /config/plugins/traces.vim.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgheng/vime/18a361af51408298ddfdd2cb139ebbaa44a45216/config/plugins/traces.vim.vim -------------------------------------------------------------------------------- /config/plugins/ultisnips.vim: -------------------------------------------------------------------------------- 1 | let g:UltiSnipsSnippetsDir = g:plugins_install_path . '/vim-snippets/' 2 | let g:UltiSnipsSnippetDirectories = ['UltiSnips'] 3 | let g:UltiSnipsJumpForwardTrigger = '' 4 | let g:UltiSnipsJumpBackwardTrigger = '' 5 | let g:UltiSnipsExpandTrigger = '' 6 | -------------------------------------------------------------------------------- /config/plugins/undotree.vim: -------------------------------------------------------------------------------- 1 | 2 | set undofile 3 | set undodir = g:undo_dir 4 | if !exists('g:undotree_WindowLayout') 5 | let g:undotree_WindowLayout = 3 6 | endif 7 | 8 | nnoremap :UndotreeToggle 9 | -------------------------------------------------------------------------------- /config/plugins/vgit.nvim.vim: -------------------------------------------------------------------------------- 1 | lua << EOF 2 | require('vgit').setup({ 3 | debug = false, 4 | hunks_enabled = true, 5 | blames_enabled = true, 6 | diff_preference = 'horizontal', 7 | diff_strategy = 'remote', 8 | predict_hunk_signs = true, 9 | signs = { 10 | VGitViewSignAdd = { 11 | name = 'VGitViewSignAdd', 12 | line_hl = 'VGitViewSignAdd', 13 | text_hl = 'VGitViewTextAdd', 14 | text = '+' 15 | }, 16 | VGitViewSignRemove = { 17 | name = 'VGitViewSignRemove', 18 | line_hl = 'VGitViewSignRemove', 19 | text_hl = 'VGitViewTextRemove', 20 | text = '-' 21 | }, 22 | VGitSignAdd = { 23 | name = 'VGitSignAdd', 24 | text_hl = 'VGitSignAdd', 25 | line_hl = nil, 26 | text = '│' 27 | }, 28 | VGitSignRemove = { 29 | name = 'VGitSignRemove', 30 | text_hl = 'VGitSignRemove', 31 | line_hl = nil, 32 | text = '│' 33 | }, 34 | VGitSignChange = { 35 | name = 'VGitSignChange', 36 | text_hl = 'VGitSignChange', 37 | line_hl = nil, 38 | text = '│' 39 | }, 40 | }, 41 | hls = { 42 | VGitBlame = { 43 | bg = nil, 44 | fg = '#b1b1b1', 45 | }, 46 | VGitDiffAddSign = { 47 | bg = '#3d5213', 48 | fg = nil, 49 | }, 50 | VGitDiffRemoveSign = { 51 | bg = '#4a0f23', 52 | fg = nil, 53 | }, 54 | VGitDiffAddText = { 55 | fg = '#6a8f1f', 56 | bg = '#3d5213', 57 | }, 58 | VGitDiffRemoveText = { 59 | fg = '#a3214c', 60 | bg = '#4a0f23', 61 | }, 62 | VGitHunkAddSign = { 63 | bg = '#3d5213', 64 | fg = nil, 65 | }, 66 | VGitHunkRemoveSign = { 67 | bg = '#4a0f23', 68 | fg = nil, 69 | }, 70 | VGitHunkAddText = { 71 | fg = '#6a8f1f', 72 | bg = '#3d5213', 73 | }, 74 | VGitHunkRemoveText = { 75 | fg = '#a3214c', 76 | bg = '#4a0f23', 77 | }, 78 | VGitHunkSignAdd = { 79 | fg = '#d7ffaf', 80 | bg = '#4a6317', 81 | }, 82 | VGitHunkSignRemove = { 83 | fg = '#e95678', 84 | bg = '#63132f', 85 | }, 86 | VGitSignAdd = { 87 | fg = '#d7ffaf', 88 | bg = nil, 89 | }, 90 | VGitSignChange = { 91 | fg = '#7AA6DA', 92 | bg = nil, 93 | }, 94 | VGitSignRemove = { 95 | fg = '#e95678', 96 | bg = nil, 97 | }, 98 | VGitIndicator = { 99 | fg = '#a6e22e', 100 | bg = nil, 101 | }, 102 | VGitBorder = { 103 | fg = '#a1b5b1', 104 | bg = nil, 105 | }, 106 | VGitBorderFocus = { 107 | fg = '#7AA6DA', 108 | bg = nil, 109 | }, 110 | }, 111 | blame = { 112 | hl = 'VGitBlame', 113 | window = { 114 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 115 | border_hl = 'VGitBorder', 116 | }, 117 | format = function(blame, git_config) 118 | local function round(x) 119 | return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5) 120 | end 121 | local config_author = git_config['user.name'] 122 | local author = blame.author 123 | if config_author == author then 124 | author = 'You' 125 | end 126 | local time = os.difftime(os.time(), blame.author_time) / (24 * 60 * 60) 127 | local time_format = string.format('%s days ago', round(time)) 128 | local time_divisions = { { 24, 'hours' }, { 60, 'minutes' }, { 60, 'seconds' } } 129 | local division_counter = 1 130 | while time < 1 and division_counter ~= #time_divisions do 131 | local division = time_divisions[division_counter] 132 | time = time * division[1] 133 | time_format = string.format('%s %s ago', round(time), division[2]) 134 | division_counter = division_counter + 1 135 | end 136 | local commit_message = blame.commit_message 137 | if not blame.committed then 138 | author = 'You' 139 | commit_message = 'Uncommitted changes' 140 | local info = string.format('%s • %s', author, commit_message) 141 | return string.format(' %s', info) 142 | end 143 | local max_commit_message_length = 255 144 | if #commit_message > max_commit_message_length then 145 | commit_message = commit_message:sub(1, max_commit_message_length) .. '...' 146 | end 147 | local info = string.format('%s, %s • %s', author, time_format, commit_message) 148 | return string.format(' %s', info) 149 | end 150 | }, 151 | preview = { 152 | priority = 10, 153 | horizontal_window = { 154 | title = 'Preview', 155 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 156 | border_hl = 'VGitBorder', 157 | border_focus_hl = 'VGitBorderFocus' 158 | }, 159 | current_window = { 160 | title = 'Current', 161 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 162 | border_hl = 'VGitBorder', 163 | border_focus_hl = 'VGitBorderFocus' 164 | }, 165 | previous_window = { 166 | title = 'Previous', 167 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 168 | border_hl = 'VGitBorder', 169 | border_focus_hl = 'VGitBorderFocus' 170 | }, 171 | signs = { 172 | add = 'VGitViewSignAdd', 173 | remove = 'VGitViewSignRemove', 174 | }, 175 | }, 176 | history = { 177 | indicator = { 178 | hl = 'VGitIndicator' 179 | }, 180 | horizontal_window = { 181 | title = 'Preview', 182 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 183 | border_hl = 'VGitBorder', 184 | border_focus_hl = 'VGitBorderFocus' 185 | }, 186 | current_window = { 187 | title = 'Current', 188 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 189 | border_hl = 'VGitBorder', 190 | border_focus_hl = 'VGitBorderFocus' 191 | }, 192 | previous_window = { 193 | title = 'Previous', 194 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 195 | border_hl = 'VGitBorder', 196 | border_focus_hl = 'VGitBorderFocus' 197 | }, 198 | history_window = { 199 | title = 'Git History', 200 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 201 | border_hl = 'VGitBorder', 202 | border_focus_hl = 'VGitBorderFocus' 203 | }, 204 | }, 205 | hunk = { 206 | priority = 10, 207 | window = { 208 | border = { '╭', '─', '╮', '│', '╯', '─', '╰', '│' }, 209 | border_hl = 'VGitBorder', 210 | }, 211 | signs = { 212 | add = 'VGitViewSignAdd', 213 | remove = 'VGitViewSignRemove', 214 | }, 215 | }, 216 | hunk_sign = { 217 | priority = 10, 218 | signs = { 219 | add = 'VGitSignAdd', 220 | remove = 'VGitSignRemove', 221 | change = 'VGitSignChange', 222 | }, 223 | }, 224 | }) 225 | EOF 226 | 227 | if !common#functions#HasPlug("vim-gitgutter") && !common#functions#HasCocPlug('coc-git') 228 | nmap gj :VGit hunk_down 229 | nmap gk :VGit hunk_up 230 | 231 | nmap gp :VGit buffer_hunk_preview 232 | nmap gP :VGit project_hunks_preview 233 | nmap gd :VGit buffer_diff_preview 234 | nmap gD :VGit project_diff_preview 235 | 236 | nmap gh :VGit buffer_history_preview 237 | 238 | nmap gu :VGit buffer_hunk_reset 239 | nmap gU :VGit buffer_reset 240 | 241 | nmap gb :VGit buffer_blame_preview 242 | nmap gB :VGit buffer_gutter_blame_preview 243 | 244 | nmap gt :VGit toggle_diff_preference 245 | endif 246 | -------------------------------------------------------------------------------- /config/plugins/vim-LanguageTool.vim: -------------------------------------------------------------------------------- 1 | let g:languagetool_cmd='languagetool' 2 | -------------------------------------------------------------------------------- /config/plugins/vim-airline.vim: -------------------------------------------------------------------------------- 1 | let g:airline_powerline_fonts = 1 2 | let g:airline#extensions#tabline#enabled = 1 3 | let g:airline#extensions#tabline#formatter = 'unique_tail' 4 | let g:airline#extensions#tabline#show_tab_nr = 1 5 | let g:airline#extensions#tabline#tab_nr_type= 2 6 | let g:airline#extensions#tabline#show_tab_type = 1 7 | let g:airline#extensions#tabline#tabs_label = 'TABS' 8 | let g:airline#extensions#tabline#left_alt_sep = '>' 9 | let g:airline#extensions#tabline#buffer_nr_show = 1 10 | let g:airline#extensions#tabline#exclude_buffers = ["[defx]", "!", "vimfiler", "nnn", "vista"] 11 | 12 | " 显示窗口号 13 | function! WindowNumber(...) 14 | let builder = a:1 15 | let context = a:2 16 | call builder.add_section('airline_b', '%{tabpagewinnr(tabpagenr())}') 17 | return 0 18 | endfunction 19 | 20 | call airline#add_statusline_func('WindowNumber') 21 | call airline#add_inactive_statusline_func('WindowNumber') 22 | 23 | " 关闭airline的coc集成 24 | let g:airline#extensions#coc#enabled = 0 25 | if common#functions#HasPlug('coc.nvim') 26 | let g:airline_section_x = '%{coc#status()}' 27 | endif 28 | 29 | if g:airline#extensions#tabline#enabled == 1 30 | nmap AirlineSelectPrevTab 31 | nmap AirlineSelectNextTab 32 | else 33 | nnoremap :tabnext 34 | nnoremap :tabprevious 35 | tnoremap :tabnext 36 | tnoremap :tabprevious 37 | endif 38 | -------------------------------------------------------------------------------- /config/plugins/vim-anyfold.vim: -------------------------------------------------------------------------------- 1 | " set foldlevel=0 " close all folds or 2 | set foldlevel=99 " Open all folds 3 | let g:anyfold_fold_comments=1 4 | hi Folded term=underline 5 | 6 | " 大文件 7 | " activate anyfold by default 8 | " augroup vime_anyfold_group 9 | " autocmd! 10 | " autocmd Filetype * AnyFoldActivate 11 | " augroup END 12 | 13 | " " disable anyfold for large files 14 | " let g:LargeFile = 1000000 " file is large if size greater than 1MB 15 | " function LargeFile() 16 | " augroup vime_anyfold 17 | " autocmd! " remove AnyFoldActivate 18 | " autocmd Filetype * setlocal foldmethod=indent " fall back to indent folding 19 | " augroup END 20 | " endfunction 21 | " autocmd BufReadPre,BufRead * let f=getfsize(expand("")) | if f > g:LargeFile || f == -2 | call LargeFile() | endif 22 | -------------------------------------------------------------------------------- /config/plugins/vim-autoformat.vim: -------------------------------------------------------------------------------- 1 | " 需要安装相应的格式化工具 2 | " js-beautiful:js, html, css, json 3 | " astyle:c, c++, java, 4 | " autopep8:python 5 | " 6 | " 选择下一个格式化工具 :NextFormatter and :PreviousFormatter 7 | " 查看当前的格式化工具 :CurrentFormatter 8 | " 9 | " 可以选择一部分进行格式化 10 | " 11 | autocmd FileType vim,tex let b:autoformat_autoindent=0 12 | " let g:autoformat_autoindent = 1 13 | " let g:autoformat_retab = 0 14 | " let g:autoformat_remove_trailing_spaces = 1 15 | " 16 | " 可以自定义格式化命令, 17 | " my_custom_cs是标签,表示一个命令,formatters_cs = []表示使用my_custom_cs对c#进行格式化 18 | " 其中cs表示文件类型,c cpp py js 19 | " let g:formatdef_my_custom_cs = '"astyle --mode=cs --style=ansi -pcHs".&shiftwidth' 20 | " let g:formatters_cs = ['my_custom_cs'] 21 | let g:formatdef_my_custom_c = "'astyle --mode=c --style=allman '" 22 | let g:formatters_c = ['my_custom_c'] 23 | let g:formatdef_my_custom_h = '"astyle --mode=c --style=allman" ' 24 | let g:formatters_h = ['my_custom_h'] 25 | 26 | let g:formatdef_my_custom_cpp = "'astyle --style=google' " 27 | let g:formatters_cpp = ['my_custom_cpp'] 28 | let g:formatdef_my_custom_hpp = "'astyle --style=google' " 29 | let g:formatters_hpp = ['my_custom_hpp'] 30 | 31 | " let g:formatdef_my_custom_py = "'autopep8 --in-place --aggressive --max-line-length=80 --range '.a:firstline.' '.a:lastline" 32 | let g:formatdef_my_custom_py = "'autopep8 --in-place --aggressive --max-line-length=120 '" 33 | " let g:formatdef_my_custom_py = '"yapf --in-place --aggressive --style chromium"' 34 | let g:formatters_py = ['my_custom_py'] 35 | " let g:formatter_yapf_style = 'chromium' 36 | 37 | let g:formatdef_my_custom_java = "'astyle --style=java'" 38 | let g:formatters_java = ['my_custom_java'] 39 | -------------------------------------------------------------------------------- /config/plugins/vim-barbaric.vim: -------------------------------------------------------------------------------- 1 | " The input method for Normal mode (as defined by `xkbswitch -g` or `ibus engine`) 2 | let g:barbaric_default = 0 3 | 4 | " The scope where alternate input methods persist (buffer, window, tab, global) 5 | let g:barbaric_scope = 'buffer' 6 | 7 | " Forget alternate input method after n seconds in Normal mode (disabled by default) 8 | " Useful if you only need IM persistence for short bursts of active work. 9 | let g:barbaric_timeout = -1 10 | -------------------------------------------------------------------------------- /config/plugins/vim-better-whitespace.vim: -------------------------------------------------------------------------------- 1 | let g:better_whitespace_guicolor = 'white' 2 | let g:better_whitespace_enabled = 1 3 | let g:strip_whitespace_on_save = 1 4 | let g:strip_whitespace_confirm = 0 5 | 6 | let g:better_whitespace_filetypes_blacklist=[ 7 | \ 'startify', 8 | \ 'diff', 9 | \ 'gitcommit', 10 | \ 'unite', 11 | \ 'qf', 12 | \ 'help', 13 | \ 'coc-explorer', 14 | \ 'vista', 15 | \ 'floaterm', 16 | \ 'dashboard' 17 | \ ] 18 | -------------------------------------------------------------------------------- /config/plugins/vim-bookmarks.vim: -------------------------------------------------------------------------------- 1 | " bookmark文件存储路径 2 | let g:bookmark_file = $HOME.'/.cache/vim/vim-bookmarks' 3 | 4 | let g:bookmark_sign = '♥' 5 | let g:bookmark_highlight_lines = 1 6 | let g:bookmark_auto_save_file = g:bookmark_file 7 | 8 | noremap ma :BookmarkAnnotate 9 | noremap ml :BookmarkShowAll 10 | noremap mm :BookmarkToggle 11 | 12 | " |-----------------------------------------------|--------------|-------------------------------| 13 | " | Action | Shortcut | Command | 14 | " |-----------------------------------------------|--------------|-------------------------------| 15 | " | Add/remove bookmark at current line | `mm` | `:BookmarkToggle` | 16 | " | Add/edit/remove annotation at current line | `mi` | `:BookmarkAnnotate ` | 17 | " | Jump to next bookmark in buffer | `mn` | `:BookmarkNext` | 18 | " | Jump to previous bookmark in buffer | `mp` | `:BookmarkPrev` | 19 | " | Show all bookmarks (toggle) | `ma` | `:BookmarkShowAll` | 20 | " | Clear bookmarks in current buffer only | `mc` | `:BookmarkClear` | 21 | " | Clear bookmarks in all buffers | `mx` | `:BookmarkClearAll` | 22 | " | Move up bookmark at current line | `[count]mkk` | `:BookmarkMoveUp []` | 23 | " | Move down bookmark at current line | `[count]mjj` | `:BookmarkMoveDown []` | 24 | " | Move bookmark at current line to another line | `[count]mg` | `:BookmarkMoveToLine ` | 25 | " | Save all bookmarks to a file | | `:BookmarkSave ` | 26 | " | Load bookmarks from a file | | `:BookmarkLoad ` | 27 | " |-----------------------------------------------|--------------|-------------------------------| 28 | -------------------------------------------------------------------------------- /config/plugins/vim-choosewin.vim: -------------------------------------------------------------------------------- 1 | " 使用覆盖模式 2 | let g:choosewin_overlay_enable = 0 3 | 4 | function s:chooseWin() abort 5 | if winnr('$') > 1 6 | exec 'ChooseWin' 7 | endif 8 | endfunction 9 | 10 | " 默认快捷键 11 | " | Key | Action | Description | 12 | " | ------ | ---------- | ----------------------------- | 13 | " | 0 | tab_first | Select FIRST tab | 14 | " | [ | tab_prev | Select PREVIOUS tab | 15 | " | ] | tab_next | Select NEXT tab | 16 | " | $ | tab_last | Select LAST tab | 17 | " | x | tab_close | Close current tab | 18 | " | ; | win_land | Navigate to current window | 19 | " | - | previous | Naviage to previous window | 20 | " | s | swap | Swap windows #1 | 21 | " | S | swap_stay | Swap windows but stay #1 | 22 | " | `` | win_land | Navigate to current window | 23 | " | | `` | Disable predefined keymap | 24 | 25 | nnoremap - :call chooseWin() 26 | -------------------------------------------------------------------------------- /config/plugins/vim-clap.vim: -------------------------------------------------------------------------------- 1 | let g:clap_layout = { 'relative': 'editor' } 2 | let g:clap_theme = 'material_design_dark' 3 | " Change the CamelCase of related highlight group name to under_score_case. 4 | " let g:clap_theme = { 'search_text': {'guifg': 'red', 'ctermfg': 'red'} } 5 | 6 | " ref https://github.com/junegunn/fzf.vim/issues/379 7 | function! s:SystemExecute(lines) 8 | for line in a:lines 9 | exec 'silent !xdg-open ' . fnameescape(line) . ' > /dev/null' 10 | endfor 11 | endfunction 12 | let g:clap_open_action = { 13 | \ 'ctrl-t': 'tab split', 14 | \ 'ctrl-s': 'split', 15 | \ 'ctrl-v': 'vsplit', 16 | \ 'ctrl-x': function('s:SystemExecute'), 17 | \ } 18 | 19 | function! s:ClapFiles() abort 20 | if &ft ==? 'vimwiki' && match(expand('%:p'), expand(g:vimwiki_path)) > -1 21 | exec "Clap files " . g:vimwiki_path 22 | else 23 | exec "Clap files" 24 | endif 25 | endfunc 26 | 27 | function! s:ClapGrep() abort 28 | if &ft ==? 'vimwiki' && match(expand('%:p'), expand(g:vimwiki_path)) > -1 29 | exec "Clap grep " . g:vimwiki_path 30 | else 31 | exec "Clap grep" 32 | endif 33 | endfunc 34 | 35 | nnoremap :call ClapFiles() 36 | " nnoremap :Clap files $HOME 37 | nnoremap :Clap buffers 38 | nnoremap :Clap command 39 | nnoremap :Clap tags 40 | nnoremap :Clap proj_tags 41 | " 使用rg搜索工作目录 42 | nnoremap :call ClapGrep() 43 | " 模糊搜索所有buffer 44 | nnoremap ? :Clap lines 45 | nnoremap :Clap history 46 | nnoremap :Clap marks 47 | nnoremap :Clap maps 48 | nnoremap :Clap windows 49 | nnoremap :Clap yanks 50 | nnoremap :Clap jumps 51 | 52 | nnoremap :Clap quickfix 53 | nnoremap :Clap loclist 54 | 55 | nnoremap gd :Clap git_diff_files 56 | nnoremap gf :Clap gfiles 57 | nnoremap gm :Clap bcommits 58 | nnoremap gM :Clap commits 59 | -------------------------------------------------------------------------------- /config/plugins/vim-closetag.vim: -------------------------------------------------------------------------------- 1 | let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.xml' 2 | 3 | " filenames like *.xml, *.xhtml, ... 4 | " This will make the list of non-closing tags self-closing in the specified files. 5 | " 6 | " let g:closetag_xhtml_filenames = '*.xhtml,*.jsx' 7 | 8 | " filetypes like xml, html, xhtml, ... 9 | " These are the file types where this plugin is enabled. 10 | " 11 | let g:closetag_filetypes = 'html,xhtml,phtml' 12 | 13 | " filetypes like xml, xhtml, ... 14 | " This will make the list of non-closing tags self-closing in the specified files. 15 | " 16 | let g:closetag_xhtml_filetypes = 'xhtml,jsx' 17 | 18 | " integer value [0|1] 19 | " This will make the list of non-closing tags case-sensitive (e.g. `` will be closed while `` won't.) 20 | " 21 | let g:closetag_emptyTags_caseSensitive = 1 22 | 23 | " dict 24 | " Disables auto-close if not in a "valid" region (based on filetype) 25 | " 26 | let g:closetag_regions = { 27 | \ 'typescript.tsx': 'jsxRegion,tsxRegion', 28 | \ 'javascript.jsx': 'jsxRegion', 29 | \ } 30 | 31 | " Shortcut for closing tags, default is '>' 32 | " 33 | let g:closetag_shortcut = '>' 34 | 35 | " Add > at current position without closing the current tag, default is '' 36 | " 37 | let g:closetag_close_shortcut = '>' 38 | 39 | " :CloseTagToggleBuffer 40 | " :CloseTagEnableBuffer 41 | " :CloseTagDisableBuffer 42 | -------------------------------------------------------------------------------- /config/plugins/vim-crystalline.vim: -------------------------------------------------------------------------------- 1 | set laststatus=2 2 | set showtabline=2 3 | 4 | function! StatusLine(current, width) 5 | 6 | let l:f_list = ["coc-explorer", "defx", "vista", "nerdtree"] 7 | 8 | if index(f_list, &ft) > -1 9 | return &ft 10 | endif 11 | 12 | let l:s = '' 13 | 14 | if a:current 15 | let l:s .= crystalline#mode() . crystalline#right_mode_sep('') 16 | else 17 | let l:s .= '%#CrystallineInactive#' 18 | endif 19 | 20 | let l:s .= ' %f%h%w%m%r ' 21 | " if a:current 22 | " let l:s .= crystalline#right_sep('', 'Fill') . ' %{common#functions#GitBranch()} %{common#functions#GitCount()}' 23 | " endif 24 | 25 | if common#functions#HasPlug("coc.nvim") 26 | let l:s .= " %{coc#status()}%{get(b:, 'coc_current_function', '')}" 27 | endif 28 | 29 | let l:s .= '%=' 30 | if a:current 31 | let l:s .= crystalline#left_sep('', 'Fill') . ' %{&paste ?"PASTE ":""}%{&spell?"SPELL ":""}' 32 | let l:s .= crystalline#left_mode_sep('') 33 | endif 34 | if a:width > 80 35 | let l:s .= ' %{&ft}[%{&fenc!=#""?&fenc:&enc}][%{&ff}] %l/%L %c%V %P ' 36 | else 37 | let l:s .= ' ' 38 | endif 39 | 40 | " let l:s .= crystalline#left_sep('', 'Fill') . ' %{common#functions#CocWarn()}' 41 | " let l:s .= crystalline#left_mode_sep('') 42 | " let l:s .= crystalline#left_sep('', 'Fill') . ' %{common#functions#CocError()}' 43 | " let l:s .= crystalline#left_mode_sep('') 44 | " let l:s .= crystalline#left_sep('', 'Fill') . ' %{common#functions#CocFixes()}' 45 | " let l:s .= crystalline#left_mode_sep('') 46 | 47 | return l:s 48 | endfunction 49 | 50 | function! TabLine() 51 | let l:vimlabel = 'VIME' 52 | return crystalline#bufferline(2, len(l:vimlabel), 1) . '%=%#CrystallineTab# ' . l:vimlabel 53 | endfunction 54 | 55 | let g:crystalline_enable_sep = 1 56 | let g:crystalline_statusline_fn = 'StatusLine' 57 | let g:crystalline_tabline_fn = 'TabLine' 58 | let g:crystalline_theme = 'onedark' 59 | 60 | nnoremap :call common#functions#MoveTabOrBuf(1) 61 | nnoremap :call common#functions#MoveTabOrBuf(0) 62 | tnoremap :call common#functions#MoveTabOrBuf(1) 63 | tnoremap :call common#functions#MoveTabOrBuf(0) 64 | -------------------------------------------------------------------------------- /config/plugins/vim-dispatch.vim: -------------------------------------------------------------------------------- 1 | nnoremap r :Dispatch 2 | autocmd FileType java let b:dispatch = 'javac %' 3 | autocmd FileType python let b:dispatch = 'python %' 4 | autocmd FileType base let b:dispatch = 'sh %' 5 | autocmd FileType javascript let b:dispatch = 'nodejs %' 6 | -------------------------------------------------------------------------------- /config/plugins/vim-doge.vim: -------------------------------------------------------------------------------- 1 | " 选择注释风格 2 | " Example: 3 | " let g:doge_doc_standard_python = 'numpy' 4 | " 如果想为buffer设定风格 5 | " :let b:doge_doc_standard = 'numpy' 6 | " 全部风格 7 | 8 | " 跳转 9 | let g:doge_mapping_comment_jump_forward='' 10 | let g:doge_mapping_comment_jump_backward='' 11 | 12 | " 以交互方式跳转生成的注释中的所有TODO项目。 13 | let g:doge_comment_interactive=1 14 | 15 | " 到达起点或终点时,继续在占位符之间循环 16 | let g:doge_comment_jump_wrap=1 17 | 18 | " 为其他文件设置别名,vue用js的注释 19 | let g:doge_filetype_aliases = { 20 | \ 'javascript': ['vue'] 21 | \} 22 | 23 | " 不使用默认映射,vim-plug根据命令启动,启动速度更快 24 | let g:doge_enable_mappings=0 25 | " let g:doge_mapping='d' 26 | nmap d :DogeGenerate 27 | -------------------------------------------------------------------------------- /config/plugins/vim-easy-align.vim: -------------------------------------------------------------------------------- 1 | " 在注释和字符串中取消对齐 2 | let g:easy_align_ignore_groups = ['Comment', 'String'] 3 | -------------------------------------------------------------------------------- /config/plugins/vim-easymotion.vim: -------------------------------------------------------------------------------- 1 | " 一个字符 2 | map f (easymotion-bd-f) 3 | nmap f (easymotion-overwin-f) 4 | 5 | " 无需输入字符,即可全屏搜索单词 6 | let g:EasyMotion_keys = 'abcdefghijklmnopqrstuvwx-^&*()+123456ABCDEF/;\=[]GHIJKLMNOPQRST7890UVWXYZyz' 7 | " 单词间移动 8 | map F (easymotion-bd-w) 9 | nmap F (easymotion-overwin-w) 10 | 11 | " 两个字符 12 | " nmap F (easymotion-overwin-f2) 13 | 14 | " 移动到行 15 | map gl (easymotion-bd-jk) 16 | nmap gl (easymotion-overwin-line) 17 | -------------------------------------------------------------------------------- /config/plugins/vim-eft.vim: -------------------------------------------------------------------------------- 1 | " Disable highlight 2 | let g:eft_highlight = {} 3 | 4 | " Custom highlight 5 | let g:eft_highlight = { 6 | \ '1': { 7 | \ 'highlight': 'EftChar', 8 | \ 'allow_space': v:true, 9 | \ 'allow_operator': v:true, 10 | \ }, 11 | \ '2': { 12 | \ 'highlight': 'EftSubChar', 13 | \ 'allow_space': v:false, 14 | \ 'allow_operator': v:false, 15 | \ }, 16 | \ 'n': { 17 | \ 'highlight': 'EftSubChar', 18 | \ 'allow_space': v:false, 19 | \ 'allow_operator': v:false, 20 | \ } 21 | \ } 22 | 23 | " You can pick your favorite strategies. 24 | let g:eft_index_function = { 25 | \ 'head': function('eft#index#head'), 26 | \ 'tail': function('eft#index#tail'), 27 | \ 'space': function('eft#index#space'), 28 | \ 'camel': function('eft#index#camel'), 29 | \ 'symbol': function('eft#index#symbol'), 30 | \ } 31 | 32 | " You can use the below function like native `f` 33 | let g:eft_index_function = { 34 | \ 'all': { -> v:true }, 35 | \ } 36 | 37 | nmap ; (eft-repeat) 38 | xmap ; (eft-repeat) 39 | 40 | nmap f (eft-f) 41 | xmap f (eft-f) 42 | omap f (eft-f) 43 | nmap F (eft-F) 44 | xmap F (eft-F) 45 | omap F (eft-F) 46 | 47 | nmap t (eft-t) 48 | xmap t (eft-t) 49 | omap t (eft-t) 50 | nmap T (eft-T) 51 | xmap T (eft-T) 52 | omap T (eft-T) 53 | 54 | -------------------------------------------------------------------------------- /config/plugins/vim-emoji.vim.vim: -------------------------------------------------------------------------------- 1 | " let g:gitgutter_sign_added = emoji#for('small_blue_diamond') 2 | " let g:gitgutter_sign_modified = emoji#for('small_orange_diamond') 3 | " let g:gitgutter_sign_removed = emoji#for('small_red_triangle') 4 | " let g:gitgutter_sign_modified_removed = emoji#for('collision') 5 | -------------------------------------------------------------------------------- /config/plugins/vim-expand-region.vim: -------------------------------------------------------------------------------- 1 | " + 扩展,_ 缩小 2 | " 扩展顺序,viw -> viW -> vi" -> vi' -> ... 3 | " let g:expand_region_text_objects = { 4 | " \ 'iw' :0, 5 | " \ 'iW' :1, 6 | " \ 'i"' :1, 7 | " \ 'i''' :1, 8 | " \ 'i]' :1, 9 | " \ 'ib' :1, 10 | " \ 'iB' :1, 11 | " \ 'il' :0, 12 | " \ 'ip' :1, 13 | " \ 'ie' :1, 14 | " \ } 15 | " 16 | "let g:expand_region_use_select_mode = 1 17 | 18 | " 自定义文本块 19 | "call expand_region#custom_text_objects({ 20 | " \ "\/\\n\\n\": 1, 21 | " \ 'a]' :1, 22 | " \ 'ab' :1, 23 | " \ 'aB' :1, 24 | " \ 'ii' :0, 25 | " \ 'ai' :0, 26 | " \ }) 27 | -------------------------------------------------------------------------------- /config/plugins/vim-floaterm.vim: -------------------------------------------------------------------------------- 1 | let g:floaterm_position='center' 2 | let g:floaterm_width=0.8 3 | let g:floaterm_height=0.6 4 | let g:floaterm_rootmarkers=['.project', '.git', '.hg', '.svn', '.root', '.gitignore'] 5 | " let g:floaterm_autoinsert=v:false 6 | 7 | nmap :FloatermNew 8 | nmap :FloatermToggle 9 | tnoremap :FloatermNew 10 | tnoremap :FloatermToggle 11 | 12 | augroup vime_floaterm_group 13 | autocmd! 14 | au FileType floaterm tnoremap :FloatermPrev 15 | au FIleType floaterm tnoremap :FloatermNext 16 | augroup END 17 | -------------------------------------------------------------------------------- /config/plugins/vim-fugitive.vim: -------------------------------------------------------------------------------- 1 | " 添加当前文件到index 2 | nnoremap gw :Gwrite 3 | " 提交 4 | nnoremap gc :Git commit 5 | " 恢复当前文件到上个版本 6 | nnoremap gr :Gread 7 | " 显示提交日志 8 | nnoremap gl :Git log 9 | " 显示当前git状态 10 | nnoremap gg :Git 11 | 12 | if !common#functions#HasPlug("vgit.nvim") 13 | " 查看当前文件与提交文件的不同 14 | nnoremap gd :Gvdiffsplit 15 | nnoremap gb :Git blame 16 | endif 17 | -------------------------------------------------------------------------------- /config/plugins/vim-gitgutter.vim: -------------------------------------------------------------------------------- 1 | " 开启gitgutter 2 | let g:gigutter_enable = 1 3 | " 开启行高亮 4 | let g:gitgutter_highlight_lines = 0 5 | " 开启行号高亮 6 | let g:gitgutter_highlight_linenrs = 1 7 | " 关闭默认快捷键 8 | let g:gitgutter_map_keys = 0 9 | " 折叠相关 10 | " set foldtext=gitgutter#fold#foldtext() 11 | " 文件更改数量超过500将会压缩显示 12 | let g:gitgutter_max_signs = 500 13 | let g:gitgutter_preview_win_floating = 1 14 | 15 | " 关闭column的提示符号 16 | if common#functions#HasCocPlug('coc-git') 17 | let g:gitgutter_signs = 0 18 | else 19 | let g:gitgutter_signs = 1 20 | let g:gitgutter_sign_added = '▎' 21 | let g:gitgutter_sign_modified = '▎' 22 | let g:gitgutter_sign_removed = '▎' 23 | let g:gitgutter_sign_removed_first_line = '▔' 24 | let g:gitgutter_sign_modified_removed = '▋' 25 | endif 26 | 27 | highlight link GitGutterAddLineNr SignifySignAdd 28 | highlight link GitGutterChangeLineNr SignifySignChange 29 | highlight link GitGutterDeleteLineNr SignifySignDelete 30 | highlight link GitGutterChangeDeleteLineNr SignifySignDelete 31 | 32 | " coc-git优先 33 | if !common#functions#HasCocPlug('coc-git') && !common#functions#HasPlug('vgit.nvim') 34 | " 导航到修改块 35 | " nnoremap gj :GitGutterNextHunk 36 | " nnoremap gk :GitGutterPrevHunk 37 | nmap gj (GitGutterNextHunk) 38 | nmap gk (GitGutterPrevHunk) 39 | " 显示光标处的修改信息 40 | nmap gp (GitGutterPreviewHunk) 41 | " 撤销当前块的修改 42 | nmap gu (GitGutterUndoHunk) 43 | nmap gh (GitGutterStageHunk) 44 | endif 45 | -------------------------------------------------------------------------------- /config/plugins/vim-hexokinase.vim: -------------------------------------------------------------------------------- 1 | let g:Hexokinase_v2 = 0 2 | let g:Hexokinase_refreshEvents = ['BufWrite', 'BufRead'] 3 | 4 | let g:Hexokinase_highlighters = ['background'] 5 | -------------------------------------------------------------------------------- /config/plugins/vim-indent-guides.vim: -------------------------------------------------------------------------------- 1 | let g:indent_guides_enable_on_vim_startup = 1 2 | -------------------------------------------------------------------------------- /config/plugins/vim-keysound.vim: -------------------------------------------------------------------------------- 1 | let g:keysound_enable=1 2 | " default typewriter mario sword bubble 3 | let g:keysound_theme='typewriter' 4 | let g:keysound_volume=100000 5 | let g:keysound_py_version = 3 6 | -------------------------------------------------------------------------------- /config/plugins/vim-latex-live-preview.vim: -------------------------------------------------------------------------------- 1 | let g:livepreview_previewer = 'zathura' 2 | -------------------------------------------------------------------------------- /config/plugins/vim-markdown-runner.vim: -------------------------------------------------------------------------------- 1 | autocmd FileType markdown nnoremap r :MarkdownRunner 2 | autocmd FileType markdown nnoremap R :MarkdownRunnerInsert 3 | -------------------------------------------------------------------------------- /config/plugins/vim-markdown-toc.vim: -------------------------------------------------------------------------------- 1 | let g:vmt_cycle_list_item_markers = 1 2 | -------------------------------------------------------------------------------- /config/plugins/vim-markdown.vim: -------------------------------------------------------------------------------- 1 | let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] 2 | 3 | " 显示参数 ``` ** __ 4 | let g:markdown_syntax_conceal = 0 5 | let g:vim_markdown_conceal_code_blocks = 0 6 | 7 | let g:markdown_minlines = 50 8 | let g:vim_markdown_folding_disabled=1 " 取消markdown的默认折叠 9 | let g:vim_markdown_toc_autofit=1 " toc自动修复 10 | 11 | let g:vim_markdown_new_list_item_indent = 2 12 | 13 | if common#functions#HasPlug('markdown-preview.nvim') 14 | command! -nargs=0 Mp :MarkdownPreview 15 | endif 16 | -------------------------------------------------------------------------------- /config/plugins/vim-matchup.vim: -------------------------------------------------------------------------------- 1 | if !common#functions#HasPlug("nvim-treesitter") 2 | 3 | lua < MoveBlockDown 8 | vmap MoveBlockUp 9 | vmap MoveBlockLeft 10 | vmap MoveBlockRight 11 | -------------------------------------------------------------------------------- /config/plugins/vim-mundo.vim: -------------------------------------------------------------------------------- 1 | " 设置永久目录, 那么无论什么时候打开都能退回到最最最开始 2 | set undofile 3 | exec 'set undodir=' . g:undo_dir 4 | let g:mundo_width = 60 5 | let g:mundo_preview_height = 15 6 | let g:mundo_right = 1 7 | " 在下方预览 8 | let g:mundo_preview_bottom = 0 9 | " 不显示帮助 10 | let g:mundo_help = 0 11 | " let g:mundo_preview_statusline = 1 12 | " let g:mundo_tree_statusline = 1 13 | noremap :MundoToggle 14 | -------------------------------------------------------------------------------- /config/plugins/vim-polyglot.vim: -------------------------------------------------------------------------------- 1 | " 懒人包,需要配置的,点进对应的高亮插件然后查看他的配置进行配置 2 | " 不使用的文件,polyglot与vimtex冲突 3 | " let g:polyglot_disabled = ['latex'] " 该命令需要在载入此插件之前调用 4 | 5 | let g:cpp_member_variable_highlight = 1 6 | let g:cpp_posix_standard = 1 7 | let g:cpp_class_scope_highlight = 1 8 | let g:cpp_class_decl_highlight = 1 9 | let g:cpp_experimental_template_highlight = 1 10 | 11 | let g:go_highlight_extra_types = 1 12 | let g:go_highlight_operators = 1 13 | let g:go_highlight_functions = 1 14 | let g:go_highlight_function_parameters = 1 15 | let g:go_highlight_functions_calls = 1 16 | let g:go_highlight_types = 1 17 | let g:go_highlight_fields = 1 18 | let g:go_highlight_generate_tags = 1 19 | let g:go_highlight_format_strings = 1 20 | let g:go_highlight_variable_declarations = 1 21 | let g:go_highlight_variable_assignments = 1 22 | 23 | " python高亮用semshi 24 | " let g:python_highlight_all = 1 25 | -------------------------------------------------------------------------------- /config/plugins/vim-quickrun.vim: -------------------------------------------------------------------------------- 1 | let g:quickrun_no_default_key_mappings = 1 2 | " nmap :QuickRun 3 | " vmap :QuickRun 4 | " 需要增加函数,判断光标所在的窗口是否可以执行 5 | nmap (quickrun) 6 | nmap r (quickrun) 7 | vmap r (quickrun) 8 | 9 | let g:quickrun_config = { 10 | \ '_': { 11 | \ 'outputter/buffer/close_on_empty': 0, 12 | \ 'outputter/buffer/split': '10', 13 | \ 'outputter/buffer/into': 1, 14 | \ 'outputter/message/log': 1, 15 | \ } 16 | \} 17 | -------------------------------------------------------------------------------- /config/plugins/vim-sandwich.vim: -------------------------------------------------------------------------------- 1 | " 让vim-sandwich快捷键与vim-surround一致 2 | runtime macros/sandwich/keymap/surround.vim 3 | -------------------------------------------------------------------------------- /config/plugins/vim-smooth-scroll.vim: -------------------------------------------------------------------------------- 1 | " smooth scroll key map 2 | " scroll代表半屏,distance duration speed 3 | " noremap :call smooth_scroll#up(&scroll, 6, 1) 4 | " noremap :call smooth_scroll#down(&scroll, 6, 1) 5 | " noremap :call smooth_scroll#up(&scroll*2, 8, 4) 6 | " noremap :call smooth_scroll#down(&scroll*2, 8, 4) 7 | -------------------------------------------------------------------------------- /config/plugins/vim-sneak.vim: -------------------------------------------------------------------------------- 1 | " 按s跳转到下一个匹配 2 | let g:sneak#s_next = 1 3 | -------------------------------------------------------------------------------- /config/plugins/vim-snip.vim: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fgheng/vime/18a361af51408298ddfdd2cb139ebbaa44a45216/config/plugins/vim-snip.vim -------------------------------------------------------------------------------- /config/plugins/vim-startify.vim: -------------------------------------------------------------------------------- 1 | " For startify 2 | let g:startify_padding_left = 10 3 | let g:startify_custom_header = [ 4 | \' ', 5 | \' ▄█ █▄ ▄█ ▄▄▄▄███▄▄▄▄ ▄████████', 6 | \' ███ ███ ███ ▄██▀▀▀███▀▀▀██▄ ███ ███', 7 | \' ███ ███ ███▌ ███ ███ ███ ███ █▀', 8 | \' ███ ███ ███▌ ███ ███ ███ ▄███▄▄▄', 9 | \' ███ ███ ███▌ ███ ███ ███ ▀▀███▀▀▀', 10 | \' ███ ███ ███ ███ ███ ███ ███ █▄', 11 | \' ███ ███ ███ ███ ███ ███ ███ ███', 12 | \' ▀██████▀ █▀ ▀█ ███ █▀ ██████████', 13 | \' ', 14 | \' ', 15 | \] 16 | 17 | let g:startify_files_number = 6 18 | let g:startify_dir_number = 6 19 | 20 | " session 21 | let g:startify_session_dir = g:session_dir 22 | " 自动保存,注意,只会自动保存载入的session 23 | let g:startify_session_persistence = 1 24 | " 保存session之前自动执行命令 25 | let g:startify_session_before_save = [ 26 | \ 'echo "Cleaning up before saving.."', 27 | \ 'silent! NERDTreeTabsClose' 28 | \ ] 29 | 30 | " bookmarks 书签 31 | let g:startify_bookmarks = [ 32 | \ g:vimwiki_path . '/草稿/todo.md', 33 | \ g:vimwiki_path . '/草稿/快速笔记.md', 34 | \ g:quicknote_file 35 | \ ] 36 | 37 | " command 命令 38 | let g:startify_commands = [ 39 | \ {'u': ['插件更新', 'PlugUpdate']}, 40 | \ {'t': ['打开终端', 'terminal']}, 41 | \ {'w': ['笔记列表', 'VimwikiIndex']}, 42 | \ {'s': ['启动时间', 'StartupTime']}, 43 | \ ] 44 | 45 | let g:startify_lists = [ 46 | \ { 'type': 'sessions', 'header': [' Sessions'] }, 47 | \ { 'type': 'bookmarks', 'header': [' Bookmarks'] }, 48 | \ { 'type': 'files', 'header': [' MRU'] }, 49 | \ { 'type': 'dir', 'header': [' MRU '. getcwd()] }, 50 | \ { 'type': 'commands', 'header': [' Commands'] }, 51 | \ ] 52 | 53 | " 打开buffer也显示startify 54 | " autocmd BufEnter * 55 | " \ if !exists('t:startify_new_tab') && empty(expand('%')) && !exists('t:goyo_master') | 56 | " \ let t:startify_new_tab = 1 | 57 | " \ Startify | 58 | " \ endif 59 | -------------------------------------------------------------------------------- /config/plugins/vim-surround.vim: -------------------------------------------------------------------------------- 1 | " vim-surround config begin 2 | " if !empty(glob(plug_home."/vim-surround")) 3 | " brief: 4 | " cs change surround 5 | " ys add surround 6 | -------------------------------------------------------------------------------- /config/plugins/vim-table-mode.vim: -------------------------------------------------------------------------------- 1 | " https://github.com/dhruvasagar/vim-table-mode 2 | " 使用命令启动TableModeToggle 3 | " 在插入模式输入|然后输入内容然后在输入|然后在输入内容|即可 4 | let g:table_mode_corner='|' " 默认是+ 5 | " let g:table_mode_corner_corner='+' 6 | " let g:table_mode_header_fillchar='=' 7 | 8 | function! s:isAtStartOfLine(mapping) 9 | let text_before_cursor = getline('.')[0 : col('.')-1] 10 | let mapping_pattern = '\V' . escape(a:mapping, '\') 11 | let comment_pattern = '\V' . escape(substitute(&l:commentstring, '%s.*$', '', ''), '\') 12 | return (text_before_cursor =~? '^' . ('\v(' . comment_pattern . '\v)?') . '\s*\v' . mapping_pattern . '\v$') 13 | endfunction 14 | 15 | inoreabbrev 16 | \ isAtStartOfLine('\|\|') ? 17 | \ ':TableModeEnable' : '' 18 | inoreabbrev __ 19 | \ isAtStartOfLine('__') ? 20 | \ ':silent! TableModeDisable' : '__' 21 | 22 | " 格式化已有的table, 或者将一行转换为table,默认是空格分割 23 | " 1. 选中,然后执行命令:tableize, 或者leadertt 24 | " 2. tableize/;可以用;分割,或者leaderT 25 | 26 | " 在格子间移动 27 | " [| ]| {| }| 28 | 29 | " 删除 30 | " 删除行:leadert dd 31 | " 删除列:leadert dc 32 | -------------------------------------------------------------------------------- /config/plugins/vim-terminal-help.vim: -------------------------------------------------------------------------------- 1 | 2 | " ALT + =: toggle terminal below. 3 | " ALT + SHIFT + h: move to the window on the left. 4 | " ALT + SHIFT + l: move to the window on the right. 5 | " ALT + SHIFT + j: move to the window below. 6 | " ALT + SHIFT + k: move to the window above. 7 | " ALT + -: paste register 0 to terminal 8 | 9 | let g:terminal_height=10 10 | "let g:terminal_shell = 11 | " let g:terminal_edit='window drop' 12 | let g:terminal_list=0 "set to 0 to hide terminal buffer in the buffer list. 13 | " let g:terminal_cwd=1 " initialize working dir: 0 for unchanged, 1 for file path and 2 for project root. 14 | 15 | -------------------------------------------------------------------------------- /config/plugins/vim-tmux-navigator.vim: -------------------------------------------------------------------------------- 1 | " 离开vim进入tmux的时候自动保存 2 | let g:tmux_navigator_save_on_switch = 2 3 | -------------------------------------------------------------------------------- /config/plugins/vim-translate-me.vim.vim: -------------------------------------------------------------------------------- 1 | " let g:vtm_popup_window='floating' 2 | let g:vtm_default_api='youdao' 3 | let g:vtm_default_to_lang='en' 4 | -------------------------------------------------------------------------------- /config/plugins/vim-translator.vim: -------------------------------------------------------------------------------- 1 | " Echo translation in the cmdline 2 | nmap t Translate 3 | vmap t TranslateV 4 | " Display translation in a window 5 | nmap TranslateW 6 | vmap TranslateWV 7 | " Replace the text with translation 8 | nmap r TranslateR 9 | vmap r TranslateRV 10 | -------------------------------------------------------------------------------- /config/plugins/vim-visual-multi.vim: -------------------------------------------------------------------------------- 1 | " basic usage 2 | " 1. 使用ctrl n来选择当前光标下的单词,使用n进行向下选择,使用N向上选择, 3 | " 使用shift arrows进行选择,然后n选择下一个 4 | " 2. ctrl down/up 垂直多选 5 | " 3. ]/[ 在所有光标之间进行跳转,ctrl f/b 6 | " 4. q,跳过当前选择并将光标移动到下一个选择处 7 | " 5. Q,仅仅取消当前选择不移动下一处 8 | " 6. 使用tab可以在光标模式和visual模式之间进行跳转 9 | " 7. 多光标选中之后使用s可以进行扩展选择,比如siw,si'等 10 | " 11 | " 12 | let g:VM_theme='ocean' 13 | let g:VM_show_warnings = 0 14 | let g:VM_maps = {} 15 | 16 | let g:VM_maps["Switch Mode"] = '' 17 | let g:VM_maps["Add Cursor At Pos"] = '' 18 | let g:VM_maps['Visual Add'] = '' 19 | let g:VM_maps["Select All"] = '' 20 | let g:VM_maps["Visual All"] = '' 21 | " 使用正则进行匹配 22 | let g:VM_maps["Start Regex Search"] = '\\/' 23 | let g:VM_maps["Visual Regex"] = '\\/' 24 | 25 | " let g:VM_maps["Alt Skip"] = 'n' 26 | let g:VM_maps["Remove Region"] = 'q' 27 | "let g:VM_maps["Skip Region"] = 'q' " 取消当前位置并跳到下一处 28 | let g:VM_maps["Invert Direction"] = 'o' 29 | let g:VM_maps["Find Operator"] = "m" 30 | let g:VM_maps["Surround"] = 'S' 31 | 32 | " 将findx更换为其他的符号,那么就可以使用n向下跳转 33 | " 使用ctrl-n进行选择了 34 | let g:VM_maps["Find Next"] = '' 35 | let g:VM_maps["Find Prev"] = '' 36 | let g:VM_maps['Find Under'] = '' 37 | let g:VM_maps['Find Subword Under'] = '' 38 | let g:VM_maps["Goto Next"] = ']' 39 | let g:VM_maps["Goto Prev"] = '[' 40 | -------------------------------------------------------------------------------- /config/plugins/vim-vsnip.vim: -------------------------------------------------------------------------------- 1 | " Expand 2 | imap vsnip#expandable() ? '(vsnip-expand)' : '' 3 | smap vsnip#expandable() ? '(vsnip-expand)' : '' 4 | 5 | " Expand or jump 6 | imap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' 7 | smap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' 8 | 9 | " Jump forward or backward 10 | imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' 11 | smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' 12 | imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' 13 | smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' 14 | 15 | " Select or cut text to use as $TM_SELECTED_TEXT in the next snippet. 16 | " See https://github.com/hrsh7th/vim-vsnip/pull/50 17 | nmap s (vsnip-select-text) 18 | xmap s (vsnip-select-text) 19 | nmap S (vsnip-cut-text) 20 | xmap S (vsnip-cut-text) 21 | 22 | " If you want to use snippet for multiple filetypes, you can `g:vsnip_filetypes` for it. 23 | " let g:vsnip_filetypes = {} 24 | " let g:vsnip_filetypes.javascriptreact = ['javascript'] 25 | " let g:vsnip_filetypes.typescriptreact = ['typescript'] 26 | -------------------------------------------------------------------------------- /config/plugins/vim-which-key.vim: -------------------------------------------------------------------------------- 1 | set timeoutlen=100 2 | let g:mapleader = "\" 3 | let g:maplocalleader = '\' 4 | nnoremap :WhichKey '' 5 | nnoremap :WhichKey '' 6 | -------------------------------------------------------------------------------- /config/plugins/vimade.vim: -------------------------------------------------------------------------------- 1 | let g:vimade = {} 2 | let g:vimade.fadelevel = 0.7 3 | let g:vimade.enablesigns = 1 4 | -------------------------------------------------------------------------------- /config/plugins/vimtex.vim: -------------------------------------------------------------------------------- 1 | " 一个教程 https://jdhao.github.io/2019/03/26/nvim_latex_write_preview/ 2 | let g:vimtex_cache_root = g:cache_root_path . '/vim/vimtex' 3 | " https://zhuanlan.zhihu.com/p/61036165 4 | let g:tex_flavor='latex' 5 | 6 | if has("nvim") 7 | " 用于反向定位 8 | let g:vimtex_compiler_progname = 'nvr' 9 | endif 10 | 11 | " vimtex默认的pdf浏览器 12 | let g:vimtex_view_method='zathura' 13 | let g:vimtex_quickfix_mode=0 14 | let g:tex_conceal='abdmg' 15 | 16 | " let g:latex_view_general_viewer = 'zathura' 17 | let g:latex_view_general_options = shellescape('--synctex-forward "' . exepath(v:progpath) . ' --servername ' . v:servername . ' +{%lline} {%ffile}"') 18 | let g:latex_view_general_options = shellescape('--synctex-forward "' . v:progname . ' --servername ' . v:servername . ' +{%line} {%file}"') 19 | " \ll编译tex文件 (注意:\ll执行后,表示进入continuous mode,每次编辑过后,:w保存文档,对应的pdf就会自动更新) 20 | " \lk(或\ll)停止编译 (注意:当执行\lk或再次执行\ll后,表示退出continuous mode,:w保存文档,对应的pdf就不会自动更新) 21 | " \lv打开pdf阅读器查看文档,或在pdf文档已经打开的情况下向前搜索pdf中对应的目前光标所在位置的内容 22 | " \le打开或关闭编译的报错和警告信息 23 | " \lc清除latex编译文件 24 | " \lt打开目录(可以通过目录跳转) 25 | 26 | " Esc或q退出目录 27 | " Space跳转 28 | " Enter跳转并关闭目录 29 | 30 | " \li查看latex项目信息,按Esc或q退出 31 | " \lm查看内置的imaps 32 | " 33 | " TOC settings 34 | let g:vimtex_toc_config = { 35 | \ 'name' : 'TOC', 36 | \ 'layers' : ['content', 'todo', 'include'], 37 | \ 'todo_sorted' : 0, 38 | \ 'show_help' : 1, 39 | \ 'show_numbers' : 1, 40 | \ 'mode' : 2, 41 | \ 'split_width' : 50, 42 | \ 'split_pos' : 'vert botright', 43 | \} 44 | 45 | 46 | " 自动打开inkscape绘图,然后插入到latex中 47 | if executable("inkscape") 48 | " 参考: 49 | " https://zhuanlan.zhihu.com/p/64205323 50 | " https://github.com/gillescastel/inkscape-figures 51 | " 需要pip install inkscape-figures 52 | inoremap : silent exec '.!inkscape-figures create "'.getline('.').'" "'.b:vimtex.root.'/figures/"':w 53 | endif 54 | 55 | function! CloseViewers() 56 | " 关闭buffer的时候自动关闭浏览软件 57 | if executable('xdotool') && exists('b:vimtex') 58 | \ && exists('b:vimtex.viewer') && b:vimtex.viewer.xwin_id > 0 59 | silent call system('xdotool windowclose '. b:vimtex.viewer.xwin_id) 60 | endif 61 | endfunction 62 | 63 | augroup vime_vimtex_event_1 64 | autocmd! 65 | " 打开自动编译 66 | " au User VimtexEventInitPost call vimtex#compiler#compile() 67 | " 退出自动关闭预览 68 | au User VimtexEventQuit call vimtex#compiler#clean(0) 69 | au User VimtexEventQuit call CloseViewers() 70 | augroup END 71 | 72 | " augroup vime_vimtex_group 73 | " autocmd! 74 | " autocmd FileType tex setl tw=80 fo+=tmM fo-=l spell spelllang=nl,en_gb 75 | " autocmd FileType tex setl fo+=t 76 | " autocmd FileType tex setl fo-=l 77 | " autocmd FileType tex setl fo+=mM 78 | " autocmd FileType tex setl spell 79 | " autocmd FileType tex setl spelllang=nl,en_gb 80 | " " autocmd FileType tex setl conceallevel=0 81 | " augroup END 82 | -------------------------------------------------------------------------------- /config/plugins/vimwiki.vim: -------------------------------------------------------------------------------- 1 | " TODO 判断vimwiki_path是否存在 2 | let g:vimwiki_list = [ 3 | \ { 4 | \ 'path': g:vimwiki_path, 5 | \ 'path_html': g:vimwiki_path . 'wiki_html', 6 | \ 'syntax': 'markdown', 7 | \ 'auto_toc': 1, 8 | \ 'ext':'.md', 9 | \ 'auto_diary_index': 1, 10 | \ } 11 | \ ] 12 | 13 | " 高亮checkbox 14 | let g:vimwiki_hl_cb_checked = 2 15 | 16 | " todo符号 17 | let g:vimwiki_listsyms = '✗○◐●✓' 18 | 19 | " 目录标题的等级 20 | let g:vimwiki_toc_header_level = 2 21 | 22 | " 快捷键 23 | nmap ww :VimwikiIndex 24 | nmap wt :VimwikiTabIndex 25 | nmap wi :VimwikiDiaryIndex 26 | 27 | augroup vime_vimwiki_group 28 | autocmd! 29 | autocmd FileType wiki,md,markdown setl colorcolumn=0 30 | autocmd FileType wiki,md,markdown setl conceallevel=0 31 | autocmd FileType wiki,md,markdown setl textwidth=0 32 | 33 | " 避免g:vimwiki_hl_cb_checked设置为2的时候有问题 34 | au BufEnter *.wiki :syntax sync fromstart 35 | augroup END 36 | -------------------------------------------------------------------------------- /config/plugins/vista.vim.vim: -------------------------------------------------------------------------------- 1 | " let g:vista_icon_indent = ["╰─▸ ", "├─▸ "] 2 | let g:vista_ctags_cmd = { 3 | \ 'haskell': 'hasktags -x -o - -c', 4 | \ } 5 | " let g:vista_default_executive = 'ctags' 6 | let g:vista#renderer#enable_icon = 1 7 | let g:vista#renderer#icons = { 8 | \ "function": "\uf794", 9 | \ "variable": "\uf71b", 10 | \ } 11 | let g:vista_sidebar_width = 50 12 | 13 | function s:vista_toggle() abort 14 | if &ft == "tex" 15 | if common#functions#HasPlug('vimtex') 16 | exec "VimtexTocToggle" 17 | endif 18 | else 19 | exec "Vista!!" 20 | endif 21 | endfunction 22 | 23 | " nnoremap :Vista!! 24 | nnoremap :call vista_toggle() 25 | -------------------------------------------------------------------------------- /config/plugins/zoomwintab.vim.vim: -------------------------------------------------------------------------------- 1 | nnoremap o :ZoomWinTabToggle 2 | -------------------------------------------------------------------------------- /config/theme/statusline.vim: -------------------------------------------------------------------------------- 1 | " 自定义状态栏和tab栏 2 | if common#functions#HasPlug('vim-crystalline') 3 | \ || common#functions#HasPlug('lightline.vim') 4 | \ || common#functions#HasPlug('vim-airline') 5 | \ || common#functions#HasPlug('eleline.vim') 6 | \ || common#functions#HasPlug('lualine.nvim') 7 | finish 8 | endif 9 | 10 | " 状态栏 11 | " set statusline=2 12 | 13 | " 黑名单 14 | let s:disable_statusline = 15 | \ ['defx', 'denite', 'vista', 'tagbar', 'undotree', 'diff', 'peekaboo', 'sidemenu', 'qf', 'coc-explorer', 'startify', 'vim-plug'] 16 | " \ 'defx\|denite\|vista\|tagbar\|undotree\|diff\|peekaboo\|sidemenu\|qf\|coc-explorer\|startify\|vim-plug' 17 | 18 | let s:stl = "" 19 | let s:stl .= "%#ToolbarButton# %{common#functions#ModeLabel()} " 20 | let s:stl .= "%#Substitute# %n %f%h%w%r " 21 | let s:stl .= "%#IncSearch#%{common#functions#ReadOnly()}" 22 | let s:stl .= "%#StatusLine# %{common#functions#GitBranch()} %{common#functions#GitCount()}" 23 | let s:stl .= "%{common#functions#CocStatus()} " 24 | 25 | let s:stl .= "%=" 26 | let s:stl .= "%<" 27 | 28 | if common#functions#HasPlug('vim-scrollstatus') 29 | let s:stl .= '%{ScrollStatus()}' 30 | endif 31 | let s:stl .= "%#StatusLine# [%{&fileformat}] %{&fileencoding?&fileencoding:&encoding} " 32 | let s:stl .= "%#Substitute# %{common#functions#BufLineAndColInfo()} " 33 | let s:stl .= "%#ToolbarButton# %{common#functions#FileType()} " 34 | " let s:stl .= "%#IncSearch#%{common#functions#CocError()}" 35 | 36 | let s:stl_nc = "" 37 | let s:stl_nc .= "%#PmenuThumb# %n %f%h%w%r" 38 | 39 | function s:active() abort 40 | if index(s:disable_statusline, &ft) > 0 41 | return 42 | endif 43 | " if &ft =~? s:disable_statusline 44 | " return 45 | " endif 46 | let &l:statusline = s:stl 47 | endfunction 48 | 49 | function s:inactive() abort 50 | let &l:statusline = s:stl_nc 51 | endfunction 52 | 53 | augroup vime_theme_statusline_group 54 | autocmd! 55 | 56 | autocmd VimEnter,ColorScheme,FileType,WinEnter,BufWinEnter * call s:active() 57 | autocmd WinLeave * call s:inactive() 58 | 59 | autocmd FileChangedShellPost,BufFilePost,BufNewFile,BufWritePost * redrawstatus 60 | augroup END 61 | -------------------------------------------------------------------------------- /config/theme/tabline.vim: -------------------------------------------------------------------------------- 1 | " 自定义tabline 2 | if common#functions#HasPlug('vim-crystalline') 3 | \ || common#functions#HasPlug('lightline.vim') 4 | \ || common#functions#HasPlug('vim-airline') 5 | \ || common#functions#HasPlug('lualine.vim') 6 | finish 7 | set showtabline=2 8 | endif 9 | -------------------------------------------------------------------------------- /config/theme/theme.vim: -------------------------------------------------------------------------------- 1 | " TODO 需要整理,同时要区分一下gui与非gui 2 | if &term =~ '256color' && $TMUX != '' 3 | " disable Background Color Erase (BCE) so that color schemes 4 | " render properly when inside 256-color tmux and GNU screen. 5 | " see also http://snk.tuxfamily.org/log/vim-256color-bce.html 6 | set t_ut= 7 | endif 8 | 9 | if has('termguicolors') 10 | " fix bug for vim 11 | if !has('nvim') 12 | " if &term =~# '^screen\|^tmux' 13 | let &t_8f = "\e[38;2;%lu;%lu;%lum" 14 | let &t_8b = "\e[48;2;%lu;%lu;%lum" 15 | " endif 16 | endif 17 | " enable true color 18 | set termguicolors 19 | endif 20 | " set termguicolors 21 | 22 | " 美化相关基本配置 23 | " 高亮当前行列 24 | set cursorline 25 | set colorcolumn=80 26 | " 光标 27 | set guicursor=n-v-c-sm:block-Cursor,i-ci-ve:ver25-Cursor,r-cr-o:hor20 28 | " 搜索高亮 29 | set incsearch 30 | " 高亮匹配内容 31 | set hlsearch 32 | set list 33 | " 只有set list下面的才会起作用 34 | if &list 35 | set listchars=tab:\|\→·,nbsp:⣿,extends:»,precedes:« 36 | set listchars+=eol:¬ 37 | set listchars+=trail:· 38 | " set listchars+=space:␣ 39 | endif 40 | " 搜索高亮颜色 41 | hi Search ctermfg=17 ctermbg=190 guifg=#000000 guibg=#ffff00 42 | 43 | " 设置弹出框大小, 0 则有多少显示多少 44 | set pumheight=20 45 | if has('nvim') 46 | set pumblend=20 " 提示框透明 47 | endif 48 | 49 | " 主题选择 50 | let g:one_allow_italics = 1 51 | silent! colorscheme edge 52 | -------------------------------------------------------------------------------- /ftplugin/tex.vim: -------------------------------------------------------------------------------- 1 | setl tw=80 2 | setl fo+=t 3 | setl fo-=l 4 | setl fo+=mM 5 | setl spell 6 | setl spelllang=nl,en_gb 7 | -------------------------------------------------------------------------------- /init.vim: -------------------------------------------------------------------------------- 1 | " 载入个人配置 2 | exec "source " . fnamemodify($MYVIMRC, ':h') . "/config.vim" 3 | 4 | " 定义载入配置命令 5 | command! -nargs=1 LoadScript exec 'source ' . g:config_root_path . '' 6 | 7 | " 载入基础配置 8 | LoadScript base.vim 9 | 10 | " vim-plug 载入插件 11 | call plug#begin(get(g:, 'plugins_install_path', '~/.vim/plugin/')) 12 | LoadScript layers.vim 13 | call plug#end() 14 | 15 | " 载入快捷键配置 16 | LoadScript keymap.vim 17 | " 载入主题配置 18 | LoadScript theme/theme.vim 19 | LoadScript theme/statusline.vim 20 | LoadScript theme/tabline.vim 21 | 22 | " 依据插件名字载入对应的插件配置 23 | function s:source_config(plugName) abort 24 | let l:config_path = g:plugins_config_root_path . a:plugName . ".vim" 25 | if filereadable(l:config_path) 26 | exec 'source' fnameescape(l:config_path) 27 | endif 28 | endfunction 29 | 30 | " TODO 从plug.vim中寻找何时载入插件 31 | " 载入插件配置 32 | for [plugName, _] in items(g:plugs) 33 | if common#functions#HasInstall(plugName) 34 | call s:source_config(plugName) 35 | endif 36 | endfor 37 | -------------------------------------------------------------------------------- /plugin/alt.vim: -------------------------------------------------------------------------------- 1 | " vim中可以使用alt按键 2 | if has('nvim') 3 | finish 4 | endif 5 | 6 | function! Terminal_MetaMode(mode) 7 | set ttimeout 8 | if $TMUX != '' 9 | set ttimeoutlen=30 10 | elseif &ttimeoutlen > 80 || &ttimeoutlen <= 0 11 | set ttimeoutlen=80 12 | endif 13 | if has('nvim') || has('gui_running') 14 | return 15 | endif 16 | function! s:metacode(mode, key) 17 | if a:mode == 0 18 | exec "set =\e".a:key 19 | else 20 | exec "set =\e]{0}".a:key."~" 21 | endif 22 | endfunc 23 | for i in range(10) 24 | call s:metacode(a:mode, nr2char(char2nr('0') + i)) 25 | endfor 26 | for i in range(26) 27 | call s:metacode(a:mode, nr2char(char2nr('a') + i)) 28 | call s:metacode(a:mode, nr2char(char2nr('A') + i)) 29 | endfor 30 | if a:mode != 0 31 | for c in [',', '.', '/', ';', '[', ']', '{', '}'] 32 | call s:metacode(a:mode, c) 33 | endfor 34 | for c in ['?', ':', '-', '_'] 35 | call s:metacode(a:mode, c) 36 | endfor 37 | else 38 | for c in [',', '.', '/', ';', '{', '}'] 39 | call s:metacode(a:mode, c) 40 | endfor 41 | for c in ['?', ':', '-', '_'] 42 | call s:metacode(a:mode, c) 43 | endfor 44 | endif 45 | endfunc 46 | 47 | call Terminal_MetaMode(0) 48 | -------------------------------------------------------------------------------- /plugin/note.vim: -------------------------------------------------------------------------------- 1 | " 使用一句命令,快速记录想法 2 | 3 | function! s:quick_note(text) abort 4 | let text = substitute(a:text, '^\s*\(.\{-}\)\s*$', '\1', '') 5 | 6 | if exists('*writefile') && text != '' 7 | let filename = get(g:, 'quicknote_file', '~/.vim/quicknote.md') 8 | let notehead = get(g:, 'quicknote_head', '- ') 9 | let notetime = strftime('[%Y-%m-%d %H:%M:%S] ') 10 | let realname = expand(filename) 11 | 12 | call writefile([notehead . notetime . text], realname, 'a') 13 | checktime 14 | echo notetime . text 15 | endif 16 | endfunction 17 | 18 | function! s:quick_note_open() abort 19 | let filename = get(g:, 'quicknote_file', '~/.vim/quicknote.md') 20 | let realname = expand(filename) 21 | exec "e " . realname 22 | endfunction 23 | 24 | command! -nargs=+ Note call s:quick_note() 25 | command! NoteOpen call s:quick_note_open() 26 | -------------------------------------------------------------------------------- /plugin/session.vim: -------------------------------------------------------------------------------- 1 | if exists('*HasCocPlug') && exists('*HasPlug') 2 | if common#functions#HasCocPlug('coc-lists') || common#functions#HasPlug('dashboard-nvim', 'vim-startify') 3 | finish 4 | endif 5 | 6 | " 退出vim的时候自动保存session 7 | " session包括三个,session0,session1,session2 8 | " 其中session0表示最近一次的session,而1则表示上上一次,2表示上上上一次 9 | function! s:SaveSession() abort 10 | if !isdirectory(g:session_dir) 11 | call mkdir(g:session_dir) 12 | endif 13 | 14 | let l:sessions = [g:session_dir . '/session_0.vim', 15 | \ g:session_dir. '/session_1.vim', 16 | \ g:session_dir. '/session_2.vim'] 17 | 18 | if filereadable(l:sessions[1]) 19 | call rename(l:sessions[1], l:sessions[2]) 20 | endif 21 | 22 | if filereadable(l:sessions[0]) 23 | call rename(l:sessions[0], l:sessions[1]) 24 | endif 25 | exec "mksession! " . l:sessions[0] 26 | endfunction 27 | 28 | augroup vime_session_group 29 | autocmd! 30 | autocmd VimLeavePre * call s:SaveSession() 31 | augroup END 32 | endif 33 | -------------------------------------------------------------------------------- /scripts/preview.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | REVERSE="\x1b[7m" 4 | RESET="\x1b[m" 5 | 6 | if [ -z "$1" ]; then 7 | echo "usage: $0 FILENAME[:LINENO][:IGNORED]" 8 | exit 1 9 | fi 10 | 11 | IFS=':' read -r -a INPUT <<< "$1" 12 | FILE=${INPUT[0]} 13 | CENTER=${INPUT[1]} 14 | 15 | if [[ $1 =~ ^[A-Z]:\\ ]]; then 16 | FILE=$FILE:${INPUT[1]} 17 | CENTER=${INPUT[2]} 18 | fi 19 | 20 | if [[ -n "$CENTER" && ! "$CENTER" =~ ^[0-9] ]]; then 21 | exit 1 22 | fi 23 | CENTER=${CENTER/[^0-9]*/} 24 | 25 | FILE="${FILE/#\~\//$HOME/}" 26 | if [ ! -r "$FILE" ]; then 27 | echo "File not found ${FILE}" 28 | exit 1 29 | fi 30 | 31 | FILE_LENGTH=${#FILE} 32 | MIME=$(file --dereference --mime "$FILE") 33 | if [[ "${MIME:FILE_LENGTH}" =~ binary ]]; then 34 | echo "$MIME" 35 | exit 0 36 | fi 37 | 38 | if [ -z "$CENTER" ]; then 39 | CENTER=0 40 | fi 41 | 42 | if [ -n "$FZF_PREVIEW_LINES" ]; then 43 | LINES=$FZF_PREVIEW_LINES 44 | else 45 | if [ -r /dev/tty ]; then 46 | LINES=$(stty size < /dev/tty | awk '{print $1}') 47 | else 48 | LINES=40 49 | fi 50 | fi 51 | 52 | FIRST=$(($CENTER-$LINES/3)) 53 | FIRST=$(($FIRST < 1 ? 1 : $FIRST)) 54 | LAST=$((${FIRST}+${LINES}-1)) 55 | 56 | if [ -z "$FZF_PREVIEW_COMMAND" ] && command -v bat > /dev/null; then 57 | bat --style="${BAT_STYLE:-numbers}" --color=always --pager=never \ 58 | --line-range=$FIRST:$LAST --highlight-line=$CENTER "$FILE" 59 | exit $? 60 | fi 61 | 62 | DEFAULT_COMMAND="highlight -O ansi -l {} || coderay {} || rougify {} || cat {}" 63 | CMD=${FZF_PREVIEW_COMMAND:-$DEFAULT_COMMAND} 64 | CMD=${CMD//{\}/$(printf %q "$FILE")} 65 | 66 | eval "$CMD" 2> /dev/null | awk "NR >= $FIRST && NR <= $LAST { \ 67 | if (NR == $CENTER) \ 68 | { gsub(/\x1b[[0-9;]*m/, \"&$REVERSE\"); printf(\"$REVERSE%s\n$RESET\", \$0); } \ 69 | else printf(\"$RESET%s\n\", \$0); \ 70 | }" 71 | 72 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | ./init.vim --------------------------------------------------------------------------------