" ============================================================================= " URL: https://github.com/sainnhe/dotfiles " Filename: .config/nvim/features/light.vim " Author: Sainnhe Park " Email: sainnhe@gmail.com " License: Anti-996 && MIT " ============================================================================= " {{{Color schemes execute 'call custom#colorscheme#' . g:vim_color_scheme . '()' " }}} " {{{Additional UI components " {{{vim-which-key let g:which_key_sort_horizontal = 1 let g:which_key_sep = '' let g:which_key_display_names = {' ': '', '': '↵', '': '', '': 'ﲑ', '': '⇆'} nnoremap :WhichKey '' call which_key#register('', 'g:which_key_map') if !exists('g:which_key_map') let g:which_key_map = { \ 'name': 'Alpha', \ "\": { \ 'name': 'Beta', \ "\": { \ 'name': 'Omega' \ } \ } \ } endif let g:which_key_map['p'] = 'paste' let g:which_key_map['q'] = 'close quickfix' let g:which_key_map['y'] = 'yank' let g:which_key_map["\"]["\"]['h'] = 'highlight' let g:which_key_map[''] = 'which_key_ignore' let g:which_key_map[''] = 'which_key_ignore' " }}} if has('nvim') " {{{indent-blankline.nvim let g:indent_blankline_char = '' " ¦┆│⎸▏ let g:indent_blankline_use_treesitter = 1 let g:indent_blankline_filetype_exclude = ['startify', 'coc-explorer', 'codi', 'help', 'man', 'vtm', 'markdown'] let g:indent_blankline_buftype_exclude = ['terminal'] let g:indent_blankline_show_current_context = 1 set colorcolumn=9999 " Fix for cursorline " }}} " {{{incline.nvim lua require('incline').setup() " }}} else " {{{indentLine call plug#load('indentLine') let g:indentLine_enabled = 1 let g:indentLine_leadingSpaceEnabled = 0 let g:indentLine_concealcursor = 'inc' let g:indentLine_conceallevel = 2 let g:indentLine_char = '' " ¦┆│⎸▏ let g:indentLine_leadingSpaceChar = '·' let g:indentLine_fileTypeExclude = [ 'startify', 'coc-explorer', 'codi', 'help', 'man', 'vtm', 'markdown' ] let g:indentLine_setColors = 0 " disable overwrite with grey by default, use colorscheme instead " }}} endif " }}} " {{{Operators " {{{vim-operator-replace map r (operator-replace) let g:which_key_map['r'] = 'replace' " }}} " {{{vim-operator-surround map sa (operator-surround-append) map sd (operator-surround-delete) map sr (operator-surround-replace) let g:which_key_map['s'] = { \ 'name': 'surround', \ 'a': 'append', \ 'd': 'delete', \ 'r': 'replace' \ } " }}} " }}} " {{{Git Integration " {{{vim-fugitive if !exists("g:which_key_map['g']") let g:which_key_map['g'] = {'name': 'git'} endif noremap gc :Git commit noremap gd :Gdiffsplit noremap gw :Gwrite let g:which_key_map['g']['c'] = 'commit' let g:which_key_map['g']['d'] = 'diff unstaged' let g:which_key_map['g']['w'] = 'write and stage' " {{{twiggy function s:twiggy_toggle() abort if g:twiggy_loaded == 0 call plug#load('vim-fugitive') call FugitiveDetect(getcwd()) let g:twiggy_loaded = 1 endif Twiggy endfunction let g:twiggy_loaded = 0 command Gbranch Twiggy nnoremap gb :call twiggy_toggle() let g:which_key_map['g']['b'] = 'branch' let g:twiggy_local_branch_sort = 'mru' let g:twiggy_num_columns = 35 let g:twiggy_close_on_fugitive_command = 1 let g:twiggy_remote_branch_sort = 'date' let g:twiggy_show_full_ui = 0 " }}} " }}} " {{{mergetool let g:mergetool_layout = 'lr,m' " `l`, `b`, `r`, `m` let g:mergetool_prefer_revision = 'base' " `local`, `base`, `remote` nmap gm (MergetoolToggle) let g:which_key_map['g']['m'] = 'merge' " }}} " }}} " {{{Movement " {{{CamelCaseMotion omap iw CamelCaseMotion_iw xmap iw CamelCaseMotion_iw omap ib CamelCaseMotion_ib xmap ib CamelCaseMotion_ib omap ie CamelCaseMotion_ie xmap ie CamelCaseMotion_ie " }}} " {{{vim-smartword map w (smartword-w) map b (smartword-b) map e (smartword-e) function s:smartword_mappings() abort map (smartword-basic-w) CamelCaseMotion_w map (smartword-basic-b) CamelCaseMotion_b map (smartword-basic-e) CamelCaseMotion_e endfunction augroup SmartWordCustom autocmd! autocmd VimEnter * call smartword_mappings() augroup END " }}} " {{{comfortable-motion.vim let g:comfortable_motion_no_default_key_mappings = 1 let g:comfortable_motion_friction = 80.0 let g:comfortable_motion_air_drag = 2.0 nnoremap :call comfortable_motion#flick(130) nnoremap :call comfortable_motion#flick(-130) " }}} " {{{vim-sneak let g:sneak#s_next = 1 nmap s Sneak_s nmap S Sneak_S xmap s Sneak_s xmap S Sneak_S omap s Sneak_s omap S Sneak_S nmap f Sneak_f nmap F Sneak_F xmap f Sneak_f xmap F Sneak_F omap f Sneak_f omap F Sneak_F nmap t Sneak_t nmap T Sneak_T xmap t Sneak_t xmap T Sneak_T omap t Sneak_t omap T Sneak_T " }}} " }}} " {{{Search " {{{vim-asterisk map * (asterisk-z*)(is-nohl-1) map # (asterisk-z#)(is-nohl-1) map g* (asterisk-gz*)(is-nohl-1) map g# (asterisk-gz#)(is-nohl-1) map z* (asterisk-z*) map gz* (asterisk-gz*) map z# (asterisk-z#) map gz# (asterisk-gz#) " }}} " {{{vim-anzu map n (is-nohl)(anzu-n-with-echo) map N (is-nohl)(anzu-N-with-echo) " }}} " }}} " {{{Pairs " {{{auto-pairs let g:AutoPairsShortcutToggle = 'p' let g:AutoPairsShortcutFastWrap = '`sadsfvf' let g:AutoPairsShortcutJump = '' let g:AutoPairsWildClosedPair = '' let g:AutoPairsMultilineClose = 0 let g:AutoPairsFlyMode = 0 let g:AutoPairsMapCh = 0 inoremap ' ' inoremap " " inoremap ` ` inoremap ( ( inoremap [ [ inoremap { { inoremap ) ) inoremap ] ] inoremap } } inoremap "_xa " }}} " {{{vim-matchup let g:matchup_matchparen_deferred = 1 let g:matchup_matchparen_hi_surround_always = 1 let g:matchup_delim_noskips = 2 let g:matchup_mouse_enabled = 0 " }}} " {{{vim-closetag let g:closetag_shortcut = '>' let g:closetag_close_shortcut = '>' let g:closetag_filenames = '*.html,*.xhtml,*.phtml,*.xml,*.jsx,*.tsx' " }}} " }}} " {{{Other basic features " {{{vim-fixkey " sed -n l if !has('nvim') execute "set =\e," execute "set =\e." execute "set =\e-" execute "set =\e=" endif " }}} " {{{editorconfig-vim let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] " }}} " {{{vim-peekaboo let g:peekaboo_delay = 500 " }}} if has('nvim') " {{{impatient.nvim lua require('impatient') " }}} " {{{filetype.nvim let g:did_load_filetypes = 1 " }}} endif " }}} " {{{Extended functional components " {{{pomodoro.vim let g:pomodoro_time_work = 25 let g:pomodoro_time_slack = 5 let g:pomodoro_status = 0 nnoremap P :call custom#utils#toggle_pomodoro() let g:which_key_map["\"]["\"]['P'] = 'pomodoro toggle' " }}} " {{{asynctasks let g:asyncrun_open = 6 let g:asyncrun_rootmarks = ['.git', '.svn', '.root', '.project', '.hg'] let g:asynctasks_term_pos = 'bottom' " tab let g:asynctasks_term_rows = 10 let g:asynctasks_config_name = '.git/tasks.ini' noremap trf :AsyncTask file-run noremap trp :AsyncTask project-run noremap tbf :AsyncTask file-build noremap tbp :AsyncTask project-build noremap te :AsyncTaskEdit noremap gp :AsyncRun git push origin HEAD let g:which_key_map['t'] = { \ 'name': 'task', \ 'r': {'name': 'run task', 'f': 'file', 'p': 'project'}, \ 'b': {'name': 'build task', 'f': 'file', 'p': 'project'}, \ 'e': 'edit config' \ } let g:which_key_map['g']['p'] = 'push' " }}} " {{{vim-visual-multi let g:VM_default_mappings = 0 let g:VM_maps = {} let g:VM_maps['Add Cursor At Pos'] = '`' let g:VM_maps['Visual Cursors'] = '`' let g:VM_maps['Switch Mode'] = 'v' nmap ` (VM-Add-Cursor-At-Pos) vmap ` (VM-Visual-Cursors) xmap ` (VM-Visual-Cursors) " }}} " {{{nerdcommenter let g:NERDSpaceDelims = 1 let g:NERDCompactSexyComs = 1 let g:NERDDefaultAlign = 'left' let g:NERDAltDelims_java = 1 let g:NERDCommentEmptyLines = 1 let g:NERDTrimTrailingWhitespace = 1 let g:NERDToggleCheckAllLines = 1 let g:NERDCreateDefaultMappings = 0 nmap ca NERDCommenterComment nmap cu NERDCommenterUncomment nmap cc NERDCommenterToggle xmap ca NERDCommenterComment xmap cu NERDCommenterUncomment xmap cc NERDCommenterToggle let g:which_key_map['c'] = { \ 'name': 'comment', \ 'a': 'comment', \ 'u': 'uncomment', \ 'c': 'toggle', \ } " }}} " {{{vim-translator let g:translator_target_lang = 'zh' let g:translator_source_lang = 'auto' let g:translator_default_engines = ['haici'] nmap t TranslateW vmap t TranslateWV let g:which_key_map["\"]["\"]['t'] = 'translate' " }}} " {{{limelight.vim let g:limelight_default_coefficient = 0.7 nnoremap f :Limelight!! let g:which_key_map["\"]["\"]['f'] = 'focus mode' " }}} " {{{goyo.vim let g:goyo_width = 95 let g:goyo_height = 85 let g:goyo_linenr = 0 augroup GoyoCustom autocmd! User GoyoEnter Limelight autocmd! User GoyoLeave Limelight! augroup END nnoremap r :Goyo let g:which_key_map["\"]["\"]['r'] = 'reading mode' " }}} " {{{mundo let g:mundo_right = 1 let g:mundo_width = 30 nnoremap u :MundoToggle let g:which_key_map["\"]["\"]['u'] = 'undo' " }}} " {{{inline_edit.vim nnoremap e :InlineEdit vnoremap e :InlineEdit let g:which_key_map["\"]['e'] = 'inline edit' " }}} " {{{suda.vim command! -nargs=1 E edit suda:// command W w suda://% " }}} " {{{vim-paste-rs nmap p (paste-rs) xmap p (paste-rs) let g:which_key_map["\"]["\"]['p'] = 'paste.rs' " }}} " {{{vim-carbon-now-sh vnoremap P :CarbonNowSh let g:carbon_now_sh_options = { \ 'ln': 'true', \ 'fm': 'Source Code Pro' \ } " }}} " {{{vim-header let g:header_field_author = 'Sainnhe Park' let g:header_field_author_email = 'sainnhe@gmail.com' nnoremap H :AddHeader let g:which_key_map["\"]["\"]['H'] = 'add header' " }}} if has('nvim') " {{{nabla.nvim nnoremap m :lua require("nabla").popup() let g:which_key_map["\"]["\"]['m'] = 'formula preview' " }}} endif " }}} " {{{Productivity if g:vim_mode ==# 'light' " {{{nerdtree nnoremap :NERDTreeToggle let g:NERDTreeMinimalUI=1 " }}} " {{{vim-mucomplete let g:mucomplete#enable_auto_at_startup = 1 " }}} endif " }}} " vim: set sw=2 ts=2 sts=2 et tw=80 ft=vim fdm=marker fmr={{{,}}}: