├── init.vim ├── doc ├── .gitignore └── dotfiles.jax ├── denops ├── @deps │ ├── .gitignore │ ├── denippet.ts │ └── lspoints.ts ├── @vimrc │ ├── template.ts │ ├── loader.ts │ ├── lib │ │ ├── denops.ts │ │ ├── ahocorasick.ts │ │ └── lambda │ │ │ ├── map.ts │ │ │ └── autocmd.ts │ ├── tmux.ts │ ├── yank.ts │ └── blocksort.ts ├── @ddc-sources │ ├── skk_okuri │ │ ├── split.ts │ │ ├── split_test.ts │ │ ├── dict.ts │ │ └── okuri.ts │ ├── list.ts │ └── lsnippet.ts ├── @ddc-filters │ ├── template.ts │ ├── sorter_fzf │ │ └── fzf_type.ts │ ├── sorter_file.ts │ ├── sorter_ngram.ts │ ├── sorter_fzf.ts │ └── ngram │ │ └── ngram.ts ├── @ddu-filters │ ├── template.ts │ ├── sorter_alpha_path.ts │ ├── converter_color.ts │ ├── sorter_shuffle.ts │ ├── sorter_ngram.ts │ └── ngram │ │ └── ngram.ts ├── @lspoints │ ├── lsputil.ts │ ├── config.ts │ └── semantic_tokens.ts ├── @ddu-sources │ ├── template.ts │ ├── kenshou_1s.ts │ ├── nixpkgs.ts │ └── list.ts └── @ddu-kinds │ ├── callback.ts │ └── nixpkgs.ts ├── .gitignore ├── conf ├── rc │ ├── colors │ │ ├── def │ │ │ ├── elly.vim │ │ │ ├── momiji.vim │ │ │ ├── dawnfox.vim │ │ │ ├── dracula.vim │ │ │ ├── hydrangea.vim │ │ │ ├── nightfox.vim │ │ │ ├── sonokai.vim │ │ │ ├── terafox.vim │ │ │ ├── shirotelin.vim │ │ │ ├── tokyonight.vim │ │ │ ├── default.vim │ │ │ ├── iceberg.vim │ │ │ ├── rigel.vim │ │ │ ├── ayu_dark.vim │ │ │ ├── ayu_light.vim │ │ │ ├── ayu_mirage.vim │ │ │ ├── github_dark.vim │ │ │ ├── quantum_dark.vim │ │ │ ├── solarized8_light.vim │ │ │ ├── vadelma_dark.vim │ │ │ ├── quantum_light.vim │ │ │ ├── vadelma_light.vim │ │ │ ├── everforest_dark.vim │ │ │ ├── everforest_light.vim │ │ │ ├── github_light.vim │ │ │ ├── aomi_grayscale_light.vim │ │ │ ├── carbonfox.vim │ │ │ ├── edge_black.vim │ │ │ ├── gruvbox.vim │ │ │ ├── common │ │ │ │ └── transparent.vim │ │ │ ├── catppuccin-mocha_transparent.vim │ │ │ ├── aomi-grayscale_dark.vim │ │ │ ├── edge_dark.vim │ │ │ ├── aomi-grayscale_dark_transparent.vim │ │ │ ├── edge_dark_transparent.vim │ │ │ ├── catppuccin-latte.vim │ │ │ ├── catppuccin-latte_bluenote.vim │ │ │ ├── edge_light.vim │ │ │ ├── catppuccin-mocha.vim │ │ │ ├── gruvbit_monaqa.vim │ │ │ └── candy.vim │ │ └── select.vim │ ├── mode │ │ ├── t │ │ │ └── map.vim │ │ ├── ov │ │ │ └── map.vim │ │ └── ic │ │ │ ├── opt.vim │ │ │ └── map.vim │ ├── vim │ │ ├── opt.vim │ │ ├── tmux_zh.vim │ │ ├── compat_uiselect.lua │ │ └── bracketed_paste.vim │ ├── nvim │ │ ├── opt.lua │ │ ├── ui_select.lua │ │ └── hack.lua │ ├── on_autocmd.vim │ ├── on_autocmd │ │ ├── quickfixcmdpost.vim │ │ └── cmd_undefined.vim │ ├── autocmd.vim │ ├── mode.vim │ ├── colors.vim │ ├── opt.vim │ └── mappings.vim ├── fallback.vim ├── plug │ ├── nvim │ │ ├── colorscheme.toml │ │ ├── diagnostic.lua │ │ ├── dial.lua │ │ ├── nvim_lsp.toml │ │ ├── insx │ │ │ └── nix.lua │ │ ├── telescope.toml │ │ ├── lspconfig.lua │ │ ├── treesitter.toml │ │ ├── main.toml │ │ └── insx.lua │ ├── filetype_vim.toml │ ├── vim │ │ ├── lexima │ │ │ ├── nix.vim │ │ │ └── vim.vim │ │ ├── main.toml │ │ └── lexima.vim │ ├── coc.toml │ ├── ddu │ │ ├── template.ts │ │ ├── lib │ │ │ └── helper.ts │ │ └── filer.ts │ ├── vim_lsp.toml │ ├── deno.toml │ ├── lspoints.toml │ ├── filetype_help.toml │ ├── denippet.vim │ ├── dpp.toml │ ├── skkeleton_state_popup.vim │ ├── ddc.vim │ ├── colorscheme.toml │ ├── ddt.toml │ ├── ddc.toml │ ├── lspoints.vim │ ├── ddc │ │ └── main.ts │ ├── skkeleton.vim │ └── ddu.toml ├── dpp.vim └── makestate.vim ├── ftplugin ├── vim.vim ├── qf.vim ├── nix.vim ├── help.vim └── toml.vim ├── after ├── syntax │ └── diff.vim ├── ftplugin │ └── vim.vim └── queries │ └── unifieddiff │ ├── highlights.scm │ └── unifieddiff.scm ├── script ├── gitupdate │ ├── .gitignore │ ├── task │ │ ├── pull.sh │ │ ├── fetch.sh │ │ ├── clean.sh │ │ ├── clone.sh │ │ ├── fget2.sh │ │ └── fget.sh │ ├── fget │ ├── denops_snapshot.vim │ ├── snap │ │ ├── shot │ │ ├── diff │ │ ├── dps_shot.ts │ │ ├── shot.ts │ │ ├── libsnapshot.ts │ │ ├── diff.ts │ │ └── dps_diff.ts │ ├── util.ts │ ├── dpp_dump.ts │ ├── denops_view.vim │ └── denops_view.ts ├── build │ ├── build │ │ ├── telescope-fzf-native.sh │ │ ├── coc.sh │ │ ├── treesitter │ │ │ └── unifieddiff.sh │ │ ├── importmap-expand.sh │ │ └── deno_std.ts │ ├── build.sh │ └── build.toml └── time │ ├── time.sh │ └── time.ts ├── snippets ├── markdown.toml ├── sh.toml ├── toml.toml ├── vim.toml ├── vim.ts └── typescript.toml ├── f ├── stylua.toml ├── vimrcs ├── mini.vim └── man.vim ├── version.txt ├── lua └── vimrc │ ├── ui_select.lua │ ├── plug │ └── skkeleton │ │ ├── tsukimod.txt │ │ └── tsuki2-263mod.lua │ ├── treesitter_hack.lua │ ├── feat │ ├── select_action.lua │ └── ui_select_fzf.lua │ └── conv.lua ├── autoload ├── vimrc │ ├── lazy.vim │ ├── autocmd │ │ ├── auto_mkdir.vim │ │ └── shebang.vim │ ├── denops_loader.vim │ ├── inline.vim │ ├── keycode.vim │ ├── feat │ │ ├── clipboard.vim │ │ ├── terminal.vim │ │ ├── format.vim │ │ └── tweet.vim │ ├── git.vim │ ├── mru.vim │ ├── inline │ │ └── cache.vim │ ├── denops.vim │ └── dpp.vim ├── p │ ├── ddu.vim │ ├── gin.vim │ └── ddu │ │ └── ff.vim └── operandi │ └── type │ ├── myterm.vim │ └── mycommand.vim ├── bundle ├── vim-operandi │ └── autoload │ │ ├── operandi │ │ ├── opener │ │ │ └── tab.vim │ │ └── type │ │ │ └── command.vim │ │ └── operandi.vim └── gin-preview.vim │ └── plugin │ └── gin_preview.vim ├── t ├── coc-settings.json ├── e ├── README.md ├── vimrc ├── init ├── f.ts └── colors └── candy.vim /init.vim: -------------------------------------------------------------------------------- 1 | vimrc -------------------------------------------------------------------------------- /doc/.gitignore: -------------------------------------------------------------------------------- 1 | /tags* 2 | -------------------------------------------------------------------------------- /denops/@deps/.gitignore: -------------------------------------------------------------------------------- 1 | /*.ts 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /conf/plug/x.toml 2 | /local 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/elly.vim: -------------------------------------------------------------------------------- 1 | colorscheme elly 2 | -------------------------------------------------------------------------------- /ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | let g:vim_indent_cont = 0 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/momiji.vim: -------------------------------------------------------------------------------- 1 | colorscheme momiji 2 | -------------------------------------------------------------------------------- /conf/rc/mode/t/map.vim: -------------------------------------------------------------------------------- 1 | tnoremap 2 | -------------------------------------------------------------------------------- /after/syntax/diff.vim: -------------------------------------------------------------------------------- 1 | syntax match diffIndicator /^ / 2 | -------------------------------------------------------------------------------- /conf/fallback.vim: -------------------------------------------------------------------------------- 1 | source $VIMCONF/conf/rc/mappings.vim 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/dawnfox.vim: -------------------------------------------------------------------------------- 1 | colorscheme dawnfox 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/dracula.vim: -------------------------------------------------------------------------------- 1 | colorscheme dracula 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/hydrangea.vim: -------------------------------------------------------------------------------- 1 | colorscheme hydrangea 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/nightfox.vim: -------------------------------------------------------------------------------- 1 | colorscheme nightfox 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/sonokai.vim: -------------------------------------------------------------------------------- 1 | colorscheme sonokai 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/terafox.vim: -------------------------------------------------------------------------------- 1 | colorscheme terafox 2 | -------------------------------------------------------------------------------- /conf/rc/vim/opt.vim: -------------------------------------------------------------------------------- 1 | set incsearch 2 | set autoindent 3 | -------------------------------------------------------------------------------- /script/gitupdate/.gitignore: -------------------------------------------------------------------------------- 1 | /a.json 2 | /tasks.json 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/shirotelin.vim: -------------------------------------------------------------------------------- 1 | colorscheme shirotelin 2 | -------------------------------------------------------------------------------- /conf/rc/colors/def/tokyonight.vim: -------------------------------------------------------------------------------- 1 | colorscheme tokyonight 2 | -------------------------------------------------------------------------------- /conf/rc/nvim/opt.lua: -------------------------------------------------------------------------------- 1 | -- 画面が!狭い!! 2 | vim.opt.laststatus = 1 3 | -------------------------------------------------------------------------------- /snippets/markdown.toml: -------------------------------------------------------------------------------- 1 | [link] 2 | body = "[$1]($2)$0" 3 | 4 | -------------------------------------------------------------------------------- /conf/rc/colors/def/default.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme default 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/iceberg.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme iceberg 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/rigel.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme rigel 3 | -------------------------------------------------------------------------------- /ftplugin/qf.vim: -------------------------------------------------------------------------------- 1 | " override global mapping 2 | nnoremap 3 | -------------------------------------------------------------------------------- /snippets/sh.toml: -------------------------------------------------------------------------------- 1 | [cdir] 2 | body = "cd \$(dirname \$0) || exit 1" 3 | 4 | -------------------------------------------------------------------------------- /conf/rc/colors/def/ayu_dark.vim: -------------------------------------------------------------------------------- 1 | let g:ayucolor = 'dark' 2 | colorscheme ayu 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/ayu_light.vim: -------------------------------------------------------------------------------- 1 | let g:ayucolor = 'light' 2 | colorscheme ayu 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/ayu_mirage.vim: -------------------------------------------------------------------------------- 1 | let g:ayucolor = 'mirage' 2 | colorscheme ayu 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/github_dark.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme github 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/quantum_dark.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme quantum 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/solarized8_light.vim: -------------------------------------------------------------------------------- 1 | set bg=light 2 | colorscheme solarized8 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/vadelma_dark.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme vadelma 3 | -------------------------------------------------------------------------------- /script/build/build/telescope-fzf-native.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | make -j$(nproc) 3 | -------------------------------------------------------------------------------- /snippets/toml.toml: -------------------------------------------------------------------------------- 1 | [snippet] 2 | body = """ 3 | [$0] 4 | body = "" 5 | """ 6 | 7 | -------------------------------------------------------------------------------- /conf/rc/colors/def/quantum_light.vim: -------------------------------------------------------------------------------- 1 | set background=light 2 | colorscheme quantum 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/vadelma_light.vim: -------------------------------------------------------------------------------- 1 | set background=light 2 | colorscheme vadelma 3 | -------------------------------------------------------------------------------- /f: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S bash -u 2 | 3 | cd $(dirname $0) || exit 1 4 | deno run -A f.ts 5 | -------------------------------------------------------------------------------- /stylua.toml: -------------------------------------------------------------------------------- 1 | quote_style = "AutoPreferSingle" 2 | call_parentheses = "NoSingleTable" 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/everforest_dark.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme everforest 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/everforest_light.vim: -------------------------------------------------------------------------------- 1 | set background=light 2 | colorscheme everforest 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/github_light.vim: -------------------------------------------------------------------------------- 1 | colorscheme github-light 2 | hi DiffDelete guifg=#ffeef0 3 | -------------------------------------------------------------------------------- /conf/rc/vim/tmux_zh.vim: -------------------------------------------------------------------------------- 1 | " tmux使ってたらイタリックしない 2 | if !empty($TMUX) 3 | set t_ZH= 4 | endif 5 | -------------------------------------------------------------------------------- /vimrcs/mini.vim: -------------------------------------------------------------------------------- 1 | " 最小構成の上で作業するためのコピペ用vimrc 2 | nnoremap Q cquit 42 3 | nnoremap ' : 4 | -------------------------------------------------------------------------------- /conf/plug/nvim/colorscheme.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/rktjmp/lush.nvim' 3 | 4 | -------------------------------------------------------------------------------- /conf/rc/colors/def/aomi_grayscale_light.vim: -------------------------------------------------------------------------------- 1 | set background=light 2 | colorscheme aomi-grayscale 3 | -------------------------------------------------------------------------------- /after/ftplugin/vim.vim: -------------------------------------------------------------------------------- 1 | " textwidth breaks ddc.vim 2 | " so I don't like this feature. 3 | setlocal textwidth=0 4 | -------------------------------------------------------------------------------- /conf/rc/colors/def/carbonfox.vim: -------------------------------------------------------------------------------- 1 | colorscheme carbonfox 2 | 3 | " TSnip(というかnui.nvim)の枠用 4 | hi VertSplit guifg=white 5 | -------------------------------------------------------------------------------- /script/gitupdate/task/pull.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | path="$1" 4 | 5 | cd "${path}" || exit 1 6 | git pull --progress 7 | -------------------------------------------------------------------------------- /version.txt: -------------------------------------------------------------------------------- 1 | version1 pathogen.vim 2 | version2 vim-plug 3 | version3 minpac 4 | version4 dein.vim 5 | version5 dpp.vim 6 | -------------------------------------------------------------------------------- /conf/plug/filetype_vim.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/ogaken-1/vim-vimscript-gd' 3 | on_ft = ['vim'] 4 | 5 | -------------------------------------------------------------------------------- /conf/plug/vim/lexima/nix.vim: -------------------------------------------------------------------------------- 1 | call lexima#add_rule({'char': '', 'at': ' =\%#$', 'input_after': ';', 'filetype': 'nix'}) 2 | -------------------------------------------------------------------------------- /denops/@deps/denippet.ts: -------------------------------------------------------------------------------- 1 | export type { TSSnippet } from "/data/vim/repos/github.com/uga-rosa/denippet.vim/denops/denippet/loader.ts"; 2 | -------------------------------------------------------------------------------- /lua/vimrc/ui_select.lua: -------------------------------------------------------------------------------- 1 | local ui = 'fzf-lua' 2 | 3 | if ui == 'fzf-lua' then 4 | require('fzf-lua').register_ui_select() 5 | end 6 | -------------------------------------------------------------------------------- /script/gitupdate/task/fetch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | path="$1" 4 | 5 | cd "${path}" || exit 1 6 | git fetch --progress --all --prune 7 | -------------------------------------------------------------------------------- /conf/rc/nvim/ui_select.lua: -------------------------------------------------------------------------------- 1 | vim.ui.select = function(...) 2 | vim.ui.select = error 3 | require('vimrc.ui_select') 4 | vim.ui.select(...) 5 | end 6 | -------------------------------------------------------------------------------- /script/build/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | cd $1 || exit 1 3 | ls -1A --color=never | grep -v '^\.git$' | xargs rm -rf 4 | git reset --hard @{u} 5 | exec $2 6 | -------------------------------------------------------------------------------- /conf/rc/colors/def/edge_black.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme edge 3 | hi Normal guibg=black 4 | hi NormalNC guibg=black 5 | hi EndOfBuffer guibg=black 6 | -------------------------------------------------------------------------------- /script/build/build/coc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | shopt -s globstar 4 | 5 | #npm ci 6 | deno cache **/*.ts || true 7 | npm run build 8 | rm -rf node_modules 9 | -------------------------------------------------------------------------------- /conf/plug/nvim/diagnostic.lua: -------------------------------------------------------------------------------- 1 | vim.diagnostic.config { 2 | virtual_text = true, 3 | jump = { 4 | float = true, 5 | }, 6 | severity_sort = true, 7 | } 8 | -------------------------------------------------------------------------------- /conf/plug/vim/lexima/vim.vim: -------------------------------------------------------------------------------- 1 | " 変数のprefixの:をスペースで打てるようにしてみる 2 | call lexima#add_rule({'char': '', 'at': '\<[bwtglsav]\%#', 'input': ':', 'filetype': 'vim'}) 3 | -------------------------------------------------------------------------------- /conf/rc/colors/def/gruvbox.vim: -------------------------------------------------------------------------------- 1 | " simulates original gruvbox 2 | let g:gruvbox_material_palette = 'original' 3 | set background=dark 4 | colorscheme gruvbox-material 5 | -------------------------------------------------------------------------------- /script/build/build/treesitter/unifieddiff.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -eux 2 | 3 | mkdir parser 4 | clang -fPIC -shared -o parser/unifieddiff.so -Isrc src/parser.c src/scanner.c 5 | -------------------------------------------------------------------------------- /conf/rc/vim/compat_uiselect.lua: -------------------------------------------------------------------------------- 1 | vim.ui = { 2 | select = function(...) 3 | vim.ui.select = require('vimrc.feat.ui_select_fzf') 4 | vim.ui.select(...) 5 | end 6 | } 7 | -------------------------------------------------------------------------------- /autoload/vimrc/lazy.vim: -------------------------------------------------------------------------------- 1 | function vimrc#lazy#on_map(keys, plugin) 2 | execute 'nunmap ' .. a:keys 3 | call dpp#source(a:plugin) 4 | call feedkeys(a:keys, 'it') 5 | endfunction 6 | -------------------------------------------------------------------------------- /conf/rc/vim/bracketed_paste.vim: -------------------------------------------------------------------------------- 1 | " ぶらぶらけっと from `:h xterm-bracketed-paste` 2 | let &t_BE = "\e[?2004h" 3 | let &t_BD = "\e[?2004l" 4 | exec "set t_PS=\e[200~" 5 | exec "set t_PE=\e[201~" 6 | -------------------------------------------------------------------------------- /bundle/vim-operandi/autoload/operandi/opener/tab.vim: -------------------------------------------------------------------------------- 1 | function operandi#opener#tab#open() 2 | tabnew 3 | endfunction 4 | 5 | function operandi#opener#tab#close() 6 | tabclose 7 | endfunction 8 | -------------------------------------------------------------------------------- /script/gitupdate/fget: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | if [[ ! -e /tmp/dpp/repos ]]; then 3 | mkdir -p /tmp/dpp 4 | ln -s /data/vim/repos /tmp/dpp/repos 5 | fi 6 | deno run -A run.ts task/fget.sh < tasks.json 7 | -------------------------------------------------------------------------------- /conf/plug/coc.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'neoclide/coc.nvim' 3 | hook_add = ''' 4 | let g:coc_config_home = '$VIMCONF' 5 | " L 6 | let g:ddu_source_lsp_clientName = 'coc.nvim' 7 | ''' 8 | -------------------------------------------------------------------------------- /conf/rc/on_autocmd.vim: -------------------------------------------------------------------------------- 1 | autocmd vimrc CmdUndefined * ++once source $VIMCONF/conf/rc/on_autocmd/cmd_undefined.vim 2 | autocmd vimrc QuickFixCmdPost * ++once source $VIMCONF/conf/rc/on_autocmd/quickfixcmdpost.vim 3 | -------------------------------------------------------------------------------- /t: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | deno run -A script/time/time.ts script/time/time.sh 5 | rm -f /tmp/profile 6 | nvim --cmd 'profile start /tmp/profile' --cmd 'profile file *' -u vimrc +q 7 | -------------------------------------------------------------------------------- /script/time/time.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | cd $(dirname $0) 5 | cd ../.. 6 | nvim -u vimrc --headless --startuptime $1 -c "autocmd VimEnter * call timer_start(0, {...->execute('cquit')})" 7 | -------------------------------------------------------------------------------- /snippets/vim.toml: -------------------------------------------------------------------------------- 1 | [augroup] 2 | body = """\ 3 | augroup $1 4 | \tautocmd! 5 | \t$0 6 | augroup END\ 7 | """ 8 | 9 | [function] 10 | body = ''' 11 | function $1($2) abort 12 | $0 13 | endfunction 14 | ''' 15 | -------------------------------------------------------------------------------- /conf/rc/on_autocmd/quickfixcmdpost.vim: -------------------------------------------------------------------------------- 1 | " from https://github.com/Omochice/dotfiles/blob/3afd434871f312ef19ecc792abea9fdda7f1f8af/config/nvim/vimrc.core#L287-L288 2 | nnoremap qn cnext 3 | nnoremap qp cprev 4 | -------------------------------------------------------------------------------- /lua/vimrc/plug/skkeleton/tsukimod.txt: -------------------------------------------------------------------------------- 1 | □2-263mod配列図 2 | そこしてょ つんいのりち 3 | はか★とた くう★゛◇れ 4 | すけになさ っる、。き・ 5 | 6 | ぁひほふめ ぬえみやぇ「 7 | ぃをらあよ まおもわぉ」 8 | ぅへせゅゃ むろねーゆ 9 | 10 | ◇をSKKのsticky keyにしている 11 | 特殊ルールとして゜の前置は゛゛相当の物を前置する必要がある 12 | -------------------------------------------------------------------------------- /conf/plug/ddu/template.ts: -------------------------------------------------------------------------------- 1 | import { 2 | BaseConfig, 3 | ConfigArguments, 4 | } from "jsr:@shougo/ddu-vim/config"; 5 | 6 | export class Config extends BaseConfig { 7 | override async config(args: ConfigArguments) { 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /conf/rc/colors/def/common/transparent.vim: -------------------------------------------------------------------------------- 1 | function s:transparent() abort 2 | hi EndOfBuffer guibg=NONE 3 | hi NonText guibg=NONE 4 | hi Normal guibg=NONE 5 | hi NormalNC guibg=NONE 6 | endfunction 7 | autocmd persistent_colorscheme ColorScheme * call s:transparent() 8 | -------------------------------------------------------------------------------- /script/gitupdate/task/clean.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | cd $1 4 | [[ -e .vimrc_hash ]] && exit 5 | [[ ! -e .git ]] && exit 6 | ls -1A --color=never | grep -v '^\.git$' | xargs rm -rf 7 | git restore . 8 | /data/vim/repos/github.com/WayneD/rsync/support/git-set-file-times 9 | -------------------------------------------------------------------------------- /conf/dpp.vim: -------------------------------------------------------------------------------- 1 | set runtimepath^=/data/vim/repos/github.com/Shougo/dpp.vim 2 | 3 | let g:vimrc#dpp_base = $DPP_BASE ?? '/tmp/dpp' 4 | if dpp#min#load_state(g:vimrc#dpp_base) 5 | autocmd vimrc User Dpp:makeStatePost quit! 6 | source $VIMCONF/conf/makestate.vim 7 | finish 8 | endif 9 | -------------------------------------------------------------------------------- /script/build/build/importmap-expand.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | shopt -s globstar 4 | if [[ -e deno.json ]]; then 5 | denojson=deno.json 6 | else 7 | denojson=deno.jsonc 8 | fi 9 | deno run -A /data/vim/repos/github.com/Omochice/importmap-expand/cli.ts **/*.ts --option $denojson 10 | -------------------------------------------------------------------------------- /coc-settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "languageserver": { 3 | "denols": { 4 | "args": ["lsp"], 5 | "command": "deno", 6 | "settings": { 7 | "deno": { 8 | "enable": true 9 | } 10 | }, 11 | "filetypes": ["typescript"] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /conf/plug/vim_lsp.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/mattn/vim-lsp-settings' 3 | merged = false 4 | 5 | [[plugins]] 6 | repo = 'https://github.com/prabirshrestha/vim-lsp' 7 | hook_add = ''' 8 | " L 9 | let g:ddu_source_lsp_clientName = 'vim-lsp' 10 | ''' 11 | 12 | -------------------------------------------------------------------------------- /conf/rc/nvim/hack.lua: -------------------------------------------------------------------------------- 1 | -- 起動時にrequireしたくないねん 2 | local _ = getmetatable(vim) 3 | local __index = _.__index 4 | _.__index = function(self, key) 5 | if key == 'treesitter' then 6 | require('vimrc.treesitter_hack') 7 | _.__index = __index 8 | end 9 | return __index(self, key) 10 | end 11 | -------------------------------------------------------------------------------- /script/gitupdate/task/clone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | path="$1" 4 | repo="$2" 5 | rev="$3" 6 | 7 | if [[ -e "${path}" ]]; then 8 | exit 9 | fi 10 | 11 | git clone --progress "${repo}" "${path}" || exit 1 12 | if [[ "${rev}" != "" ]]; then 13 | cd "${path}" 14 | git switch "${rev}" 15 | fi 16 | -------------------------------------------------------------------------------- /autoload/p/ddu.vim: -------------------------------------------------------------------------------- 1 | function p#ddu#wait() 2 | let chars = '' 3 | while v:true 4 | let char = getcharstr(0) 5 | let chars ..= char 6 | sleep 1m 7 | if get(g:, 'vimrc#ddu#ready', v:false) 8 | break 9 | endif 10 | endwhile 11 | call feedkeys(chars, 'it') 12 | endfunction 13 | -------------------------------------------------------------------------------- /denops/@deps/lspoints.ts: -------------------------------------------------------------------------------- 1 | export { 2 | BaseExtension, 3 | type Client, 4 | type Lspoints, 5 | } from "/data/vim/repos/github.com/kuuote/lspoints/denops/lspoints/interface.ts"; 6 | export { 7 | LSP, 8 | LSPTypes, 9 | } from "/data/vim/repos/github.com/kuuote/lspoints/denops/lspoints/deps/lsp.ts"; 10 | -------------------------------------------------------------------------------- /autoload/vimrc/autocmd/auto_mkdir.vim: -------------------------------------------------------------------------------- 1 | function vimrc#autocmd#auto_mkdir#do() abort 2 | " auto mkdir 3 | let dir = expand(':p:h') 4 | if !isdirectory(dir) 5 | if confirm(dir .. ' is not found. create it?', "&Yes\n&No", 2) == 1 6 | call mkdir(dir, 'p') 7 | endif 8 | endif 9 | endfunction 10 | -------------------------------------------------------------------------------- /denops/@vimrc/template.ts: -------------------------------------------------------------------------------- 1 | import { Denops } from "jsr:@denops/std"; 2 | 3 | export async function main(denops: Denops) { 4 | denops.dispatcher = { 5 | async test() { 6 | await denops.cmd("echomsg msg", { msg: "hello" }); 7 | }, 8 | }; 9 | await denops.cmd("echomsg msg", { msg: "loaded" }); 10 | } 11 | -------------------------------------------------------------------------------- /denops/@ddc-sources/skk_okuri/split.ts: -------------------------------------------------------------------------------- 1 | export function split(text: string): [string, string][] { 2 | if (text === "") { 3 | return []; 4 | } 5 | const a = [...text]; 6 | const r = Array.from(Array(a.length - 1), (_, i) => a.length - 1 - i); 7 | return r.map((i) => [a.slice(0, i).join(""), a.slice(i).join("")]); 8 | } 9 | -------------------------------------------------------------------------------- /autoload/vimrc/denops_loader.vim: -------------------------------------------------------------------------------- 1 | let s:count = 0 2 | 3 | function vimrc#denops_loader#load(path, sync = v:false) abort 4 | let name = 'loader_' .. s:count 5 | let s:count += 1 6 | call vimrc#denops#load(name, a:path) 7 | if a:sync 8 | call denops#plugin#wait(name) 9 | endif 10 | return name 11 | endfunction 12 | -------------------------------------------------------------------------------- /conf/plug/deno.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/denoland/deno_std' 3 | 4 | [[plugins]] 5 | repo = 'https://github.com/jsr-core/unknownutil' 6 | 7 | [[plugins]] 8 | repo = 'https://github.com/uga-rosa/deno-denops-lsputil' 9 | 10 | [[plugins]] 11 | repo = 'https://github.com/vim-denops/deno-denops-std' 12 | 13 | -------------------------------------------------------------------------------- /conf/plug/nvim/dial.lua: -------------------------------------------------------------------------------- 1 | local augend = require('dial.augend') 2 | require('dial.config').augends:register_group { 3 | default = { 4 | augend.integer.alias.decimal, -- nonnegative decimal number 5 | augend.integer.alias.hex, -- nonnegative hex number 6 | augend.constant.alias.bool, -- boolean value (true <-> false) 7 | }, 8 | } 9 | -------------------------------------------------------------------------------- /conf/rc/colors/def/catppuccin-mocha_transparent.vim: -------------------------------------------------------------------------------- 1 | source $VIMCONF/conf/rc/colors/def/common/transparent.vim 2 | function s:autocmd() abort 3 | hi Comment guifg=white gui=undercurl 4 | endfunction 5 | autocmd persistent_colorscheme ColorScheme catppuccin-mocha call s:autocmd() 6 | source $VIMCONF/conf/rc/colors/def/catppuccin-mocha.vim 7 | -------------------------------------------------------------------------------- /conf/rc/mode/ov/map.vim: -------------------------------------------------------------------------------- 1 | " colon 2 | xnoremap ' : 3 | 4 | " fake textobj-entire 5 | onoremap ae normal! gg0vG$ 6 | xnoremap ae gg0oG$ 7 | 8 | " yank operation 9 | "" L 10 | xnoremap call vimrc#denops#notify('yank', 'yank', [getregion(getpos('v'), getpos('.'), #{type: mode()})]): 11 | 12 | -------------------------------------------------------------------------------- /script/gitupdate/denops_snapshot.vim: -------------------------------------------------------------------------------- 1 | call vimrc#denops_loader#load('$VIMCONF/script/gitupdate/dpp_dump.ts'->expand(), v:true) 2 | let s:shot = vimrc#denops_loader#load('$VIMCONF/script/gitupdate/snap/dps_shot.ts'->expand(), v:true) 3 | call denops#request(s:shot, 'run', [['$VIMCONF/script/gitupdate/tasks.json'->expand()], '/data/vim/snapshot']) 4 | -------------------------------------------------------------------------------- /conf/rc/colors/def/aomi-grayscale_dark.vim: -------------------------------------------------------------------------------- 1 | function s:on_colorscheme() abort 2 | let s:white = "#e4ecf3" 3 | " Neovimでなぜか色が付いているので埋め 4 | execute 'hi Function guifg=' .. s:white 5 | endfunction 6 | autocmd persistent_colorscheme ColorScheme aomi-grayscale call s:on_colorscheme() 7 | 8 | set background=dark 9 | colorscheme aomi-grayscale 10 | -------------------------------------------------------------------------------- /conf/plug/lspoints.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/kuuote/lspoints' 3 | on_cmd = 'LspointsStart' 4 | on_ft = [ 5 | 'lua', 6 | 'typescript', 7 | 'typescriptreact', 8 | ] 9 | hook_add = ''' 10 | nnoremap ll LspointsStart 11 | ''' 12 | hook_source = ''' 13 | source $VIMCONF/conf/plug/lspoints.vim 14 | ''' 15 | 16 | -------------------------------------------------------------------------------- /conf/plug/filetype_help.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/4513ECHO/vim-vimhelp-hoptag' 3 | on_ft = ['help'] 4 | 5 | [plugins.ftplugin] 6 | help = ''' 7 | nnoremap (hoptag-next) 8 | nnoremap (hoptag-prev) 9 | nnoremap (hoptag-next) 10 | nnoremap (hoptag-prev) 11 | ''' 12 | -------------------------------------------------------------------------------- /conf/plug/nvim/nvim_lsp.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/neovim/nvim-lspconfig' 3 | lazy = true 4 | lua_add = ''' 5 | function LspStart() 6 | vim.call('dpp#source', { 'nvim-lspconfig' }) 7 | _LspStart() 8 | end 9 | vim.keymap.set('n', 'ln', LspStart) 10 | ''' 11 | hook_source = ''' 12 | source $VIMCONF/conf/plug/nvim/lspconfig.lua 13 | ''' 14 | 15 | -------------------------------------------------------------------------------- /e: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | # よくよく考えた毎回暖かみのある手作業で起動しているのは無駄なわけでありまして 4 | # 自動化してしまいましょうの巻 5 | 6 | dir=$(realpath $(dirname $0)) 7 | clear 8 | rm -rf ~/.vim 9 | rm -rf ~/.config/nvim 10 | ln -s $dir ~/.vim 11 | ln -s $dir ~/.config/nvim 12 | if [[ ${newvim_post:-} != 1 ]]; then 13 | rm -rf /tmp/dpp 14 | fi 15 | nvim 16 | [[ $? != 0 ]] && exit 17 | newvim_post=1 exec $0 18 | -------------------------------------------------------------------------------- /autoload/vimrc/inline.vim: -------------------------------------------------------------------------------- 1 | let s:root = '/tmp/inline.vim/' 2 | 3 | function vimrc#inline#load(globpath) abort 4 | let path = s:root .. v:progname .. ($VIMCONF .. a:globpath)->substitute('[$*/]', '_', 'g') .. '.vim' 5 | if getftype(path) ==# 'file' 6 | execute 'source' path 7 | else 8 | call vimrc#inline#cache#load(a:globpath, path) 9 | endif 10 | endfunction 11 | -------------------------------------------------------------------------------- /doc/dotfiles.jax: -------------------------------------------------------------------------------- 1 | *dotfiles.txt* おれの城 2 | 3 | Author: kuuote 4 | License: NYSL 5 | 6 | ============================================================================== 7 | ☆概要 8 | 9 | 面倒臭いので省略 10 | 11 | ------------------------------------------------------------------------------ 12 | ☆コマンド *dotfiles-commands* 13 | 14 | 15 | vim:tw=78:ft=help: 16 | -------------------------------------------------------------------------------- /denops/@ddc-filters/template.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddc-vim/filter"; 2 | import { Item } from "jsr:@shougo/ddc-vim/types"; 3 | 4 | type Never = Record; 5 | 6 | export class Filter extends BaseFilter { 7 | filter(args: FilterArguments): Item[] { 8 | return []; 9 | } 10 | params() { 11 | return {}; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ftplugin/nix.vim: -------------------------------------------------------------------------------- 1 | if !exists('*s:gf') 2 | function! s:gf() 3 | let cfile = expand('') 4 | if cfile[0] ==# '.' 5 | let cfile = simplify(expand('%:p:h') .. '/' .. cfile) 6 | endif 7 | if isdirectory(cfile) 8 | let cfile ..= '/default.nix' 9 | endif 10 | execute 'edit' cfile 11 | endfunction 12 | endif 13 | 14 | nnoremap gf call gf() 15 | -------------------------------------------------------------------------------- /lua/vimrc/treesitter_hack.lua: -------------------------------------------------------------------------------- 1 | local treesitter_disallow_filetype = { 2 | vim = true, 3 | } 4 | 5 | local ts = require("vim.treesitter") 6 | 7 | local start = ts.start 8 | ts.start = function(...) 9 | local filetype = vim.bo[vim.fn.bufnr()].filetype 10 | if not treesitter_disallow_filetype[filetype] then 11 | vim.call("dpp#source", "nvim-treesitter") 12 | return start(...) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /autoload/vimrc/keycode.vim: -------------------------------------------------------------------------------- 1 | " emulates keycode replace like mappings 2 | function vimrc#keycode#replace(keys) abort 3 | return substitute(a:keys, '<[^>]*>', '\=eval(''"\'' .. submatch(0) .. ''"'')', 'g') 4 | endfunction 5 | 6 | " feedkeys wrapper with replace keycodes 7 | function vimrc#keycode#feedkeys(keys, mode = v:null) abort 8 | call feedkeys(vimrc#keycode#replace(a:keys), a:mode) 9 | endfunction 10 | -------------------------------------------------------------------------------- /conf/rc/autocmd.vim: -------------------------------------------------------------------------------- 1 | " 1 augroup宣言は大事 2 | augroup vimrc 3 | 4 | " シバン付いてるファイルに実行権限を与える 5 | autocmd BufWritePost * call vimrc#autocmd#shebang#do() 6 | 7 | " ディレクトリ無かったら掘る 8 | autocmd BufWritePre * call vimrc#autocmd#auto_mkdir#do() 9 | 10 | " 検索時だけhlsearchしてほしい 11 | autocmd CmdlineEnter /,\? set hlsearch 12 | autocmd CmdlineLeave /,\? set nohlsearch 13 | 14 | " 終 augroupはちゃんと閉じるべし 15 | augroup END 16 | 17 | -------------------------------------------------------------------------------- /script/gitupdate/snap/shot: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | cd ${1:-/data/vim} || exit 1 4 | 5 | snapshot=$(realpath snapshot) 6 | rm -f snapshot 7 | 8 | find -type d -name .git | perl -pe 's:^\./::' | perl -pe 's:/\.git$::' | sort | while read repo; do 9 | ( 10 | cd $repo 11 | hash=$(git rev-parse HEAD) 12 | echo -n . 13 | echo $repo >> $snapshot 14 | echo $hash >> $snapshot 15 | ) 16 | done 17 | echo 18 | -------------------------------------------------------------------------------- /autoload/vimrc/feat/clipboard.vim: -------------------------------------------------------------------------------- 1 | let s:path = '/tmp/vimyank' 2 | 3 | function vimrc#feat#clipboard#load() abort 4 | call setreg(v:register, readfile(s:path)->join()->json_decode()) 5 | echo 'restore register from clipboard' 6 | endfunction 7 | 8 | function vimrc#feat#clipboard#save() abort 9 | call writefile([json_encode(getreginfo())], s:path) 10 | echo 'save register to clipboard' 11 | endfunction 12 | -------------------------------------------------------------------------------- /conf/rc/mode/ic/opt.vim: -------------------------------------------------------------------------------- 1 | " ShellScriptやVim scriptの編集に便利なので = を除外 2 | set isfname-== 3 | 4 | " いい感じのBackspace 5 | set backspace=indent,eol,start 6 | 7 | " タイムアウトを設けることによりEscを単体で入力できるようにする 8 | set ttimeout 9 | "" defaults.vimより 10 | set ttimeoutlen=100 11 | 12 | " ファイル名に記号使うよね普通に 13 | set isfname+=@-@ 14 | 15 | " 何でも曖昧なのがいい 16 | set wildoptions+=fuzzy 17 | 18 | " 検索の時にケースを無視 19 | set ignorecase 20 | set smartcase 21 | 22 | -------------------------------------------------------------------------------- /denops/@ddc-sources/skk_okuri/split_test.ts: -------------------------------------------------------------------------------- 1 | import { assertEquals } from "jsr:@std/assert"; 2 | import { split } from "./split.ts"; 3 | 4 | Deno.test({ 5 | name: "split", 6 | fn() { 7 | const expect = [ 8 | ["ばりか", "た"], 9 | ["ばり", "かた"], 10 | ["ば", "りかた"], 11 | ]; 12 | assertEquals(split("ばりかた"), expect); 13 | assertEquals(split("あ"), []); 14 | assertEquals(split(""), []); 15 | }, 16 | }); 17 | -------------------------------------------------------------------------------- /conf/plug/vim/main.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = '4513ECHO/registerm.vim' 3 | on_event = 'TerminalOpen' 4 | hook_source = ''' 5 | autocmd vimrc TerminalOpen * nmap p i(registerm) 6 | autocmd vimrc TerminalOpen * nnoremap p i(registerm) 7 | ''' 8 | 9 | [[plugins]] 10 | repo = 'cohama/lexima.vim' 11 | on_event = 'InsertEnter' 12 | hook_source = ''' 13 | source $VIMCONF/conf/plug/vim/lexima.vim 14 | ''' 15 | 16 | -------------------------------------------------------------------------------- /conf/rc/colors/def/edge_dark.vim: -------------------------------------------------------------------------------- 1 | set background=dark 2 | colorscheme edge 3 | 4 | let s:palette = edge#get_palette('default', 0, {}) 5 | execute 'hi PumHighlight guifg=' .. s:palette.blue[0] 6 | execute 'hi FuzzyMotionChar guifg=' .. s:palette.purple[0] 7 | execute 'hi FuzzyMotionSubChar guifg=' .. s:palette.green[0] 8 | execute 'hi FuzzyMotionMatch guifg=' .. s:palette.blue[0] 9 | execute 'hi FuzzyMotionShade guifg=' .. s:palette.grey_dim[0] 10 | -------------------------------------------------------------------------------- /denops/@ddc-filters/sorter_fzf/fzf_type.ts: -------------------------------------------------------------------------------- 1 | // Note: Currently can't use type declare in npm import at `deno lsp` 2 | type FzfResult = { 3 | item: T; 4 | positions: Set; 5 | score: number; 6 | }; 7 | 8 | type FzfOptions = { 9 | selector?: (item: T) => string; 10 | sort?: boolean; 11 | }; 12 | 13 | export declare class Fzf { 14 | constructor(items: T[], options: FzfOptions); 15 | find(key: string): FzfResult[]; 16 | } 17 | -------------------------------------------------------------------------------- /script/gitupdate/snap/diff: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | cd ${1:-/data/vim} || exit 1 4 | 5 | rm -rf /tmp/vimdiff 6 | mkdir -p /tmp/vimdiff 7 | 8 | cat snapshot | while read repo; read hash; do 9 | ( 10 | cd $repo || exit 11 | [[ "$(git rev-parse @)" = "${hash}" ]] && exit 12 | echo $repo 13 | path=$(echo $repo | perl -pe 's:/:_:g') 14 | git --no-pager diff --stat $hash 15 | git --no-pager diff $hash @ > /tmp/vimdiff/$path.diff 16 | ) 17 | done 18 | -------------------------------------------------------------------------------- /conf/rc/colors/def/aomi-grayscale_dark_transparent.vim: -------------------------------------------------------------------------------- 1 | source $VIMCONF/conf/rc/colors/def/common/transparent.vim 2 | 3 | function s:on_colorscheme() abort 4 | hi Constant guibg=NONE 5 | hi Identifier guibg=NONE 6 | hi Special guibg=NONE 7 | hi Title guibg=NONE 8 | hi Type guibg=NONE 9 | endfunction 10 | autocmd persistent_colorscheme ColorScheme aomi-grayscale call s:on_colorscheme() 11 | 12 | source $VIMCONF/conf/rc/colors/def/aomi-grayscale_dark.vim 13 | 14 | -------------------------------------------------------------------------------- /ftplugin/help.vim: -------------------------------------------------------------------------------- 1 | nnoremap 2 | nnoremap 3 | 4 | function! s:midasi_right() abort 5 | let line = getline('.') 6 | let m = matchlist(line, '\v^(%(.+)\S)?\s*(\*.+\*)') 7 | call setline('.', m[1] .. repeat(' ', 78 - len(m[1]) - len(m[2])) .. m[2]) 8 | endfunction 9 | 10 | " INTRODUCTION *hoge-introduction* 11 | " ↑みたいなやつを右寄せする 12 | command! -buffer MidasiRight call s:midasi_right() 13 | 14 | -------------------------------------------------------------------------------- /conf/rc/mode.vim: -------------------------------------------------------------------------------- 1 | " 複数イベントを定義すると個別にonce適用されるので全部ModeChanged使う 2 | autocmd vimrc ModeChanged *:[ic]* ++once call vimrc#inline#load('$VIMCONF/conf/rc/mode/ic/**/*.vim') 3 | autocmd vimrc ModeChanged *:*[ovV\x16]* ++once call vimrc#inline#load('$VIMCONF/conf/rc/mode/ov/**/*.vim') 4 | if has('nvim') 5 | autocmd vimrc TermOpen * ++once call vimrc#inline#load('$VIMCONF/conf/rc/mode/t/**/*.vim') 6 | else 7 | autocmd vimrc TerminalOpen * ++once call vimrc#inline#load('$VIMCONF/conf/rc/mode/t/**/*.vim') 8 | endif 9 | -------------------------------------------------------------------------------- /conf/plug/nvim/insx/nix.lua: -------------------------------------------------------------------------------- 1 | local insx = require("insx") 2 | -- insx.add("", { 3 | -- enabled = function(ctx) 4 | -- return ctx.filetype == "nix" and ctx.match([[=\%#$]]) 5 | -- end, 6 | -- action = function(ctx) 7 | -- ctx.send(';') 8 | -- end 9 | -- }) 10 | insx.add( 11 | "", 12 | insx.with( 13 | require("insx.recipe.substitute")({ 14 | pattern = [[ =\%#]], 15 | replace = [[ = \%#;]], 16 | }), 17 | { 18 | insx.with.filetype("nix"), 19 | } 20 | ) 21 | ) 22 | -------------------------------------------------------------------------------- /script/gitupdate/task/fget2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | path="$1" 4 | repo="$2" 5 | rev="$3" 6 | 7 | dest="${path}.fget" 8 | 9 | rm -rf "${dest}" 10 | 11 | ( 12 | git clone --progress --reference-if-able "${path}" --dissociate "${repo}" "${dest}" || exit 1 13 | 14 | if [[ "${rev}" != "" ]]; then 15 | ( 16 | cd "${dest}" 17 | git switch "${rev}" || git reset --hard "${rev}" 18 | ) 19 | fi 20 | 21 | rsync -a --delete-before "${dest}/.git/" "${path}/.git/" 22 | ) 23 | 24 | rm -rf "${dest}" 25 | -------------------------------------------------------------------------------- /autoload/vimrc/autocmd/shebang.vim: -------------------------------------------------------------------------------- 1 | function vimrc#autocmd#shebang#do() abort 2 | if stridx(getline(1), '#!/') != 0 3 | return 4 | endif 5 | let file = expand('') 6 | let perm = getfperm(file) 7 | let orw = perm[0:1] 8 | let grw = perm[3:4] 9 | let urw = perm[6:7] 10 | let newperm = orw .. 'x' .. grw .. 'x' .. urw .. 'x' 11 | if perm !=# newperm 12 | try 13 | call setfperm(file, newperm) 14 | echo 'Set executable: ' .. file 15 | catch 16 | endtry 17 | endif 18 | endfunction 19 | -------------------------------------------------------------------------------- /conf/plug/denippet.vim: -------------------------------------------------------------------------------- 1 | let s:loaded_ft = {} 2 | let s:dir = expand('$VIMCONF/snippets/') 3 | 4 | function s:load() 5 | let ft = &filetype 6 | if empty(ft) || has_key(s:loaded_ft, ft) 7 | return 8 | endif 9 | let s:loaded_ft[ft] = v:true 10 | let toml = s:dir .. ft .. '.toml' 11 | for file in glob(s:dir .. ft .. '.*', 1, 1) 12 | call denippet#load(file) 13 | endfor 14 | endfunction 15 | 16 | autocmd InsertEnter * call s:load() 17 | " 挿入モード内で呼ばれる想定なので初回は手で呼ぶ 18 | call s:load() 19 | 20 | inoremap F (denippet-jump-next) 21 | -------------------------------------------------------------------------------- /conf/rc/colors/def/edge_dark_transparent.vim: -------------------------------------------------------------------------------- 1 | source $VIMCONF/conf/rc/colors/def/common/transparent.vim 2 | 3 | function s:setup() abort 4 | let palette = edge#get_palette('default', 0, {}) 5 | execute printf('hi DiffAdd guifg=%s guibg=NONE', palette.green[0]) 6 | execute printf('hi DiffChange guifg=%s guibg=NONE', palette.blue[0]) 7 | execute printf('hi DiffDelete guifg=%s guibg=NONE', palette.red[0]) 8 | endfunction 9 | autocmd persistent_colorscheme ColorScheme edge call s:setup() 10 | 11 | source $VIMCONF/conf/rc/colors/def/edge_dark.vim 12 | -------------------------------------------------------------------------------- /denops/@ddu-filters/template.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddu-vim/filter"; 2 | import { DduItem } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | const params = { 5 | _: null, 6 | }; 7 | 8 | type Params = typeof params; 9 | // type Params = Record; 10 | 11 | export class Filter extends BaseFilter { 12 | filter(args: FilterArguments): Promise { 13 | return Promise.resolve(args.items); 14 | } 15 | 16 | params(): Params { 17 | return params; 18 | // return {}; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /script/build/build.toml: -------------------------------------------------------------------------------- 1 | ["coc.nvim"] 2 | script = '$VIMCONF/script/build/build/coc.sh' 3 | 4 | [deno_std] 5 | script = '$VIMCONF/script/build/build/deno_std.ts' 6 | 7 | ["deno-denops-lsputil"] 8 | script = '$VIMCONF/script/build/build/importmap-expand.sh' 9 | 10 | ["deno-denops-std"] 11 | script = '$VIMCONF/script/build/build/importmap-expand.sh' 12 | 13 | ["telescope-fzf-native.nvim"] 14 | script = '$VIMCONF/script/build/build/telescope-fzf-native.sh' 15 | 16 | [tree-sitter-unifieddiff] 17 | script = '$VIMCONF/script/build/build/treesitter/unifieddiff.sh' 18 | 19 | -------------------------------------------------------------------------------- /conf/plug/dpp.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/Shougo/dpp-ext-installer' 3 | 4 | [[plugins]] 5 | repo = 'https://github.com/Shougo/dpp-ext-lazy' 6 | 7 | [[plugins]] 8 | repo = 'https://github.com/Shougo/dpp-ext-local' 9 | 10 | [[plugins]] 11 | repo = 'https://github.com/Shougo/dpp-ext-toml' 12 | 13 | [[plugins]] 14 | repo = 'https://github.com/Shougo/dpp-protocol-git' 15 | 16 | [[plugins]] 17 | repo = 'https://github.com/Shougo/dpp.vim' 18 | # L 19 | hook_add = ''' 20 | nnoremap ;d call p#ddu#ff#start({'name':'dpp'}) 21 | ''' 22 | 23 | -------------------------------------------------------------------------------- /denops/@lspoints/lsputil.ts: -------------------------------------------------------------------------------- 1 | import { BaseExtension, Lspoints } from "../@deps/lspoints.ts"; 2 | import { Denops } from "jsr:@denops/std"; 3 | import { 4 | makePositionParams, 5 | TextDocumentPositionParams, 6 | } from "jsr:@uga-rosa/denops-lsputil"; 7 | 8 | export class Extension extends BaseExtension { 9 | override initialize(denops: Denops, lspoints: Lspoints) { 10 | lspoints.defineCommands("lsputil", { 11 | makePositionParams(): Promise { 12 | return makePositionParams(denops); 13 | }, 14 | }); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /script/gitupdate/util.ts: -------------------------------------------------------------------------------- 1 | import { isTask, Task } from "./run.ts"; 2 | import { assert, is } from "jsr:@core/unknownutil"; 3 | 4 | export async function loadTasks(pathes: string[]): Promise { 5 | const tasks = []; 6 | for (const path of pathes) { 7 | try { 8 | const data = await Deno.readTextFile(path); 9 | const json = JSON.parse(data); 10 | assert(json, is.ArrayOf(isTask)); 11 | tasks.push(...json); 12 | } catch (e) { 13 | console.log("skip " + path); 14 | console.trace(e); 15 | } 16 | } 17 | return tasks; 18 | } 19 | -------------------------------------------------------------------------------- /conf/rc/colors.vim: -------------------------------------------------------------------------------- 1 | nnoremap cs source $VIMCONF/conf/rc/colors/select.vim 2 | set termguicolors 3 | 4 | function s:persistent_colorscheme() abort 5 | try 6 | augroup persistent_colorscheme 7 | autocmd! 8 | augroup END 9 | source /tmp/colors.vim 10 | catch 11 | let g:persistent_colorscheme_error = [v:exception, v:throwpoint] 12 | try 13 | source $VIMCONF/conf/rc/colors/def/catppuccin-mocha_transparent.vim 14 | catch 15 | endtry 16 | endtry 17 | endfunction 18 | 19 | autocmd vimrc VimEnter * ++nested call s:persistent_colorscheme() 20 | -------------------------------------------------------------------------------- /autoload/vimrc/feat/terminal.vim: -------------------------------------------------------------------------------- 1 | function s:on_close(args) 2 | call win_gotoid(a:args.from_winid) 3 | TmuxFocus 4 | endfunction 5 | 6 | function vimrc#feat#terminal#open(cmd = $SHELL, cwd = expand('%:p:h')) abort 7 | tabnew 8 | call chdir(a:cwd, 'tabpage') 9 | let args = { 10 | \ 'from_winid': win_getid(), 11 | \ } 12 | if has('nvim') 13 | call termopen(a:cmd, {'cwd': a:cwd, 'on_exit': {->s:on_close(args)}}) 14 | normal! G0 15 | else 16 | call term_start(a:cmd, {'curwin': v:true, 'cwd': a:cwd, 'exit_cb': {->s:on_close(args)}}) 17 | endif 18 | endfunction 19 | 20 | -------------------------------------------------------------------------------- /conf/plug/nvim/telescope.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/nvim-telescope/telescope.nvim' 3 | on_cmd = 'Telescope' 4 | on_lua = 'telescope' 5 | 6 | [[plugins]] 7 | repo = 'https://github.com/nvim-telescope/telescope-fzf-native.nvim' 8 | on_source = 'telescope.nvim' 9 | lua_source = ''' 10 | require('telescope').setup { 11 | extensions = { 12 | fzf = { 13 | fuzzy = true, 14 | override_generic_sorter = true, 15 | override_file_sorter = true, 16 | case_mode = 'smart_case', 17 | }, 18 | }, 19 | } 20 | require('telescope').load_extension('fzf') 21 | ''' 22 | 23 | -------------------------------------------------------------------------------- /snippets/vim.ts: -------------------------------------------------------------------------------- 1 | import { TSSnippet } from "../denops/@deps/denippet.ts"; 2 | import { Denops } from "jsr:@denops/std"; 3 | 4 | export const snippets: Record = { 5 | autoload_function: { 6 | body: async (denops: Denops) => { 7 | const path = String(await denops.call("expand", "%:p")); 8 | const match = path.match(/autoload\/(.+?)\.vim$/); 9 | if (match == null) { 10 | return []; 11 | } 12 | const fn = match[1].replaceAll("/", "#"); 13 | 14 | return [ 15 | `function ${fn}#$0() abort`, 16 | "endfunction", 17 | ]; 18 | }, 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /denops/@ddu-sources/template.ts: -------------------------------------------------------------------------------- 1 | import { BaseSource, GatherArguments } from "jsr:@shougo/ddu-vim/source"; 2 | import { Item } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | type Never = Record; 5 | 6 | export class Source extends BaseSource { 7 | override kind = "file"; 8 | gather(args: GatherArguments): ReadableStream[]> { 9 | return new ReadableStream({ 10 | start: async (controller) => { 11 | try { 12 | } finally { 13 | controller.close(); 14 | } 15 | }, 16 | }); 17 | } 18 | params(): Never { 19 | return {}; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /denops/@vimrc/loader.ts: -------------------------------------------------------------------------------- 1 | import { assert, is } from "jsr:@core/unknownutil"; 2 | import { Denops } from "jsr:@denops/std"; 3 | import * as stdpath from "jsr:@std/path"; 4 | 5 | export function main(denops: Denops) { 6 | denops.dispatcher = { 7 | async load(path: unknown, args?: unknown) { 8 | assert(path, is.String); 9 | // NOTE: Import module with fragment so that reload works properly. 10 | // https://github.com/vim-denops/denops.vim/issues/227 11 | const mod = await import( 12 | `${stdpath.toFileUrl(path).href}#${performance.now()}` 13 | ); 14 | await mod.main(denops, args); 15 | }, 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /denops/@vimrc/lib/denops.ts: -------------------------------------------------------------------------------- 1 | import { Denops } from "jsr:@denops/std"; 2 | 3 | export type GenerateDenopsCallOptions = { 4 | async?: boolean; 5 | escapeLt?: boolean; 6 | }; 7 | 8 | export function generateDenopsCall( 9 | denops: Denops, 10 | method: string, 11 | args: string | unknown[], 12 | options: GenerateDenopsCallOptions = {}, 13 | ): string { 14 | if (Array.isArray(args)) { 15 | args = JSON.stringify(args); 16 | } 17 | if (options.escapeLt) { 18 | args = args.replaceAll(/"); 19 | } 20 | const callType = options.async ? "notify" : "request"; 21 | return `denops#${callType}('${denops.name}', '${method}', ${args})`; 22 | } 23 | -------------------------------------------------------------------------------- /denops/@vimrc/tmux.ts: -------------------------------------------------------------------------------- 1 | import { Denops } from "jsr:@denops/std"; 2 | 3 | export function main(denops: Denops) { 4 | denops.dispatcher = { 5 | async detach() { 6 | await new Deno.Command("tmux", { 7 | args: ["detach-client"], 8 | }).output(); 9 | }, 10 | async focus() { 11 | const pane = Deno.env.get("TMUX_PANE"); 12 | if (pane == null) { 13 | return; 14 | } 15 | await new Deno.Command("tmux", { 16 | args: ["select-window", "-t", pane], 17 | }).output(); 18 | await new Deno.Command("tmux", { 19 | args: ["select-pane", "-t", pane], 20 | }).output(); 21 | }, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /conf/makestate.vim: -------------------------------------------------------------------------------- 1 | if has('nvim') 2 | colorscheme vim 3 | endif 4 | set runtimepath^=/data/vim/repos/github.com/vim-denops/denops.vim 5 | set runtimepath^=/data/vim/repos/github.com/Shougo/dpp-ext-toml 6 | set runtimepath^=/data/vim/repos/github.com/Shougo/dpp-ext-lazy 7 | set runtimepath^=/data/vim/repos/github.com/Shougo/dpp-protocol-git 8 | let s:denopsrc = expand('$VIMCONF/local/rc/denops.vim') 9 | if getftype(s:denopsrc) ==# 'file' 10 | " g:denops#deno等を設定するのを想定 11 | execute 'source' s:denopsrc 12 | endif 13 | call dpp#make_state(g:vimrc#dpp_base, expand('$VIMCONF/conf/dpp.ts')) 14 | " Auto exit after dpp#make_state() 15 | let g:vimrc#dpp_make_state = v:true 16 | source $VIMCONF/conf/fallback.vim 17 | -------------------------------------------------------------------------------- /conf/plug/skkeleton_state_popup.vim: -------------------------------------------------------------------------------- 1 | if has('nvim') 2 | let s:opts = #{relative: 'cursor', col: 0, row: 1, anchor: 'NW', style: 'minimal'} 3 | else 4 | let s:opts = #{pos: 'botleft', line: 'cursor+1', col: 'cursor', highlight: 'WildMenu'} 5 | endif 6 | 7 | call skkeleton_state_popup#config(#{ 8 | \ labels: { 9 | \ 'input': #{hira: 'あ', kata: 'ア', hankata: 'カナ', zenkaku: 'A'}, 10 | \ 'input:okurinasi': #{hira: '▽▽', kata: '▽▽', hankata: '▽▽', abbrev: 'ab'}, 11 | \ 'input:okuriari': #{hira: '▽▽', kata: '▽▽', hankata: '▽▽'}, 12 | \ 'henkan': #{hira: '▼▼', kata: '▼▼', hankata: '▼▼', abbrev: 'ab'}, 13 | \ }, 14 | \ opts: s:opts, 15 | \ }) 16 | call skkeleton_state_popup#run() 17 | -------------------------------------------------------------------------------- /conf/rc/colors/def/catppuccin-latte.vim: -------------------------------------------------------------------------------- 1 | function s:on_colors() abort 2 | if has('nvim') 3 | lua <map('histget(":", v:val)')->filter('!empty(v:val)') 7 | endfunction 8 | 9 | function! s:executor(cmd, opts) abort 10 | let s:cmd = a:cmd 11 | autocmd CmdlineEnter * ++once call setcmdline(s:cmd) 12 | let typed = get(a:opts, 'typed', v:true) 13 | call feedkeys(":\", typed ? 'nt' : 'n') 14 | endfunction 15 | 16 | 17 | function! operandi#type#command#load() abort 18 | return #{ 19 | \ source: function('s:source'), 20 | \ executor: function('s:executor'), 21 | \ } 22 | endfunction 23 | -------------------------------------------------------------------------------- /conf/plug/nvim/lspconfig.lua: -------------------------------------------------------------------------------- 1 | vim.api.nvim_create_autocmd('LspAttach', { 2 | group = 'vimrc', 3 | callback = function(ev) 4 | local opts = { 5 | buffer = true, 6 | } 7 | local client = vim.lsp.get_client_by_id(ev.data.client_id) 8 | vim.keymap.set('n', 'ma', 'DduSelectorCall lsp_codeAction', opts) 9 | if client.server_capabilities.documentFormattingProvider then 10 | vim.keymap.set('n', 'mf', 'lua vim.lsp.buf.format()', opts) 11 | end 12 | end, 13 | }) 14 | 15 | local server = { 16 | lua = 'lua_ls', 17 | typescript = 'denols', 18 | } 19 | 20 | function _LspStart() 21 | local name = server[vim.bo.filetype] 22 | if name then 23 | vim.lsp.start(vim.lsp.config[name]) 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # .vim 2 | 3 | 基本的に自分が使うことしか考えてないし普段の環境(~~Arch Linux~~NixOS)以外で動かすことも想定していないので他の環境に持っていっても動かない可能性がある 4 | 5 | - 必要な物 6 | - Vim or Neovim 7 | - 基本的にHEADを使っている 8 | - 面倒臭いのでHEAD以外知らんという方針 9 | - 一部分をLuaで書いているためVimは`+lua`付きでコンパイルする必要がある 10 | - Deno 11 | - `denops.vim`を全面的に採用しているので必須 12 | - denopsはいいぞ 13 | - ripgrep 14 | - `ddu-source-rg`で使っている 15 | 16 | # 導入方法(例) 17 | 18 | ```sh 19 | git clone https://github.com/kuuote/dotvim ~/dotvim 20 | ln -s ~/dotvim ~/.vim 21 | ln -s ~/.vim ~/.config/nvim 22 | ``` 23 | 24 | ```vim 25 | :call dpp#async_ext_action('installer', 'install') 26 | ``` 27 | 28 | # ライセンス 29 | 30 | 注釈が無い部分は基本的に[NYSL](http://www.kmonos.net/nysl/)(注釈を忘れている可能性はあるが)なので好きに持っていってもらって構いません 31 | -------------------------------------------------------------------------------- /conf/rc/opt.vim: -------------------------------------------------------------------------------- 1 | " スペースの2幅が好み 2 | set expandtab 3 | set shiftwidth=2 4 | set tabstop=2 5 | 6 | " ファイルを変更したまま裏に移動できるようにする 7 | set hidden 8 | 9 | " フルカラーは人権 10 | set termguicolors 11 | 12 | " 立つ鳥後を濁さず 13 | set viminfo+=:0 14 | 15 | " スワップ固めような 16 | set directory=/tmp/swp// 17 | call mkdir('/tmp/swp', 'p') 18 | 19 | " nullっとスクロール 20 | set mouse=nv 21 | 22 | " 文字無い所にもカーソル 23 | set virtualedit=all 24 | 25 | " 疑似submodeにマッピングのtimeoutが邪魔 26 | set notimeout 27 | 28 | " tabを閉じた際に開く前の方向に戻っていく 29 | set tabclose=left 30 | 31 | " たまーに判定に失敗する環境があって面倒 32 | " システム側のロケール情報読めないとだめそう 33 | set encoding=utf-8 34 | 35 | " diffopt 36 | "" git diffと同じコンテキスト量でいい 37 | set diffopt+=context:3 38 | "" histogramにしてみる 39 | set diffopt+=algorithm:histogram 40 | -------------------------------------------------------------------------------- /vimrc: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | augroup vimrc 3 | autocmd! 4 | augroup END 5 | 6 | let $VIMCONF = expand(':p:h') 7 | " vimrcを指定するかしないかでruntimepath変わって面倒なので固定値で上書き 8 | " システムの設定などないし多分行けるでしょ(適当) 9 | set runtimepath=$VIMCONF,$VIMCONF/local,$VIMRUNTIME,$VIMCONF/after,$VIMCONF/local/after 10 | 11 | " dpp.vim内でconf/rcやlocal/rc以下から設定を読んでいる 12 | " L 13 | if !v:vim_did_enter 14 | source $VIMCONF/conf/dpp.vim 15 | endif 16 | 17 | filetype plugin indent on 18 | syntax enable 19 | 20 | " デフォルトプラギンを無効化するやつ 21 | " 何かしらのプラギンが読まれるまでVIMRUNTIME抜くのでそれに依存するけど 22 | " うちはdenops.vim使ってるので問題Nothing! 23 | let s:save_rtp = &runtimepath 24 | set rtp-=$VIMRUNTIME 25 | autocmd vimrc SourcePre */plugin/* ++once let &runtimepath = s:save_rtp 26 | -------------------------------------------------------------------------------- /autoload/vimrc/feat/format.vim: -------------------------------------------------------------------------------- 1 | function! vimrc#feat#format#execute(cmd) abort 2 | let shell = &shell 3 | setglobal shell=sh 4 | let view = winsaveview() 5 | try 6 | let result = systemlist(a:cmd, getline(1, '$')) 7 | if v:shell_error != 0 8 | for l in result 9 | echoerr l 10 | endfor 11 | return 12 | endif 13 | call deletebufline('%', 1, '$') 14 | call setline(1, result) 15 | finally 16 | call winrestview(view) 17 | let &shell = shell 18 | endtry 19 | endfunction 20 | 21 | let s:ft = {} 22 | let s:ft['lua'] = 'stylua -' 23 | let s:ft['nix'] = 'nixfmt' 24 | 25 | function vimrc#feat#format#execute_filetype() abort 26 | call vimrc#feat#format#execute(s:ft[&filetype]) 27 | endfunction 28 | -------------------------------------------------------------------------------- /autoload/p/gin.vim: -------------------------------------------------------------------------------- 1 | function s:dowrite(confirm = v:false) 2 | if a:confirm || confirm("Commit changes?", "&Yes\n&No", 2) == 1 3 | Gin commit -F /tmp/komitto 4 | let winid = t:winid 5 | tabclose 6 | call win_gotoid(winid) 7 | endif 8 | endfunction 9 | 10 | function p#gin#komitto() abort 11 | let winid = win_getid() 12 | tab split 13 | let t:winid = winid 14 | GinTcd 15 | 16 | GinDiff --cached 17 | botright vsplit 18 | GinLog --oneline 19 | 20 | topleft new /tmp/komitto 21 | resize 3 22 | augroup p.gin.komitto 23 | autocmd! 24 | autocmd BufWritePost call s:dowrite() 25 | augroup END 26 | nnoremap ZZ autocmd! p.gin.komittoupdatecall dowrite(v:true) 27 | endfunction 28 | -------------------------------------------------------------------------------- /autoload/vimrc/git.vim: -------------------------------------------------------------------------------- 1 | function vimrc#git#find_root(path = expand('%:p') ?? getcwd()) abort 2 | let path = a:path 3 | while v:true 4 | let git = path .. '/.git' 5 | let type = getftype(git) 6 | if type != '' 7 | return git->substitute('/*\.git$', '', '') 8 | endif 9 | 10 | let newpath = path->substitute('[^/]*/\?$', '', '') 11 | if path == newpath 12 | throw 'not git' 13 | endif 14 | let path = newpath 15 | endwhile 16 | endfunction 17 | 18 | function vimrc#git#find_worktree(path = expand('%:p') ?? getcwd()) abort 19 | let path = vimrc#git#find_root(a:path) 20 | let git = path .. '/.git' 21 | if getftype(git) == 'file' 22 | " TODO 23 | endif 24 | return #{worktree: path, root: path} 25 | endfunction 26 | -------------------------------------------------------------------------------- /denops/@ddc-sources/skk_okuri/dict.ts: -------------------------------------------------------------------------------- 1 | export async function parse(path: string): Promise> { 2 | const dictionary = new Map(); 3 | const data = await Deno.readFile(path); 4 | const text = new TextDecoder("euc-jp").decode(data); 5 | const entries = text.split(";; okuri-nasi entries.")[0] 6 | .split(/\n/) 7 | .map((s) => { 8 | const m = s.match(/^([^; ]+) \/(.+)\/$/); 9 | if (m == null) { 10 | return; 11 | } 12 | return [m[1], m[2].split("/")] as const; 13 | }) 14 | .filter((x: T): x is NonNullable => x != null); 15 | for (const [midasi, candidates] of entries) { 16 | dictionary.set(midasi, (dictionary.get(midasi) ?? []).concat(candidates)); 17 | } 18 | return dictionary; 19 | } 20 | -------------------------------------------------------------------------------- /script/gitupdate/task/fget.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | path="$1" 4 | repo="$2" 5 | rev="$3" 6 | 7 | dest="${path}.fget" 8 | 9 | rm -rf "${dest}" 10 | 11 | ( 12 | GIT_SSH_COMMAND="ssh -o BatchMode=yes" git clone --progress --reference-if-able "${path}" --dissociate "${repo}" "${dest}" || exit 1 13 | 14 | if [[ "${rev}" != "" ]]; then 15 | cd "${dest}" 16 | git switch "${rev}" || git reset --hard "${rev}" || exit 1 17 | cd - 18 | fi 19 | 20 | if [[ -e "${path}/.vimrc_hash" ]]; then 21 | rsync -a --delete-before "${dest}/.git/" "${path}/.git/" 22 | else 23 | cd "${dest}" 24 | /data/vim/repos/github.com/WayneD/rsync/support/git-set-file-times > /dev/null 25 | rsync -a --delete-before "${dest}/" "${path}/" 26 | fi 27 | ) 28 | 29 | rm -rf "${dest}" 30 | -------------------------------------------------------------------------------- /conf/rc/colors/def/catppuccin-latte_bluenote.vim: -------------------------------------------------------------------------------- 1 | function s:on_colors() abort 2 | hi Normal guifg=#6060ff 3 | hi Pmenu guibg=#e0e0ff guifg=#6060ff 4 | hi PmenuSel guifg=#ff6060 guibg=#ffe8e8 5 | hi NormalFloat guibg=#e0e0ff guifg=#6060ff 6 | hi CmpItemAbbr guifg=#6060ff 7 | hi CmpItemKindText guifg=#6060ff 8 | hi PumHighlight ctermfg=205 ctermbg=225 guifg=#ff60c0 guibg=#ffd0ff cterm=NONE gui=NONE 9 | hi Search ctermfg=205 ctermbg=225 guifg=#ff60c0 guibg=#ffd0ff cterm=NONE gui=NONE" 10 | 11 | hi DduFloat guibg=NONE 12 | hi DduEnd guibg=NONE 13 | if has('nvim') 14 | hi @variable guifg=#6060ff 15 | endif 16 | endfunction 17 | 18 | autocmd persistent_colorscheme ColorScheme catppuccin-latte call s:on_colors() 19 | 20 | source $VIMCONF/conf/rc/colors/def/catppuccin-latte.vim 21 | -------------------------------------------------------------------------------- /denops/@ddc-filters/sorter_file.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter } from "jsr:@shougo/ddc-vim/filter"; 2 | import { Item } from "jsr:@shougo/ddc-vim/types"; 3 | 4 | const rank: Record = { 5 | dir: 1, 6 | file: 2, 7 | "sym=dir": 3, 8 | "sym=file": 4, 9 | symlink: 5, 10 | }; 11 | 12 | type Params = Record; 13 | 14 | export class Filter extends BaseFilter { 15 | filter(args: { 16 | items: Item[]; 17 | }): Promise { 18 | return Promise.resolve(args.items.sort((a, b) => { 19 | const r = (rank[String(a.kind)] ?? 6) - (rank[String(b.kind)] ?? 6); 20 | if (r !== 0) { 21 | return r; 22 | } 23 | return a.word.localeCompare(b.word); 24 | })); 25 | } 26 | 27 | params(): Params { 28 | return {}; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ftplugin/toml.vim: -------------------------------------------------------------------------------- 1 | " syntax大事 2 | " getline hack from https://github.com/4513ECHO/dotfiles/blob/c0a0bff2186d38aca9674ac30615c672b1b96c92/config/nvim/dein/ftplugin.toml?plain=1#L104 3 | if !has('nvim') && getline(1) =~# '\v^(\[\[plugins]]|hook_)' 4 | call timer_start(1, {->dpp#ext#toml#syntax()}) 5 | endif 6 | 7 | " dein.vimのtomlのhook_addなどをparteditでいじるやつ 8 | function! s:partedit() abort 9 | let view = winsaveview() 10 | let start = search("\\v^%(hook|lua)_.*'''$", 'bc') 11 | let end = search("^'''") 12 | if start == 0 || end == 0 13 | return 14 | endif 15 | call winrestview(view) 16 | let ft = getline(start) =~# 'lua' ? 'lua' : 'vim' 17 | execute printf('%d,%dPartedit -opener new -filetype %s', start + 1, end - 1, ft) 18 | endfunction 19 | 20 | nnoremap mp call partedit() 21 | -------------------------------------------------------------------------------- /conf/rc/colors/select.vim: -------------------------------------------------------------------------------- 1 | let s:defdir = expand(':p:h') .. '/def' 2 | 3 | function! CSSelectCallback(item, idx) 4 | if a:item is v:null 5 | return 6 | endif 7 | let path = printf("%s/%s.vim", s:defdir, a:item) 8 | " load colorscheme def 9 | let g:colors_name = "" 10 | augroup persistent_colorscheme 11 | autocmd! 12 | augroup END 13 | source `=path` 14 | 15 | " and persist 16 | redraw 17 | if confirm('Save changes?', "&Yes\n&No\n", 2) == 1 18 | call writefile(['source ' .. path], '/tmp/colors.vim') 19 | " カラースキーム動的読み込みしてるのでキャッシュ吹き飛ばす必要あり 20 | call delete('/tmp/inline.vim', 'rf') 21 | endif 22 | endfunction 23 | 24 | function s:run() abort 25 | let defs = readdir(s:defdir)->filter('v:val =~ "vim$"')->map('fnamemodify(v:val, ":r")') 26 | call luaeval('vim.ui.select(_A, {}, vim.fn.CSSelectCallback)', defs) 27 | endfunction 28 | 29 | call s:run() 30 | -------------------------------------------------------------------------------- /conf/plug/ddc.vim: -------------------------------------------------------------------------------- 1 | call ddc#custom#load_config(expand('$VIMCONF/conf/plug/ddc/main.ts')) 2 | call ddc#custom#load_config(expand('$VIMCONF/conf/plug/ddc/manual.ts')) 3 | call ddc#enable() 4 | autocmd vimrc CmdlineEnter : call ddc#enable_cmdline_completion() 5 | autocmd vimrc User DenopsPluginPost:ddc call ddc#enable_cmdline_completion() 6 | " 現状呼ばれてないっぽいんで@もついでに呼んでおく 7 | autocmd vimrc CmdlineEnter :,@ call ddc#on_event('CmdlineEnter') 8 | " CmdlineEnterをトリガーにするので再度呼んでおく 9 | if mode() == 'c' && getcmdtype() =~# '[:@]' 10 | call ddc#on_event('CmdlineEnter') 11 | endif 12 | 13 | " deflicker echo area 14 | set noshowmode 15 | 16 | " acwriteセットされてるファイルで補完効かなくて困ることは無いと思う 17 | autocmd vimrc OptionSet buftype if &buftype ==# 'acwrite' | call ddc#custom#patch_buffer('specialBufferCompletion', v:true) | endif 18 | if &buftype ==# 'acwrite' | call ddc#custom#patch_buffer('specialBufferCompletion', v:true) | endif 19 | -------------------------------------------------------------------------------- /conf/plug/colorscheme.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/catppuccin/nvim' 3 | name = 'catppuccin' 4 | lazy = true 5 | hook_add = ''' 6 | autocmd vimrc ColorSchemePre catppuccin* call dpp#source(['catppuccin']) 7 | ''' 8 | lua_source = ''' 9 | require('catppuccin').setup { 10 | integrations = { 11 | notify = true, 12 | }, 13 | term_colors = true, 14 | } 15 | ''' 16 | 17 | [[plugins]] 18 | repo = 'https://github.com/EdenEast/nightfox.nvim' 19 | 20 | [[plugins]] 21 | repo = 'https://github.com/eihigh/vim-aomi-grayscale' 22 | 23 | [[plugins]] 24 | repo = 'https://github.com/kyoh86/momiji' 25 | 26 | [[plugins]] 27 | repo = 'https://github.com/mcchrish/zenbones.nvim' 28 | 29 | [[plugins]] 30 | repo = 'https://github.com/sainnhe/edge' 31 | 32 | [[plugins]] 33 | repo = 'https://github.com/yuttie/hydrangea-vim' 34 | 35 | [[plugins]] 36 | repo = 'https://github.com/futsuuu/vim-robot' 37 | 38 | -------------------------------------------------------------------------------- /snippets/typescript.toml: -------------------------------------------------------------------------------- 1 | [bfswalk] 2 | body = ''' 3 | type WalkEntry = Deno.DirEntry & { 4 | path: string; 5 | }; 6 | 7 | function* walk(initialPath: string): Generator { 8 | const queue = [initialPath]; 9 | for (let cursor = 0; cursor < queue.length; cursor++) { 10 | const path = queue[cursor]; 11 | const es = [...Deno.readDirSync(path)] 12 | .sort((a, b) => a.name.localeCompare(b.name)); 13 | for (const e of es) { 14 | const newPath = path + "/" + e.name; 15 | yield { 16 | ...e, 17 | path: newPath, 18 | }; 19 | if (e.isDirectory) { 20 | queue.push(newPath); 21 | } 22 | } 23 | } 24 | } 25 | ''' 26 | 27 | [filternull] 28 | description = "null reducer for Array.filter()" 29 | body = ".filter((x: T): x is NonNullable => x != null)" 30 | 31 | [never] 32 | body = 'type Never = Record;' 33 | 34 | -------------------------------------------------------------------------------- /script/gitupdate/snap/dps_shot.ts: -------------------------------------------------------------------------------- 1 | import { loadTasks } from "../util.ts"; 2 | import { getSnapshot } from "./libsnapshot.ts"; 3 | import { assert, is } from "jsr:@core/unknownutil"; 4 | import { type Denops } from "jsr:@denops/std"; 5 | 6 | export async function run(args: unknown) { 7 | assert( 8 | args, 9 | is.TupleOf( 10 | [ 11 | is.ArrayOf(is.String), 12 | is.String, 13 | ] as const, 14 | ), 15 | ); 16 | const [pathes, outFile] = args; 17 | const tasks = await loadTasks(pathes); 18 | const snapshots = (await Promise.all( 19 | tasks.map((task) => getSnapshot(task.path)), 20 | )) 21 | .filter((x: T): x is NonNullable => x != null); 22 | await Deno.writeTextFile(outFile, JSON.stringify(snapshots, null, "\t")); 23 | } 24 | 25 | export function main(denops: Denops) { 26 | denops.dispatcher = { 27 | run: (...args: unknown[]) => run(args), 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /after/queries/unifieddiff/highlights.scm: -------------------------------------------------------------------------------- 1 | ; from https://github.com/monaqa/tree-sitter-unifieddiff/blob/9f2f60b294e3c6dd1116e374343de25c45db86a0/queries/highlights.scm 2 | (git_diff_header) @type 3 | 4 | [ 5 | (git_old_mode) 6 | (git_new_mode) 7 | (git_deleted_file_mode) 8 | (git_new_file_mode) 9 | (git_copy_from) 10 | (git_copy_to) 11 | (git_rename_from) 12 | (git_rename_to) 13 | (git_similarity_index) 14 | (git_dissimilarity_index) 15 | (git_index) 16 | ] @preproc 17 | 18 | (from_file_line) @text.diff.delsign 19 | (to_file_line) @text.diff.addsign 20 | 21 | (hunk_info) @keyword @text.underline 22 | (hunk_comment) @text.emphasis @text.quote 23 | 24 | (line_nochange) @comment 25 | (line_nochange " " @text.diff.indicator) 26 | 27 | (line_deleted "-" @text.diff.delindicator) 28 | (line_deleted (body) @text.diff.delete) 29 | 30 | (line_added "+" @text.diff.addindicator) 31 | (line_added (body) @text.diff.add) 32 | -------------------------------------------------------------------------------- /autoload/vimrc/mru.vim: -------------------------------------------------------------------------------- 1 | function vimrc#mru#uniq(list) abort 2 | let visit = {} 3 | let result = [] 4 | for line in a:list 5 | if !has_key(visit, line) 6 | call add(result, line) 7 | let visit[line] = v:true 8 | endif 9 | endfor 10 | return result 11 | endfunction 12 | 13 | function vimrc#mru#load(file) abort 14 | try 15 | let data = readfile(a:file) 16 | catch 17 | let data = [] 18 | endtry 19 | return vimrc#mru#uniq(data) 20 | endfunction 21 | 22 | function vimrc#mru#save(file, opts = {}) abort 23 | if has_key(a:opts, 'data') 24 | let data = a:opts.data 25 | else 26 | try 27 | let data = readfile(a:file) 28 | catch 29 | let data = [] 30 | endtry 31 | endif 32 | if has_key(a:opts, 'line') 33 | call insert(data, a:opts.line) 34 | endif 35 | call mkdir(a:file->fnamemodify(':h'), 'p') 36 | call writefile(vimrc#mru#uniq(data), a:file) 37 | endfunction 38 | -------------------------------------------------------------------------------- /denops/@lspoints/config.ts: -------------------------------------------------------------------------------- 1 | import { BaseExtension, Lspoints } from "../@deps/lspoints.ts"; 2 | import { Denops } from "jsr:@denops/std"; 3 | import * as variable from "jsr:@denops/std/variable"; 4 | 5 | export class Extension extends BaseExtension { 6 | override async initialize(denops: Denops, lspoints: Lspoints) { 7 | lspoints.settings.patch({ 8 | startOptions: { 9 | denols: { 10 | cmd: [ 11 | "/data/code/deno/lsptrace.ts", 12 | "/tmp/lsptrace/deno__date__", 13 | await variable.g.get(denops, "denops#deno", "deno"), 14 | "lsp", 15 | ], 16 | settings: { 17 | deno: { 18 | enable: true, 19 | unstable: true, 20 | }, 21 | }, 22 | }, 23 | rust_analyzer: { 24 | cmd: ["rust-analyzer"], 25 | }, 26 | }, 27 | tracePath: "/tmp/lspoints", 28 | }); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /after/queries/unifieddiff/unifieddiff.scm: -------------------------------------------------------------------------------- 1 | ; from https://github.com/monaqa/tree-sitter-unifieddiff/blob/9f2f60b294e3c6dd1116e374343de25c45db86a0/queries/highlights.scm 2 | (git_diff_header) @type 3 | 4 | [ 5 | (git_old_mode) 6 | (git_new_mode) 7 | (git_deleted_file_mode) 8 | (git_new_file_mode) 9 | (git_copy_from) 10 | (git_copy_to) 11 | (git_rename_from) 12 | (git_rename_to) 13 | (git_similarity_index) 14 | (git_dissimilarity_index) 15 | (git_index) 16 | ] @preproc 17 | 18 | (from_file_line) @text.diff.delsign 19 | (to_file_line) @text.diff.addsign 20 | 21 | (hunk_info) @keyword @text.underline 22 | (hunk_comment) @text.emphasis @text.quote 23 | 24 | (line_nochange) @comment 25 | (line_nochange " " @text.diff.indicator) 26 | 27 | (line_deleted "-" @text.diff.delsign @text.diff.indicator) 28 | (line_deleted (body) @text.diff.delete) 29 | 30 | (line_added "+" @text.diff.addsign @text.diff.indicator) 31 | (line_added (body) @text.diff.add) 32 | -------------------------------------------------------------------------------- /autoload/vimrc/feat/tweet.vim: -------------------------------------------------------------------------------- 1 | function s:read() 2 | try 3 | return readfile(t:vimrc_tweet_path) 4 | catch 5 | return [] 6 | endtry 7 | endfunction 8 | 9 | function s:tweet() 10 | if confirm("呟くわよ?", "&Yes\n&No", 2) == 1 11 | let head = getline(1, '$')->filter('v:val !~# "^\\s*$"') 12 | let tail = s:read() 13 | call writefile(head + [''] + tail, t:vimrc_tweet_path) 14 | let previous = max([1, tabpagenr() - 1]) 15 | tabclose 16 | execute 'tabnext' previous 17 | " suppress hit enter 18 | redraw 19 | echo 'Done' 20 | endif 21 | endfunction 22 | 23 | " タブを切る。保存すると呟ける。以上 24 | function vimrc#feat#tweet#open(path) abort 25 | tabnew 26 | let t:vimrc_tweet_path = a:path 27 | setlocal buftype=nofile bufhidden=wipe noswapfile 28 | call setline(1, s:read()) 29 | execute (&lines / 4) .. 'new' '/tmp/tweet.txt' 30 | augroup vimrc_local#tweet 31 | autocmd! 32 | autocmd BufWritePost call s:tweet() 33 | augroup END 34 | endfunction 35 | -------------------------------------------------------------------------------- /denops/@ddu-filters/sorter_alpha_path.ts: -------------------------------------------------------------------------------- 1 | import { ActionData } from "jsr:@shougo/ddu-kind-file"; 2 | import { BaseFilter } from "jsr:@shougo/ddu-vim/filter"; 3 | import { DduItem } from "jsr:@shougo/ddu-vim/types"; 4 | 5 | type Params = Record; 6 | 7 | type Item = { 8 | action?: ActionData; 9 | }; 10 | 11 | /* 12 | * like ddu-sorter-alpha but ddu-kind-file base 13 | * ripgrepなどの実行する度に結果が変わるソースのために作った 14 | */ 15 | export class Filter extends BaseFilter { 16 | filter(args: { 17 | items: DduItem[]; 18 | }): Promise { 19 | return Promise.resolve((args.items as Item[]).sort((a, b) => { 20 | const cmpPath = (a.action?.path ?? "") 21 | .localeCompare(b.action?.path ?? ""); 22 | if (cmpPath !== 0) { 23 | return cmpPath; 24 | } 25 | return (a.action?.lineNr ?? 0) - (b.action?.lineNr ?? 0); 26 | }) as DduItem[]); 27 | } 28 | 29 | params(): Params { 30 | return {}; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /autoload/vimrc/inline/cache.vim: -------------------------------------------------------------------------------- 1 | function vimrc#inline#cache#load(globpath, cachepath) abort 2 | let luapath = a:cachepath->substitute('vim$', 'lua', '') 3 | call mkdir(fnamemodify(a:cachepath, ':h'), 'p') 4 | let inline_vim = [] 5 | let inline_lua = [] 6 | let files = glob(a:globpath, 1, 1) 7 | call sort(files) 8 | for file in files 9 | try 10 | let data = readfile(file) 11 | catch 12 | " skip unreadable file or directory 13 | continue 14 | endtry 15 | " 末尾がluaで終わるファイルを雑にLuaのスクリプト扱いする 16 | if file =~# 'lua$' 17 | call extend(inline_lua, data) 18 | else 19 | call extend(inline_vim, data) 20 | endif 21 | endfor 22 | if !empty(inline_lua) 23 | " NeovimではLuaファイルをsourceできる 24 | call add(inline_vim, [has('nvim') ? 'source' : 'luafile', luapath]->join(' ')) 25 | call writefile(inline_lua, luapath) 26 | endif 27 | call writefile(inline_vim, a:cachepath) 28 | execute 'source' a:cachepath 29 | endfunction 30 | -------------------------------------------------------------------------------- /conf/plug/nvim/treesitter.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = '~/.config/nvim-nix/nvim-treesitter' 3 | on_ft = [ 4 | 'diff', 5 | 'nix', 6 | 'toml', 7 | 'typescript', 8 | ] 9 | lua_source = ''' 10 | local nvim_treesitter = require('nvim-treesitter.configs') 11 | nvim_treesitter.setup { 12 | highlight = { 13 | enable = true, 14 | }, 15 | } 16 | -- local parser_config = require('nvim-treesitter.parsers').get_parser_configs() 17 | -- parser_config.unifieddiff = { 18 | -- install_info = {}, 19 | -- filetype = 'diff', -- if filetype does not agrees with parser name 20 | -- } 21 | vim.treesitter.language.register('unifieddiff', 'diff') 22 | ''' 23 | 24 | [[plugins]] 25 | repo = 'https://github.com/monaqa/tree-sitter-unifieddiff' 26 | 27 | [[plugins]] 28 | repo = 'https://github.com/atusy/treemonkey.nvim' 29 | on_map = {o = 'm', x = 'm'} 30 | lua_source = ''' 31 | vim.keymap.set({ 'x', 'o' }, 'm', function() 32 | require('treemonkey').select { ignore_injections = false } 33 | end) 34 | ''' 35 | 36 | -------------------------------------------------------------------------------- /denops/@ddu-filters/converter_color.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddu-vim/filter"; 2 | import { DduItem } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | const params = { 5 | group: "", 6 | }; 7 | 8 | type Params = typeof params; 9 | 10 | const encoder = new TextEncoder(); 11 | 12 | function byteLength(text: string): number { 13 | return encoder.encode(text).length; 14 | } 15 | 16 | export class Filter extends BaseFilter { 17 | filter(args: FilterArguments): Promise { 18 | const group = args.filterParams.group; 19 | for (const item of args.items) { 20 | (item.highlights = item.highlights ?? []).unshift({ 21 | name: "ddu-filter-color-" + group, 22 | col: 1, 23 | width: byteLength(item.display ?? item.word), 24 | hl_group: args.filterParams.group, 25 | }); 26 | } 27 | return Promise.resolve(args.items); 28 | } 29 | 30 | params(): Params { 31 | return params; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /denops/@ddu-filters/sorter_shuffle.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddu-vim/filter"; 2 | import { Context, DduItem } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | const defaultParams = { 5 | disableAtNarrowing: false, 6 | }; 7 | 8 | type Params = typeof defaultParams; 9 | 10 | export class Filter extends BaseFilter { 11 | #cache = new WeakMap>(); 12 | 13 | filter(args: FilterArguments): DduItem[] { 14 | if (args.filterParams.disableAtNarrowing && args.input !== "") { 15 | return args.items; 16 | } 17 | const cache = this.#cache.get(args.context) ?? new Map(); 18 | this.#cache.set(args.context, cache); 19 | return args.items.toSorted((a, b) => { 20 | const ai = cache.get(a.word) ?? Math.random(); 21 | cache.set(a.word, ai); 22 | const bi = cache.get(b.word) ?? Math.random(); 23 | cache.set(b.word, bi); 24 | return ai - bi; 25 | }); 26 | } 27 | 28 | params(): Params { 29 | return defaultParams; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /denops/@ddu-kinds/callback.ts: -------------------------------------------------------------------------------- 1 | import { BaseKind } from "jsr:@shougo/ddu-vim/kind"; 2 | import { 3 | ActionArguments, 4 | ActionFlags, 5 | DduItem, 6 | } from "jsr:@shougo/ddu-vim/types"; 7 | 8 | export type Callback = string | ((items: DduItem[]) => Promise); 9 | 10 | export type Params = { 11 | callback: Callback; 12 | }; 13 | 14 | export class Kind extends BaseKind { 15 | override actions: Record< 16 | string, 17 | (args: ActionArguments) => Promise 18 | > = { 19 | call: async (args) => { 20 | const callback = args.kindParams.callback; 21 | if (typeof callback === "function") { 22 | return await callback(args.items); 23 | } else { 24 | return await args.denops.call( 25 | "denops#callback#call", 26 | callback, 27 | args.items, 28 | ) as Promise; 29 | } 30 | }, 31 | }; 32 | override params(): Params { 33 | return { 34 | callback: () => Promise.resolve(ActionFlags.None), 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lua/vimrc/feat/select_action.lua: -------------------------------------------------------------------------------- 1 | -- vim.ui.select() を使ってありすえ式アクションを実行する 2 | -- ありすえ式アクションとは %((%a+)%-action%-([a-z:%-]+)%) にマッチするノーマルモードのマッピングである 3 | -- 例: (gin-action-fixup:instant-fixup) 4 | 5 | local eval = vim.eval or vim.api.nvim_eval 6 | 7 | local plug = eval([["\"]]) 8 | 9 | local function find_actions(plugin) 10 | local pattern = '%(' .. plugin .. '%-action%-([a-z:%-]+)%)' 11 | local actions = {} 12 | for action in string.gmatch(vim.fn.execute('nnoremap'), pattern) do 13 | -- dedupe 14 | actions[action] = true 15 | end 16 | local actionlist = {} 17 | for action, _ in pairs(actions) do 18 | table.insert(actionlist, action) 19 | end 20 | table.sort(actionlist) 21 | return actionlist 22 | end 23 | 24 | local function select_action(plugin) 25 | local actions = find_actions(plugin) 26 | vim.ui.select(actions, {}, function(item, idx) 27 | if item == nil then 28 | return 29 | end 30 | vim.fn.feedkeys(plug .. '(' .. plugin .. '-action-' .. item .. ')', 'n') 31 | end) 32 | end 33 | 34 | return select_action 35 | -------------------------------------------------------------------------------- /script/gitupdate/snap/shot.ts: -------------------------------------------------------------------------------- 1 | import { getSnapshot } from "./libsnapshot.ts"; 2 | 3 | type WalkEntry = Deno.DirEntry & { 4 | path: string; 5 | }; 6 | 7 | function* walk(initialPath: string): Generator { 8 | const queue = [initialPath]; 9 | for (let cursor = 0; cursor < queue.length; cursor++) { 10 | const path = queue[cursor]; 11 | const es = [...Deno.readDirSync(path)] 12 | .sort((a, b) => a.name.localeCompare(b.name)); 13 | for (const e of es) { 14 | const newPath = path + "/" + e.name; 15 | yield { 16 | ...e, 17 | path: newPath, 18 | }; 19 | if (e.isDirectory) { 20 | queue.push(newPath); 21 | } 22 | } 23 | } 24 | } 25 | 26 | const repos = []; 27 | 28 | for (const e of walk(Deno.args[0])) { 29 | if (e.path.endsWith("/.git")) { 30 | const path = e.path.slice(0, -5); 31 | repos.push(getSnapshot(path)); 32 | } 33 | } 34 | const data = (await Promise.all(repos)) 35 | .filter((x: T): x is NonNullable => x != null); 36 | await Deno.writeTextFile(Deno.args[1], JSON.stringify(data)); 37 | -------------------------------------------------------------------------------- /script/gitupdate/snap/libsnapshot.ts: -------------------------------------------------------------------------------- 1 | import { is, type Predicate } from "jsr:@core/unknownutil"; 2 | 3 | export async function exec(cmd: string[], cwd?: string): Promise { 4 | if (cwd == null) { 5 | cwd = Deno.cwd(); 6 | } 7 | const proc = new Deno.Command(cmd[0], { 8 | args: cmd.slice(1), 9 | cwd, 10 | }); 11 | const { stdout } = await proc.output(); 12 | return new TextDecoder().decode(stdout).trimEnd(); 13 | } 14 | 15 | export type Repo = { 16 | path: string; 17 | hash: string; 18 | date: number; 19 | }; 20 | 21 | export const isRepo: Predicate = is.ObjectOf({ 22 | path: is.String, 23 | hash: is.String, 24 | date: is.Number, 25 | }); 26 | 27 | export async function getSnapshot(path: string): Promise { 28 | const out = await exec( 29 | [ 30 | "git", 31 | "log", 32 | "-1", 33 | "--pretty=format:%H %ct", 34 | ], 35 | path, 36 | ).catch(String); 37 | const match = out.match(/([0-9a-f]+) ([0-9]+)/); 38 | if (match == null) { 39 | return null; 40 | } 41 | return { 42 | path, 43 | hash: match[1], 44 | date: Number(match[2]), 45 | }; 46 | } 47 | -------------------------------------------------------------------------------- /autoload/operandi/type/myterm.vim: -------------------------------------------------------------------------------- 1 | let s:history = '/data/vimshared/termhist' 2 | 3 | function s:source() abort 4 | try 5 | return readfile(s:history)->vimrc#mru#uniq() 6 | catch 7 | return [] 8 | endtry 9 | endfunction 10 | 11 | function s:executor(cmd, opts) abort 12 | call vimrc#mru#save(s:history, #{line: a:cmd}) 13 | let cmd = a:cmd->substitute('%%', expand('%:p'), 'g') 14 | call vimrc#feat#terminal#open(cmd) 15 | endfunction 16 | 17 | 18 | function! operandi#type#myterm#load() abort 19 | return #{ 20 | \ source: function('s:source'), 21 | \ executor: function('s:executor'), 22 | \ } 23 | endfunction 24 | 25 | function s:expandpath() abort 26 | let pos = mode() ==# 'c' ? getcmdpos() : col('.') 27 | let line = mode() ==# 'c' ? getcmdline() : getline('.') 28 | 29 | let left = line[pos - 2] 30 | 31 | if left ==# '/' 32 | return expand('#:p:t') 33 | else 34 | return expand('#:p:h') .. '/' 35 | endif 36 | endfunction 37 | 38 | function s:hook() abort 39 | inoremap P expandpath() 40 | tcd #:p:h 41 | endfunction 42 | 43 | augroup operandi#open#myterm 44 | autocmd User operandi#open#myterm ++nested call s:hook() 45 | augroup END 46 | -------------------------------------------------------------------------------- /denops/@ddu-sources/kenshou_1s.ts: -------------------------------------------------------------------------------- 1 | import { BaseSource } from "jsr:@shougo/ddu-vim/source"; 2 | import { Item } from "jsr:@shougo/ddu-vim/types"; 3 | import { abortable } from "jsr:@std/async"; 4 | 5 | type Never = Record; 6 | 7 | export class Source extends BaseSource { 8 | gather(): ReadableStream[]> { 9 | console.log(`gather start ${Math.random()}`); 10 | const abortController = new AbortController(); 11 | return new ReadableStream({ 12 | start: async (controller) => { 13 | try { 14 | while (true) { 15 | await abortable( 16 | new Promise((resolve) => setTimeout(resolve, 1000)), 17 | abortController.signal, 18 | ); 19 | controller.enqueue([{ 20 | word: String(Math.random()), 21 | }]); 22 | } 23 | } finally { 24 | controller.close(); 25 | } 26 | }, 27 | cancel(reason): void { 28 | abortController.abort(); 29 | console.log(`gather cancel ${Math.random()}`); 30 | console.log(reason); 31 | }, 32 | }); 33 | } 34 | params(): Never { 35 | return {}; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /denops/@ddu-sources/nixpkgs.ts: -------------------------------------------------------------------------------- 1 | import { BaseSource } from "jsr:@shougo/ddu-vim/source"; 2 | import { Item } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | type Never = Record; 5 | 6 | export class Source extends BaseSource { 7 | override kind = "nixpkgs"; 8 | gather(): ReadableStream[]> { 9 | return new ReadableStream({ 10 | start: async (controller) => { 11 | try { 12 | const names = await new Deno.Command("nix", { 13 | args: [ 14 | "eval", 15 | "--extra-experimental-features", 16 | "nix-command flakes", 17 | "--raw", 18 | "nixpkgs#pkgs", 19 | "--apply", 20 | "pkgs: builtins.toJSON (builtins.attrNames pkgs)", 21 | ], 22 | stdout: "piped", 23 | stderr: "null", 24 | }).output() 25 | .then(({ stdout }) => new Response(stdout).json()) as string[]; 26 | controller.enqueue(names.map((word) => ({ 27 | word, 28 | }))); 29 | } finally { 30 | controller.close(); 31 | } 32 | }, 33 | }); 34 | } 35 | params(): Never { 36 | return {}; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /conf/plug/ddt.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/Shougo/ddt.vim' 3 | hook_add = ''' 4 | nnoremap ms call ddt#start(#{ 5 | \ name: t:->get('ddt_ui_shell_last_name', 6 | \ 'shell-' .. win_getid()), 7 | \ ui: 'shell', 8 | \ }) 9 | let s:rustlibdir = expand('~/.config/vim-nix/deno-pty-ffi/lib') 10 | if isdirectory(s:rustlibdir) 11 | let $RUST_LIB_PATH = s:rustlibdir 12 | endif 13 | ''' 14 | hook_source = ''' 15 | call ddt#custom#patch_global(#{ 16 | \ nvimServer: '~/.cache/nvim/server.pipe', 17 | \ uiParams: #{ 18 | \ shell: #{ 19 | \ noSaveHistoryCommands: ['history'], 20 | \ prompt: '%', 21 | \ promptPattern: '\w*% \?', 22 | \ shellHistoryPath: '~/.cache/ddt-shell-history'->expand(), 23 | \ }, 24 | \ terminal: #{ 25 | \ command: ['zsh'], 26 | \ promptPattern: has('win32') ? '\f\+>' : '\w*% \?', 27 | \ }, 28 | \ }, 29 | \ }) 30 | ''' 31 | 32 | [[plugins]] 33 | repo = 'https://github.com/Shougo/ddt-ui-shell' 34 | 35 | [plugins.ftplugin] 36 | ddt-shell = ''' 37 | nnoremap 38 | \ call ddt#ui#do_action('executeLine') 39 | ''' 40 | 41 | -------------------------------------------------------------------------------- /conf/plug/ddu/lib/helper.ts: -------------------------------------------------------------------------------- 1 | import { Denops } from "jsr:@denops/std"; 2 | import { DduItem, DduOptions } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | // 型wrapper 5 | // いるものしか定義してないので適宜増やすこと 6 | 7 | class Helper { 8 | denops: Denops; 9 | constructor(denops: Denops) { 10 | this.denops = denops; 11 | } 12 | start(options: Partial) { 13 | // return this.denops.call("ddu#start", options); 14 | // こうしておくとその場でカスタムアクションとか作って渡せるはず 15 | return this.denops.dispatcher.start(options); 16 | } 17 | getItemActionNames(name: string, items: DduItem[]) { 18 | return this.denops.dispatcher.getItemActionNames( 19 | name, 20 | items, 21 | ) as Promise; 22 | } 23 | itemAction( 24 | name: string, 25 | action: string, 26 | items: DduItem[], 27 | params: Record, 28 | ) { 29 | return this.denops.call("ddu#item_action", name, action, items, params); 30 | } 31 | uiSyncAction(name: string, params: Record = {}) { 32 | return this.denops.call("ddu#ui#sync_action", name, params); 33 | } 34 | uiGetSelectedItems() { 35 | return this.denops.call("ddu#ui#get_selected_items") as Promise; 36 | } 37 | } 38 | 39 | export function dduHelper(denops: Denops) { 40 | return new Helper(denops); 41 | } 42 | -------------------------------------------------------------------------------- /autoload/p/ddu/ff.vim: -------------------------------------------------------------------------------- 1 | let s:uiready = v:false 2 | 3 | function p#ddu#ff#filter(input = v:null) 4 | if has('nvim') 5 | autocmd vimrc CmdlineEnter @ ++once call cmdline#enable() 6 | endif 7 | let params = a:input is v:null ? {} : {'input': a:input} 8 | call ddu#ui#do_action('openFilterWindow', params) 9 | endfunction 10 | 11 | function p#ddu#ff#wait(startfilter = v:false) 12 | let s:uiready = v:false 13 | augroup p#ddu#ff#wait 14 | autocmd! 15 | autocmd User Ddu:uiReady let s:uiready = v:true 16 | augroup END 17 | let chars = '' 18 | let startfilter = a:startfilter 19 | while v:true 20 | let char = getcharstr(0) 21 | if !startfilter && char ==# 'i' 22 | let startfilter = v:true 23 | let char = '' 24 | endif 25 | let chars ..= char 26 | sleep 1m 27 | if s:uiready 28 | break 29 | endif 30 | endwhile 31 | if startfilter 32 | " let chars = "\call ddu#ui#do_action('openFilterWindow')\" .. chars 33 | " 詰まってる処理の後に差し込む 34 | call timer_start(1, {->p#ddu#ff#filter(chars)}) 35 | else 36 | call feedkeys(chars, 'it') 37 | endif 38 | endfunction 39 | 40 | function p#ddu#ff#start(options, startfilter = v:false) 41 | call p#ddu#wait() 42 | call ddu#start(a:options) 43 | call p#ddu#ff#wait(a:startfilter) 44 | endfunction 45 | -------------------------------------------------------------------------------- /autoload/vimrc/denops.vim: -------------------------------------------------------------------------------- 1 | let s:fragment_count = 0 2 | 3 | function vimrc#denops#load(name, path) abort 4 | let s:fragment_count += 1 5 | call denops#plugin#load(a:name, 'file://' .. a:path .. '#denops_loader' .. s:fragment_count) 6 | endfunction 7 | 8 | function vimrc#denops#autoload(name) abort 9 | let plugin = 'vimrc_' .. a:name 10 | if !denops#plugin#is_loaded(plugin) 11 | let files = globpath(&runtimepath, 'denops/@vimrc/' .. a:name .. '.ts', 1, 1) 12 | if empty(files) 13 | throw "can't find plugin: " .. a:name 14 | endif 15 | call vimrc#denops#load(plugin, files[0]) 16 | endif 17 | endfunction 18 | 19 | function vimrc#denops#request(name, method, params) abort 20 | let plugin = 'vimrc_' .. a:name 21 | call vimrc#denops#autoload(a:name) 22 | call denops#plugin#wait(plugin) 23 | return denops#request(plugin, a:method, a:params) 24 | endfunction 25 | 26 | function vimrc#denops#notify(name, method, params) abort 27 | if denops#server#status() !=# 'running' 28 | call denops#server#wait_async({->vimrc#denops#notify(a:name, a:method, a:params)}) 29 | return 30 | endif 31 | let plugin = 'vimrc_' .. a:name 32 | call vimrc#denops#autoload(a:name) 33 | let method = a:method 34 | let params = a:params 35 | call denops#plugin#wait_async(plugin, {-> denops#notify(plugin, method, params) }) 36 | endfunction 37 | -------------------------------------------------------------------------------- /denops/@ddu-sources/list.ts: -------------------------------------------------------------------------------- 1 | import { Callback } from "../@ddu-kinds/callback.ts"; 2 | import { BaseSource, GatherArguments } from "jsr:@shougo/ddu-vim/source"; 3 | import { DduItem, DduOptions, Item } from "jsr:@shougo/ddu-vim/types"; 4 | 5 | type Items = Array; 6 | 7 | type Params = { 8 | items: Items; 9 | }; 10 | 11 | export class Source extends BaseSource { 12 | override kind = "callback"; 13 | gather(args: GatherArguments): ReadableStream[]> { 14 | return new ReadableStream({ 15 | start: (controller) => { 16 | try { 17 | controller.enqueue( 18 | args.sourceParams.items.map((item) => 19 | typeof item === "object" ? item : { 20 | word: item, 21 | } 22 | ), 23 | ); 24 | } finally { 25 | controller.close(); 26 | } 27 | }, 28 | }); 29 | } 30 | params(): Params { 31 | return { 32 | items: [], 33 | }; 34 | } 35 | } 36 | 37 | export function buildOptions( 38 | items: Items, 39 | callback: Callback, 40 | ): Partial { 41 | return { 42 | sources: [{ 43 | name: "list", 44 | params: { 45 | items, 46 | }, 47 | }], 48 | kindParams: { 49 | callback: { 50 | callback, 51 | }, 52 | }, 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /autoload/vimrc/dpp.vim: -------------------------------------------------------------------------------- 1 | " headlessでdenops動かすのが困難なので裏でターミナル起こす 2 | let s:id = -1 3 | 4 | if has('nvim') 5 | let s:finish = v:true 6 | 7 | function s:wait() 8 | if !s:finish 9 | echo 'wait makestate' 10 | redraw 11 | call wait(-1, 's:finish', 10) 12 | endif 13 | endfunction 14 | 15 | augroup vimrc_dpp_makestate 16 | autocmd VimLeavePre * call s:wait() 17 | augroup END 18 | 19 | function vimrc#dpp#makestate_job() 20 | call jobstop(s:id) 21 | let s:finish = v:false 22 | let s:id = jobstart('~/.vim/f'->expand(), #{ 23 | \ env: #{ 24 | \ VIM: '', 25 | \ VIMRUNTIME: '', 26 | \ }, 27 | \ on_exit: {job, status -> [ 28 | \ execute('echomsg "makestate end: " .. status', ''), 29 | \ execute('if status == 0 | let s:finish = v:true | endif', ''), 30 | \ ]}, 31 | \ pty: v:true, 32 | \ }) 33 | endfunction 34 | else 35 | " Vimだとターミナルあると終了できないので待たなくてもいい 36 | function vimrc#dpp#makestate_job() 37 | silent! call job_stop(s:id, 'kill') 38 | let s:id = term_start('~/.vim/f'->expand(), #{ 39 | \ env: #{ 40 | \ VIM: '', 41 | \ VIMRUNTIME: '', 42 | \ }, 43 | \ exit_cb: {job, status -> [ 44 | \ execute('echomsg "makestate end: " .. status', ''), 45 | \ ]}, 46 | \ hidden: v:true, 47 | \ }) 48 | endfunction 49 | endif 50 | -------------------------------------------------------------------------------- /script/gitupdate/snap/diff.ts: -------------------------------------------------------------------------------- 1 | import { exec, type Repo } from "./libsnapshot.ts"; 2 | 3 | await Deno.remove("/data/vim/diff", { 4 | recursive: true, 5 | }).catch(console.trace); 6 | await Deno.mkdir("/data/vim/diff", { 7 | recursive: true, 8 | }); 9 | 10 | const repos = JSON.parse(Deno.readTextFileSync(Deno.args[0])) as Repo[]; 11 | for (const repo of repos) { 12 | const hash = await exec(["git", "rev-parse", "@"], repo.path); 13 | if (repo.hash === hash) { 14 | continue; 15 | } 16 | console.log(repo.path); 17 | await new Deno.Command("git", { 18 | args: ["--no-pager", "diff", "--stat", repo.hash], 19 | cwd: repo.path, 20 | }).spawn().status; 21 | const hashes = await exec( 22 | [ 23 | "git", 24 | "log", 25 | "--since=" + (repo.date + 1), 26 | "--pretty=format:%H", 27 | ], 28 | repo.path, 29 | ) 30 | .then((o) => o.split(/\n/)); 31 | if (hashes[0] === "") { 32 | continue; 33 | } 34 | const dir = "/data/vim/diff/" + repo.path.replaceAll(/\//g, "_") + "/"; 35 | Deno.mkdir(dir); 36 | const pad = String(hashes.length).length; 37 | for (let i = 0; i < hashes.length; i++) { 38 | const show = await exec( 39 | ["git", "show", hashes[i]], 40 | repo.path, 41 | ); 42 | await Deno.writeTextFile( 43 | dir + String(i + 1).padStart(pad, "0") + ".diff", 44 | show, 45 | ); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /denops/@vimrc/lib/ahocorasick.ts: -------------------------------------------------------------------------------- 1 | type Trie = { 2 | next: Record; 3 | value?: string; 4 | }; 5 | 6 | function makeTrie(needle: string[]): Trie { 7 | const root: Trie = { 8 | next: {}, 9 | }; 10 | for (const n of needle) { 11 | let current = root; 12 | for (let i = 0; i < n.length; i++) { 13 | const c = n[i]; 14 | current = current.next[c] = current.next[c] ?? { 15 | next: {}, 16 | }; 17 | if (i == n.length - 1) { 18 | current.value = n; 19 | } 20 | } 21 | } 22 | return root; 23 | } 24 | 25 | export function find(haystack: string, needle: string[]): Set { 26 | const found = new Set(); 27 | const root = makeTrie(needle); 28 | let current = root; 29 | for (let i = 0; i <= haystack.length; i++) { 30 | const c = haystack[i]; 31 | if (current.next[c] == null) { 32 | if (current.value != null) { 33 | found.add(current.value); 34 | } 35 | current = root; 36 | } 37 | if (current.next[c] != null) { 38 | current = current.next[c]; 39 | } 40 | } 41 | return found; 42 | } 43 | 44 | Deno.test({ 45 | name: "find", 46 | fn() { 47 | const result = [...find("foobarbaz", ["foo", "ba", "buz", "baz", "qux"])]; 48 | const actual = JSON.stringify(result); 49 | const expected = JSON.stringify(["foo", "ba", "baz"]); 50 | if (actual !== expected) { 51 | throw Error(`actual(${actual}) !== expected(${expected})`); 52 | } 53 | }, 54 | }); 55 | -------------------------------------------------------------------------------- /conf/rc/on_autocmd/cmd_undefined.vim: -------------------------------------------------------------------------------- 1 | " :KeepCursor {excmd} 2 | " from https://github.com/thinca/config/blob/74009e9e9d4a66bae820c592343351bc7d0ee4b8/dotfiles/dot.vim/vimrc#L1402-L1402 3 | command! -nargs=+ KeepCursor call vimrc#keep_cursor() 4 | 5 | " Show 'runtimepath'. 6 | " from https://github.com/thinca/config/blob/74009e9e9d4a66bae820c592343351bc7d0ee4b8/dotfiles/dot.vim/vimrc#L1395-L1395 7 | command! -bar RTP echo substitute(&runtimepath, ',', "\n", 'g') 8 | 9 | " from defaults.vim 10 | command! DiffOrig tab split | vert new | set buftype=nofile | read ++edit # | 0d_ 11 | \ | diffthis | wincmd p | diffthis 12 | 13 | " 開いているファイルを削除 14 | command! DeleteIt :!trash-put "%" 15 | 16 | " tmuxでVim開いてるwindowにfocusするやつ 17 | command! TmuxFocus call vimrc#denops#notify('tmux', 'focus', []) 18 | 19 | " DduSelectorCallの遅延 20 | if exists(':DduSelectorCall') != 2 21 | command! -nargs=1 DduSelectorCall autocmd User vimrc.ddu.ready ++once DduSelectorCall 22 | endif 23 | 24 | " VIMEするやつ 25 | function s:vime() abort 26 | augroup vimrc.vime 27 | autocmd! 28 | autocmd User vimrc.yank call vimrc#denops#request('tmux', 'detach', []) 29 | augroup END 30 | nnoremap e %di 31 | nnoremap w ggVG 32 | xnoremap w ggoG 33 | endfunction 34 | 35 | command! VIME call s:vime() 36 | 37 | " 裏にあるファイルのバッファを全削除するやつ 38 | command! BWipeoutAll echo getbufinfo()->filter('getbufvar(v:val.bufnr, "&buftype")->empty() && v:val.windows->empty()')->map('[execute("bwipeout! " .. v:val.bufnr), v:val.name][1]') 39 | 40 | -------------------------------------------------------------------------------- /script/build/build/deno_std.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env -S deno run -A 2 | 3 | // import "@std/assert" 4 | // import "@std/internal/io" 5 | type WalkEntry = Deno.DirEntry & { 6 | path: string; 7 | }; 8 | 9 | function* walk(initialPath: string): Generator { 10 | const queue = [initialPath]; 11 | for (let cursor = 0; cursor < queue.length; cursor++) { 12 | const path = queue[cursor]; 13 | const es = [...Deno.readDirSync(path)] 14 | .sort((a, b) => a.name.localeCompare(b.name)); 15 | for (const e of es) { 16 | const newPath = path + "/" + e.name; 17 | yield { 18 | ...e, 19 | path: newPath, 20 | }; 21 | if (e.isDirectory) { 22 | queue.push(newPath); 23 | } 24 | } 25 | } 26 | } 27 | 28 | for (const e of walk(".")) { 29 | if (e.path.endsWith(".ts")) { 30 | const data = Deno.readTextFileSync(e.path); 31 | const dest = data.replaceAll(/"@std\/[^"]+"/g, (str) => { 32 | const raw = str.slice(1, -1); 33 | const sp = raw.split("/"); 34 | const mod = sp[1].replaceAll(/-/g, "_"); 35 | const sub = sp[2]?.replaceAll(/-/g, "_") ?? "mod"; 36 | const base = `/data/vim/deps/deno_std/${mod}/${sub}`; 37 | const ts = base + ".ts"; 38 | try { 39 | Deno.statSync(ts); 40 | return `"${ts}"`; 41 | } catch { 42 | return `"${base}/mod.ts"`; 43 | } 44 | }); 45 | if (data != dest) { 46 | console.log(`process ${e.path}`); 47 | } 48 | Deno.writeTextFileSync(e.path, dest); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /vimrcs/man.vim: -------------------------------------------------------------------------------- 1 | set nocompatible 2 | 3 | function s:pagedown() abort 4 | let line = line('.') 5 | let topline = winsaveview().topline 6 | normal! L 7 | if line == line('.') 8 | " 末尾にいたらPageDown 9 | normal! ztL 10 | endif 11 | if line('.') == line('$') 12 | " 行末に来たらウィンドウの末尾と最下行を合わせる 13 | normal! z- 14 | if winsaveview().topline != topline 15 | " サクラエディタ風の挙動 16 | " 既に行末にいる場合以外は元の行末にカーソルを置く 17 | execute line 18 | else 19 | endif 20 | endif 21 | normal! 0 22 | endfunction 23 | 24 | function s:pageup() abort 25 | let line = line('.') 26 | let topline = winsaveview().topline 27 | normal! H 28 | if line == line('.') 29 | " 先頭にいたらPageUp 30 | normal! zbH 31 | endif 32 | let newtopline = winsaveview().topline 33 | if newtopline == 1 && topline != newtopline 34 | " 上と同じく 35 | execute line 36 | endif 37 | normal! 0 38 | endfunction 39 | 40 | function! s:align() abort 41 | let pos = getcurpos()[1:] 42 | let view = winsaveview() 43 | normal! gg 44 | while v:true 45 | let cl = line('.') 46 | if line('w0') <= pos[0] && pos[0] <= line('w$') 47 | call cursor(pos) 48 | return 49 | endif 50 | normal! Lzt 51 | if cl == line('.') 52 | call winrestview(view) 53 | echomsg 'wtf?' 54 | endif 55 | endwhile 56 | endfunction 57 | 58 | nnoremap + call align() 59 | nnoremap - call pageup() 60 | nnoremap @ call pagedown() 61 | nnoremap Q cquit 0 62 | runtime ftplugin/man.vim 63 | nnoremap m :tab Man 64 | -------------------------------------------------------------------------------- /conf/rc/colors/def/edge_light.vim: -------------------------------------------------------------------------------- 1 | function s:on_color_scheme() abort 2 | hi Pmenu guibg=#e0e0ff guifg=#6060ff 3 | hi PmenuSel guifg=#ff6060 guibg=#ffe8e8 4 | hi NormalFloat guibg=#e0e0ff guifg=#6060ff 5 | hi CmpItemAbbr guifg=#6060ff 6 | hi CmpItemKindText guifg=#6060ff 7 | hi PumHighlight ctermfg=205 ctermbg=225 guifg=#ff60c0 guibg=#ffd0ff cterm=NONE gui=NONE 8 | 9 | hi diffAdded guibg=#e0ffe0 guifg=#608060 10 | hi diffNewFile guibg=#e0ffe0 guifg=#608060 11 | 12 | hi diffRemoved guifg=#ff6060 guibg=#ffe8e8 13 | hi diffOldFile guifg=#ff6060 guibg=#ffe8e8 14 | 15 | " こっちで勝手に追加したやつ 16 | " see $VIMCONF/after/syntax/diff.vim 17 | hi diffIndicator guibg=#e0e0ff 18 | 19 | if has('nvim') 20 | hi @text.diff.indicator guibg=#e0e0ff 21 | hi @text.diff.add guibg=#e0ffe0 guifg=#608060 22 | hi link @text.diff.addsign @text.diff.add 23 | hi @text.diff.addindicator guibg=#e0e0ff guifg=#40b040 24 | hi link @text.diff.delete PmenuSel 25 | hi link @text.diff.delsign PmenuSel 26 | hi @text.diff.delindicator guibg=#e0e0ff guifg=#ff6060 27 | endif 28 | 29 | let s:palette = edge#get_palette('light', 0, {}) 30 | "execute 'hi FuzzyMotionChar guifg=' .. s:palette.purple[0] 31 | execute 'hi FuzzyMotionSubChar guifg=' .. s:palette.green[0] 32 | execute 'hi FuzzyMotionMatch guibg=' .. s:palette.diff_green[0] 33 | execute 'hi FuzzyMotionShade guifg=' .. s:palette.grey_dim[0] 34 | endfunction 35 | 36 | autocmd persistent_colorscheme ColorScheme edge call s:on_color_scheme() 37 | 38 | set background=light 39 | let g:edge_disable_italic_comment = 1 40 | colorscheme edge 41 | -------------------------------------------------------------------------------- /denops/@ddc-sources/list.ts: -------------------------------------------------------------------------------- 1 | import { is, maybe } from "jsr:@core/unknownutil"; 2 | import { 3 | BaseSource, 4 | GatherArguments, 5 | OnCompleteDoneArguments, 6 | } from "jsr:@shougo/ddc-vim/source"; 7 | import { Item } from "jsr:@shougo/ddc-vim/types"; 8 | 9 | export type Params = { 10 | candidates: Array; 11 | callback?: string | ((args: OnCompleteDoneArguments) => unknown); 12 | }; 13 | 14 | export class Source extends BaseSource { 15 | override gather({ sourceParams }: GatherArguments): Promise { 16 | return Promise.resolve( 17 | sourceParams.candidates.map((candidate) => { 18 | if (is.String(candidate)) { 19 | return { 20 | word: candidate, 21 | user_data: { 22 | word: candidate, 23 | }, 24 | }; 25 | } else { 26 | return { 27 | ...candidate, 28 | user_data: maybe(candidate.user_data, is.Record) ?? {}, 29 | }; 30 | } 31 | }), 32 | ); 33 | } 34 | 35 | override params(): Params { 36 | return { 37 | candidates: [], 38 | }; 39 | } 40 | 41 | override async onCompleteDone( 42 | args: OnCompleteDoneArguments, 43 | ) { 44 | const callback = args.sourceParams.callback; 45 | if (typeof callback === "string") { 46 | await args.denops.call( 47 | "denops#callback#call", 48 | args.sourceParams.callback, 49 | args, 50 | ); 51 | } else if (typeof callback === "function") { 52 | await callback(args); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /denops/@ddu-kinds/nixpkgs.ts: -------------------------------------------------------------------------------- 1 | import { BaseKind } from "jsr:@shougo/ddu-vim/kind"; 2 | import { ActionArguments, ActionFlags } from "jsr:@shougo/ddu-vim/types"; 3 | 4 | type Never = Record; 5 | 6 | export class Kind extends BaseKind { 7 | override actions: Record< 8 | string, 9 | (args: ActionArguments) => Promise 10 | > = { 11 | open: async (args) => { 12 | for (const item of args.items) { 13 | const pkg = item.word; 14 | const input = [ 15 | `${pkg}.meta.position`, 16 | `${pkg}.__functor ${pkg}`, 17 | `${pkg}`, 18 | "\n", 19 | ].join("\n"); 20 | const cmd = new Deno.Command("nix", { 21 | args: [ 22 | "repl", 23 | "--extra-experimental-features", 24 | "nix-command flakes", 25 | "nixpkgs#pkgs", 26 | ], 27 | stdin: "piped", 28 | stdout: "piped", 29 | stderr: "piped", 30 | }).spawn(); 31 | const w = cmd.stdin.getWriter(); 32 | await w.write(new TextEncoder().encode(input)); 33 | await w.close(); 34 | const output = await cmd.output(); 35 | const stdout = new TextDecoder().decode(output.stdout); 36 | const m = stdout.match(/(\/nix\/store\/[^:]+):(\d+)/); 37 | if (m != null) { 38 | await args.denops.cmd("tabedit " + m[1]); 39 | await args.denops.cmd(m[2]); 40 | } 41 | } 42 | return ActionFlags.None; 43 | }, 44 | }; 45 | override params(): Never { 46 | return {}; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /init: -------------------------------------------------------------------------------- 1 | #!/bin/bash -u 2 | 3 | shopt -s globstar 4 | 5 | VIMCONF=$(dirname $(realpath $0)) 6 | 7 | # install dpp.vim 8 | 9 | fget () { 10 | rm -rf /tmp/fget 11 | echo "$1" 12 | git clone --reference-if-able "$2" --dissociate "$1" /tmp/fget || exit 1 13 | rsync --mkpath -a --delete-before /tmp/fget/ "$2/" 14 | } 15 | 16 | fget https://github.com/Omochice/importmap-expand /data/vim/repos/github.com/Omochice/importmap-expand 17 | fget https://github.com/Shougo/dpp-ext-lazy /data/vim/repos/github.com/Shougo/dpp-ext-lazy 18 | fget https://github.com/Shougo/dpp-ext-toml /data/vim/repos/github.com/Shougo/dpp-ext-toml 19 | fget https://github.com/Shougo/dpp-protocol-git /data/vim/repos/github.com/Shougo/dpp-protocol-git 20 | fget https://github.com/Shougo/dpp.vim /data/vim/repos/github.com/Shougo/dpp.vim 21 | fget https://github.com/jsr-core/unknownutil /data/vim/repos/github.com/jsr-core/unknownutil 22 | fget https://github.com/vim-denops/deno-denops-std /data/vim/repos/github.com/vim-denops/deno-denops-std 23 | fget https://github.com/vim-denops/denops.vim /data/vim/repos/github.com/vim-denops/denops.vim 24 | 25 | # link deno deps 26 | rm -rf /data/vim/deps 27 | ln -s $(realpath $(dirname $0))/denops/@deps /data/vim/deps 28 | 29 | # update deno deps 30 | fget https://github.com/denoland/deno_std /data/vim/repos/github.com/denoland/deno_std 31 | cd /data/vim/repos/github.com/denoland/deno_std 32 | $VIMCONF/script/build/build/deno_std.ts 33 | cd - 34 | cd /data/vim/repos/github.com/vim-denops/deno-denops-std 35 | deno run -A /data/vim/repos/github.com/Omochice/importmap-expand/cli.ts **/*.ts --option deno.jsonc 36 | cd - 37 | -------------------------------------------------------------------------------- /conf/plug/ddc.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/kuuote/ddc-source-yank' 3 | hook_add = ''' 4 | nnoremap cd call ddc#source#yank#clear() 5 | nnoremap cy set operatorfunc=ddc#source#yank#registerg@ 6 | nnoremap cyy set operatorfunc=ddc#source#yank#registerg@_ 7 | xnoremap Y set operatorfunc=ddc#source#yank#registerg@ 8 | ''' 9 | 10 | [[plugins]] 11 | repo = 'https://github.com/LumaKernel/ddc-source-file' 12 | 13 | [[plugins]] 14 | repo = 'https://github.com/Shougo/ddc-source-around' 15 | 16 | [[plugins]] 17 | repo = 'https://github.com/Shougo/ddc-source-cmdline' 18 | 19 | [[plugins]] 20 | repo = 'https://github.com/Shougo/ddc-source-input' 21 | 22 | [[plugins]] 23 | repo = 'https://github.com/Shougo/ddc-source-line' 24 | 25 | [[plugins]] 26 | repo = 'https://github.com/Shougo/ddc-source-lsp' 27 | 28 | [[plugins]] 29 | repo = 'https://github.com/Shougo/ddc-source-shell-native' 30 | 31 | [[plugins]] 32 | repo = 'https://github.com/Shougo/ddc-ui-native' 33 | 34 | [[plugins]] 35 | repo = 'https://github.com/Shougo/ddc-ui-none' 36 | 37 | [[plugins]] 38 | repo = 'https://github.com/Shougo/ddc-ui-pum' 39 | 40 | [[plugins]] 41 | repo = 'https://github.com/Shougo/ddc.vim' 42 | on_event = ['CmdlineEnter', 'InsertEnter'] 43 | hook_source = ''' 44 | source $VIMCONF/conf/plug/ddc.vim 45 | ''' 46 | 47 | [[plugins]] 48 | repo = 'https://github.com/Shougo/pum.vim' 49 | on_func = 'pum#' 50 | # L 51 | hook_source = ''' 52 | call pum#set_option('direction', 'below') 53 | call pum#set_option('highlight_matches', '') 54 | ''' 55 | 56 | [[plugins]] 57 | repo = 'https://github.com/tani/ddc-fuzzy' 58 | 59 | -------------------------------------------------------------------------------- /conf/plug/nvim/main.toml: -------------------------------------------------------------------------------- 1 | [[plugins]] 2 | repo = 'https://github.com/folke/snacks.nvim' 3 | lazy = true 4 | lua_add = ''' 5 | _G.Snacks = setmetatable({}, { 6 | __index = function(_, k) 7 | vim.call("dpp#source", { "snacks.nvim" }) 8 | return _G.Snacks[k] 9 | end, 10 | }) 11 | ''' 12 | 13 | [[plugins]] 14 | repo = 'https://github.com/hrsh7th/nvim-insx' 15 | on_event = 'InsertEnter' 16 | hook_source = ''' 17 | source $VIMCONF/conf/plug/nvim/insx.lua 18 | ''' 19 | 20 | [[plugins]] 21 | repo = 'https://github.com/ibhagwan/fzf-lua' 22 | on_cmd = 'FzfLua' 23 | on_lua = 'fzf-lua' 24 | 25 | [[plugins]] 26 | repo = 'https://github.com/j-hui/fidget.nvim' 27 | on_event = ['LspAttach'] 28 | lua_source = ''' 29 | require('fidget').setup {} 30 | ''' 31 | 32 | [[plugins]] 33 | repo = 'https://github.com/lewis6991/gitsigns.nvim' 34 | on_cmd = 'Gitsigns' 35 | lua_source = ''' 36 | require("gitsigns").setup({ 37 | signcolumn = false, -- Toggle with `:Gitsigns toggle_signs` 38 | }) 39 | ''' 40 | 41 | [[plugins]] 42 | repo = 'https://github.com/monaqa/dial.nvim' 43 | on_map = '(dial' 44 | lua_add = ''' 45 | vim.keymap.set('n', '', '(dial-increment)') 46 | vim.keymap.set('n', '', '(dial-decrement)') 47 | ''' 48 | hook_source = ''' 49 | source $VIMCONF/conf/plug/nvim/dial.lua 50 | ''' 51 | 52 | [[plugins]] 53 | repo = 'https://github.com/stevearc/oil.nvim' 54 | on_lua = 'oil' 55 | on_cmd = 'Oil' 56 | lua_source = ''' 57 | require('oil').setup { 58 | default_file_explorer = false, 59 | } 60 | ''' 61 | 62 | [[plugins]] 63 | repo = 'NeogitOrg/neogit' 64 | on_cmd = 'Neogit' 65 | lua_source = ''' 66 | require('neogit').setup {} 67 | ''' 68 | 69 | [[plugins]] 70 | repo = 'nvim-lua/plenary.nvim' 71 | 72 | -------------------------------------------------------------------------------- /bundle/vim-operandi/autoload/operandi.vim: -------------------------------------------------------------------------------- 1 | augroup operandi#internal 2 | autocmd User operandi#open#* : 3 | augroup END 4 | 5 | let s:types = {} 6 | 7 | function! s:get_type(type) abort 8 | if !has_key(s:types, a:type) 9 | let l:type = operandi#type#{a:type}#load() 10 | let s:types[a:type] = l:type 11 | return l:type 12 | endif 13 | return s:types[a:type] 14 | endfunction 15 | 16 | function! operandi#execute(opts = {}) abort 17 | if !exists('b:operandi') 18 | return 19 | endif 20 | let l:operandi = b:operandi 21 | let l:cmd = getline('.') 22 | 23 | call operandi#opener#{l:operandi.opener}#close() 24 | if !win_gotoid(l:operandi.winid) 25 | throw 'operandi: parent window is already closed' 26 | endif 27 | 28 | call l:operandi.executor(l:cmd, a:opts) 29 | endfunction 30 | 31 | let s:bufs = [] 32 | 33 | function! operandi#open(type, opts = {}) abort 34 | let l:operandi = {} 35 | let l:operandi.winid = win_getid() 36 | let l:operandi.opener = get(a:opts, 'opener', 'tab') 37 | 38 | call operandi#opener#{l:operandi.opener}#open() 39 | setlocal buftype=nofile bufhidden=hide noswapfile 40 | 41 | let to_remove = s:bufs->copy()->filter('empty(win_findbuf(v:val))') 42 | for b in to_remove 43 | silent! execute 'bwipeout!' b 44 | endfor 45 | eval s:bufs->filter('!empty(getbufinfo(v:val))') 46 | eval s:bufs->add(bufnr()) 47 | 48 | let l:type = s:get_type(a:type) 49 | call setline(2, l:type.source()) 50 | let l:operandi.executor = l:type.executor 51 | 52 | let b:operandi = l:operandi 53 | execute 'doautocmd User operandi#open#' .. a:type 54 | endfunction 55 | 56 | function! operandi#register(type, def) abort 57 | let s:types[a:type] = a:def 58 | endfunction 59 | -------------------------------------------------------------------------------- /conf/plug/lspoints.vim: -------------------------------------------------------------------------------- 1 | function s:initialize() 2 | call lspoints#load_extensions([ 3 | \ 'config', 4 | \ 'format', 5 | \ 'lsputil', 6 | \ 'nvim_diagnostics', 7 | \ ]) 8 | " \ 'semantic_tokens', 9 | endfunction 10 | call s:initialize() 11 | 12 | function s:on_attach() 13 | " L 14 | let b:ddu_source_lsp_clientName = 'lspoints' 15 | 16 | nnoremap K echo lspoints#request('denols', 'textDocument/hover', denops#request('lspoints', 'executeCommand', ['lsputil', 'makePositionParams'])) 17 | nnoremap gd DduSelectorCall lsp_definition 18 | nnoremap ma DduSelectorCall lsp_codeAction 19 | nnoremap md DduSelectorCall lsp_diagnostic 20 | nnoremap mf call denops#request('lspoints', 'executeCommand', ['format', 'execute', bufnr()]) 21 | endfunction 22 | autocmd vimrc User LspointsAttach:* call s:on_attach() 23 | 24 | function s:attach_denols() abort 25 | let name = bufname() 26 | if name =~# ':/' && name !~# '^\v(file|deno)' 27 | return 28 | endif 29 | let deno_json = findfile('deno.json', '.;') 30 | if empty(deno_json) 31 | let deno_json = findfile('deno.jsonc', '.;') 32 | endif 33 | if empty(deno_json) 34 | call lspoints#attach('denols') 35 | else 36 | let options = #{rootPath: deno_json->fnamemodify(':p:h')} 37 | call lspoints#attach('denols', options) 38 | endif 39 | endfunction 40 | 41 | function s:attach() abort 42 | let ft = &filetype 43 | if ft ==# 'typescript' || ft ==# 'typescriptreact' 44 | call s:attach_denols() 45 | endif 46 | endfunction 47 | "autocmd vimrc FileType typescript,typescriptreact call s:attach_denols() 48 | command! LspointsStart call s:attach() 49 | -------------------------------------------------------------------------------- /conf/rc/colors/def/catppuccin-mocha.vim: -------------------------------------------------------------------------------- 1 | function s:on_colors() abort 2 | " Vimで反転するので防止 3 | hi IncSearch cterm=NONE gui=NONE 4 | hi link DiffIndicator PmenuSbar 5 | if !has('nvim') 6 | let g:terminal_ansi_colors = ['#000000']->repeat(16) 7 | for k in keys(g:) 8 | let m = matchstr(k, 'terminal_color_\zs\d\+') 9 | if !empty(m) 10 | let g:terminal_ansi_colors[m] = g:[k] 11 | endif 12 | endfor 13 | endif 14 | lua < 6 | cmap 7 | 8 | for s:rule in lexima#endwise_rule#make() 9 | call lexima#add_rule(s:rule) 10 | endfor 11 | 12 | for s:rule in g:lexima#newline_rules 13 | call lexima#add_rule(s:rule) 14 | endfor 15 | " NixやTOMLの複数行文字列にnewline rule適用する 16 | call lexima#add_rule({'char': '', 'at': "''\\%#''", 'input_after': ''}) 17 | 18 | function s:esc(str) 19 | return escape(a:str, '[') 20 | endfunction 21 | 22 | function s:add_pair_rule(char, input, input_after) 23 | let input = s:esc(a:input) 24 | let input_after = s:esc(a:input_after) 25 | call lexima#add_rule({'char': a:char, 'input': a:input, 'input_after': a:input_after}) 26 | call lexima#add_rule({'char': '', 'at': input .. '\%#' .. input_after, 'delete': 1}) 27 | endfunction 28 | 29 | call s:add_pair_rule("'w", "'", "'") 30 | call s:add_pair_rule("'q", '"', '"') 31 | call s:add_pair_rule("'g", '<', '>') 32 | call s:add_pair_rule("'f", '(', ')') 33 | call s:add_pair_rule("'d", '[', ']') 34 | call s:add_pair_rule("'s", '{', '}') 35 | call s:add_pair_rule("'b", '`', '`') 36 | 37 | " https://cohama.hateblo.jp/entry/2022/01/12/190000 38 | function s:add_leave_rule(seq) 39 | call lexima#add_rule({'char': '', 'at': '\%#\s*' .. a:seq, 'leave': a:seq}) 40 | call lexima#add_rule({'char': '', 'at': '\%#$\n\s*' .. a:seq, 'leave': a:seq}) 41 | endfunction 42 | 43 | call s:add_leave_rule('>') 44 | call s:add_leave_rule(')') 45 | call s:add_leave_rule(']') 46 | call s:add_leave_rule('}') 47 | call s:add_leave_rule("'") 48 | call s:add_leave_rule("''") 49 | call s:add_leave_rule("'''") 50 | call s:add_leave_rule('"') 51 | 52 | source $VIMCONF/conf/plug/vim/lexima/nix.vim 53 | source $VIMCONF/conf/plug/vim/lexima/vim.vim 54 | -------------------------------------------------------------------------------- /script/gitupdate/dpp_dump.ts: -------------------------------------------------------------------------------- 1 | import { Task } from "./run.ts"; 2 | import { as, ensure, is } from "jsr:@core/unknownutil"; 3 | import { type Denops } from "jsr:@denops/std"; 4 | 5 | // sort keys for JSON.stringify 6 | export function stringifyReplacer(_key: string, value: unknown): unknown { 7 | if (!is.Record(value)) return value; 8 | const ret: Record = {}; 9 | for (const key of Object.keys(value).sort()) { 10 | ret[key] = value[key]; 11 | } 12 | return ret; 13 | } 14 | 15 | function isRemoteRepo(repo: unknown): repo is string { 16 | if (!is.String(repo)) { 17 | return false; 18 | } 19 | return repo[0] !== "/"; 20 | } 21 | 22 | export async function main(denops: Denops) { 23 | const recordPlugins = ensure( 24 | await denops.eval("g:dpp#_plugins"), 25 | is.Record, 26 | ); 27 | const tasks: Task[] = Object.values(recordPlugins) 28 | .filter(is.ObjectOf({ 29 | name: is.String, 30 | path: is.String, 31 | repo: isRemoteRepo, 32 | rev: as.Optional(is.String), 33 | // trueとかにするとマッチしなくなるので弾ける 34 | gitupdate_ignore: as.Optional(is.LiteralOf(false)), 35 | })) 36 | .map((plugin) => ({ 37 | repo: plugin.repo, 38 | path: plugin.path, 39 | label: plugin.name, 40 | rev: plugin.rev, 41 | })) 42 | .sort((a, b) => a.label.localeCompare(b.label)); 43 | for (const task of tasks) { 44 | if (!task.repo.includes(":/")) { 45 | task.repo = "https://github.com/" + task.repo; 46 | } 47 | } 48 | const data = JSON.stringify(tasks, stringifyReplacer, "\t"); 49 | const file = new URL("./tasks.json", import.meta.url).pathname; 50 | if (data !== await Deno.readTextFile(file).catch(String)) { 51 | await denops.cmd("echo msg", { msg: "write tasks.json" }); 52 | await Deno.writeTextFile(file, data); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /autoload/operandi/type/mycommand.vim: -------------------------------------------------------------------------------- 1 | let s:history = '/data/vimshared/cmdhist' 2 | 3 | function s:_source() abort 4 | let vim = range(histnr(':'), 0, -1)->map('histget(":", v:val)') 5 | try 6 | let file = readfile(s:history) 7 | catch 8 | let file = [] 9 | endtry 10 | return flatten([vim, file]) 11 | endfunction 12 | function s:source() abort 13 | return s:_source()->vimrc#mru#uniq() 14 | endfunction 15 | 16 | function s:executor(cmd, opts) abort 17 | let typed = get(a:opts, 'typed', v:true) 18 | 19 | let mru_opts = #{data: s:_source()} 20 | if typed 21 | let mru_opts.line = a:cmd 22 | endif 23 | call vimrc#mru#save(s:history, mru_opts) 24 | " 本体の履歴を統合して消す 25 | autocmd SafeState * ++once call histdel(':') 26 | 27 | let s:cmd = a:cmd 28 | autocmd CmdlineEnter * ++once call setcmdline(s:cmd) 29 | call feedkeys(":\", typed ? 'nt' : 'n') 30 | endfunction 31 | 32 | 33 | function! operandi#type#mycommand#load() abort 34 | return #{ 35 | \ source: function('s:source'), 36 | \ executor: function('s:executor'), 37 | \ } 38 | endfunction 39 | 40 | function s:expandpath() abort 41 | let pos = mode() ==# 'c' ? getcmdpos() : col('.') 42 | let line = mode() ==# 'c' ? getcmdline() : getline('.') 43 | 44 | let left = line[pos - 2] 45 | 46 | if left ==# '/' 47 | return fnameescape(expand('#:p:t')) 48 | else 49 | return fnameescape(expand('#:p:h')) .. '/' 50 | endif 51 | endfunction 52 | 53 | function s:hook() abort 54 | silent! tcd #:p:h 55 | setfiletype vim 56 | inoremap P expandpath() 57 | inoremap E call operandi#execute({'typed': v:false}) 58 | nnoremap ; call operandi#execute({'typed': v:false}) 59 | endfunction 60 | 61 | augroup operandi#open#mycommand 62 | autocmd User operandi#open#mycommand ++nested call s:hook() 63 | augroup END 64 | -------------------------------------------------------------------------------- /denops/@ddc-sources/skk_okuri/okuri.ts: -------------------------------------------------------------------------------- 1 | const okuriTable: Record = { 2 | "ぁ": "x", 3 | "あ": "a", 4 | "ぃ": "x", 5 | "い": "i", 6 | "ぅ": "x", 7 | "う": "u", 8 | "ぇ": "x", 9 | "え": "e", 10 | "ぉ": "x", 11 | "お": "o", 12 | "か": "k", 13 | "が": "g", 14 | "き": "k", 15 | "ぎ": "g", 16 | "く": "k", 17 | "ぐ": "g", 18 | "け": "k", 19 | "げ": "g", 20 | "こ": "k", 21 | "ご": "g", 22 | "さ": "s", 23 | "ざ": "z", 24 | "し": "s", 25 | "じ": "j", 26 | "す": "s", 27 | "ず": "z", 28 | "せ": "s", 29 | "ぜ": "z", 30 | "そ": "s", 31 | "ぞ": "z", 32 | "た": "t", 33 | "だ": "d", 34 | "ち": "t", 35 | "ぢ": "d", 36 | "っ": "x", 37 | "つ": "t", 38 | "づ": "d", 39 | "て": "t", 40 | "で": "d", 41 | "と": "t", 42 | "ど": "d", 43 | "な": "n", 44 | "に": "n", 45 | "ぬ": "n", 46 | "ね": "n", 47 | "の": "n", 48 | "は": "h", 49 | "ば": "b", 50 | "ぱ": "p", 51 | "ひ": "h", 52 | "び": "b", 53 | "ぴ": "p", 54 | "ふ": "h", 55 | "ぶ": "b", 56 | "ぷ": "p", 57 | "へ": "h", 58 | "べ": "b", 59 | "ぺ": "p", 60 | "ほ": "h", 61 | "ぼ": "b", 62 | "ぽ": "p", 63 | "ま": "m", 64 | "み": "m", 65 | "む": "m", 66 | "め": "m", 67 | "も": "m", 68 | "ゃ": "x", 69 | "や": "y", 70 | "ゅ": "x", 71 | "ゆ": "y", 72 | "ょ": "x", 73 | "よ": "y", 74 | "ら": "r", 75 | "り": "r", 76 | "る": "r", 77 | "れ": "r", 78 | "ろ": "r", 79 | "ゎ": "x", 80 | "わ": "w", 81 | "ゐ": "x", 82 | "ゑ": "x", 83 | "を": "w", 84 | "ん": "n", 85 | }; 86 | 87 | export function getOkuriStr(word: string, okuri: string): string { 88 | // 「送っ」のような段階で変換する際は、タ行の入力がされているように振る舞う 89 | // libskkなどはこの動作を行う 90 | // 根拠として、促音のほとんどがタ行という調査結果が挙げられる 91 | // https://blog.atusy.net/2023/08/01/skk-azik-and-sokuon-okuri/ 92 | if (okuri === "っ") { 93 | return word + "t"; 94 | } 95 | const alpha = okuriTable[okuri.match(/[^っ]/)?.[0] ?? ""]; 96 | return word + alpha; 97 | } 98 | -------------------------------------------------------------------------------- /lua/vimrc/feat/ui_select_fzf.lua: -------------------------------------------------------------------------------- 1 | local conv = require('vimrc.conv') 2 | 3 | local tmpdir = vim.fn.tempname() 4 | vim.fn.mkdir(tmpdir) 5 | local tmpcount = 0 6 | local function tempfile() 7 | tmpcount = tmpcount + 1 8 | return tmpdir .. '/' .. tmpcount 9 | end 10 | 11 | -- vim list to ipairs 12 | local function iter(list) 13 | if type(list) == 'table' then 14 | return ipairs(list) 15 | else 16 | local iter = list() 17 | local count = 0 18 | return function() 19 | local v = iter() 20 | if v ~= nil then 21 | count = count + 1 22 | return count, v 23 | end 24 | return nil, nil 25 | end 26 | end 27 | end 28 | 29 | return function(items, opts, on_choice) 30 | local format_item = opts.format_item or tostring 31 | local formatted = {} 32 | for idx, item in ipairs(conv.lua(items)) do 33 | formatted[idx] = idx .. ': ' .. format_item(item) 34 | end 35 | 36 | -- execute fzf in vim 37 | local winid = vim.fn.win_getid() 38 | vim.command('tabnew') 39 | 40 | local infile = tempfile() 41 | local outfile = tempfile() 42 | vim.fn.writefile(vim.list(formatted), infile) 43 | 44 | local termbuf 45 | termbuf = vim.fn.term_start( 46 | ('sh -c "cat %s | fzf --layout=reverse > %s"'):format(infile, outfile), 47 | vim.dict { 48 | curwin = true, 49 | exit_cb = function() 50 | vim.fn.win_gotoid(winid) 51 | vim.command('bdelete ' .. termbuf) 52 | local f = function() 53 | for idx, result in iter(vim.fn.readfile(outfile)) do 54 | local found = result:find(':') 55 | local idx = tonumber(result:sub(1, result:find(':') - 1)) 56 | return on_choice(items[idx], idx) 57 | end 58 | on_choice() -- cancel 59 | end 60 | f() 61 | vim.fn.delete(infile) 62 | vim.fn.delete(outfile) 63 | end, 64 | } 65 | ) 66 | end 67 | -------------------------------------------------------------------------------- /f.ts: -------------------------------------------------------------------------------- 1 | type WalkEntry = Deno.DirEntry & { 2 | path: string; 3 | }; 4 | 5 | function* walk(initialPath: string): Generator { 6 | const queue = [initialPath]; 7 | for (let cursor = 0; cursor < queue.length; cursor++) { 8 | const path = queue[cursor]; 9 | const es = [...Deno.readDirSync(path)] 10 | .sort((a, b) => a.name.localeCompare(b.name)); 11 | for (const e of es) { 12 | const newPath = path + "/" + e.name; 13 | yield { 14 | ...e, 15 | path: newPath, 16 | }; 17 | if (e.isDirectory) { 18 | queue.push(newPath); 19 | } 20 | } 21 | } 22 | } 23 | 24 | Deno.chdir(import.meta.dirname ?? Deno.exit(1)); 25 | 26 | const dppBase = Deno.makeTempDirSync(); 27 | const realDppBase = "/tmp/dpp"; 28 | Deno.env.set("DPP_BASE", dppBase); 29 | 30 | await Deno.remove("/tmp/inline.vim", { recursive: true }).catch(String); 31 | await Deno.remove(dppBase, { recursive: true }).catch(String); 32 | 33 | try { 34 | await new Deno.Command("vim", { args: ["-u", "vimrc"] }).spawn().status; 35 | } catch { 36 | // ignore 37 | } 38 | try { 39 | await new Deno.Command("nvim", { args: ["-u", "vimrc"] }).spawn().status; 40 | } catch { 41 | // ignore 42 | } 43 | 44 | for (const e of walk(dppBase)) { 45 | if (e.isSymlink) { 46 | try { 47 | const real = Deno.realPathSync(e.path); 48 | Deno.removeSync(e.path); 49 | Deno.symlinkSync(real, e.path); 50 | } catch { 51 | // ignore 52 | } 53 | } 54 | if (e.isFile) { 55 | const data = Deno.readTextFileSync(e.path); 56 | const dest = data.replaceAll(dppBase, realDppBase); 57 | if (data != dest) { 58 | Deno.writeTextFileSync(e.path, dest); 59 | } 60 | } 61 | } 62 | 63 | new Deno.Command("rsync", { 64 | args: ["-a", "--delete-before", `${dppBase}/`, `${realDppBase}/`], 65 | }).outputSync(); 66 | 67 | Deno.removeSync(dppBase, { recursive: true }); 68 | -------------------------------------------------------------------------------- /script/gitupdate/denops_view.vim: -------------------------------------------------------------------------------- 1 | " tabedit $VIMCONF/script/gitupdate/denops_view.vim 2 | 3 | let s:do_diff = 0 4 | 5 | if s:do_diff && !glob('/data/vim/diff/**/*.diff', 1, 1)->empty() 6 | throw 'diff残ってんぞ' 7 | endif 8 | 9 | call vimrc#denops_loader#load('$VIMCONF/script/gitupdate/dpp_dump.ts'->expand(), v:true) 10 | 11 | let s:runner = vimrc#denops_loader#load('$VIMCONF/script/gitupdate/denops_view.ts'->expand()) 12 | let s:shot = vimrc#denops_loader#load('$VIMCONF/script/gitupdate/snap/dps_shot.ts'->expand()) 13 | let s:diff = vimrc#denops_loader#load('$VIMCONF/script/gitupdate/snap/dps_diff.ts'->expand()) 14 | let s:build = vimrc#denops_loader#load('$VIMCONF/script/build/build.ts'->expand()) 15 | 16 | let s:tasks = [] 17 | let a_json = '$VIMCONF/script/gitupdate/a.json'->expand() 18 | if getftype(a_json) == 'file' 19 | call add(s:tasks, a_json) 20 | endif 21 | call add(s:tasks, '$VIMCONF/script/gitupdate/tasks.json'->expand()) 22 | 23 | function s:diff_post() abort 24 | if s:do_diff 25 | call denops#plugin#wait(s:shot) 26 | call denops#request(s:shot, 'run', [s:tasks, '/data/vim/snapshot']) 27 | endif 28 | endfunction 29 | 30 | augroup gitupdate_denops_view 31 | autocmd! 32 | autocmd User GitUpdatePre : 33 | if s:do_diff 34 | autocmd User GitUpdatePost call denops#plugin#wait(s:diff) 35 | autocmd User GitUpdatePost call denops#notify(s:diff, 'run', ['/data/vim/snapshot']) 36 | autocmd User GitUpdateDiffPost call s:diff_post() 37 | autocmd User GitUpdateDiffPost call vimrc#denops#notify('tmux', 'focus', []) 38 | else 39 | autocmd User GitUpdatePost TmuxFocus 40 | autocmd User GitUpdatePost call denops#notify(s:build, 'build', []) 41 | endif 42 | " set laststatus=2 | nnoremap @ | nnoremap del DeleteIttabclose | eval glob('/data/vim/diff/**/*.diff', 1, 1)->map('execute("tabedit " .. v:val, "")') 43 | augroup END 44 | 45 | call denops#plugin#wait(s:runner) 46 | call denops#plugin#wait(s:build) 47 | call denops#request(s:runner, 'run', [s:tasks, './task/fget.sh']) 48 | -------------------------------------------------------------------------------- /lua/vimrc/conv.lua: -------------------------------------------------------------------------------- 1 | -- base converter 2 | 3 | if vim.fn.has('nvim') == 1 then 4 | local function id(...) 5 | return ... 6 | end 7 | return { 8 | empty_dict = vim.empty_dict, 9 | islist = vim.tbl_islist, 10 | vim = id, 11 | lua = id, 12 | call = vim.call, 13 | } 14 | end 15 | 16 | local M = {} 17 | 18 | local empty_dict_mt = {} 19 | 20 | function M.empty_dict() 21 | return setmetatable({}, empty_dict_mt) 22 | end 23 | 24 | function M.islist(tbl) 25 | if getmetatable(tbl) == empty_dict_mt then 26 | return false 27 | end 28 | local max = 0 29 | for k, v in pairs(tbl) do 30 | if type(k) ~= 'number' then 31 | return false 32 | end 33 | max = max < k and k or max 34 | end 35 | return #tbl == max 36 | end 37 | 38 | function M.vim(value) 39 | if type(value) == 'table' then 40 | local newtable = {} 41 | for k, v in pairs(value) do 42 | newtable[k] = M.vim(v) 43 | end 44 | if M.islist(newtable) then 45 | return vim.list(newtable) 46 | else 47 | return vim.dict(newtable) 48 | end 49 | return newtable 50 | end 51 | return value 52 | end 53 | 54 | function M.lua(value) 55 | local t = vim.type(value) 56 | if t == 'dict' then 57 | local tbl = {} 58 | for k, v in value() do 59 | tbl[k] = M.lua(v) 60 | end 61 | return tbl 62 | end 63 | if t == 'list' then 64 | local tbl = {} 65 | local count = 1 66 | for v in value() do 67 | tbl[count] = M.lua(v) 68 | count = count + 1 69 | end 70 | return tbl 71 | end 72 | if t == 'table' then 73 | local tbl = {} 74 | for k, v in pairs(value) do 75 | tbl[k] = M.lua(v) 76 | end 77 | return tbl 78 | end 79 | return value 80 | end 81 | 82 | -- various functions 83 | 84 | local unpack = unpack or table.unpack 85 | 86 | function M.call(fn, ...) 87 | local tbl = {...} 88 | for k, v in pairs(tbl) do 89 | tbl[k] = M.vim(v) 90 | end 91 | return M.lua(vim.call(fn, unpack(tbl))) 92 | end 93 | 94 | -- M.call('map', {'foo', 'bar'}, print) 95 | 96 | return M 97 | -------------------------------------------------------------------------------- /denops/@ddc-filters/sorter_ngram.ts: -------------------------------------------------------------------------------- 1 | import { makeTrie, match } from "./ngram/ngram.ts"; 2 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddc-vim/filter"; 3 | import { Item } from "jsr:@shougo/ddc-vim/types"; 4 | 5 | function byteLength(input: string): number { 6 | return new TextEncoder().encode(input).length; 7 | } 8 | 9 | export type Params = { 10 | highlightMatched: string; 11 | minMatchLength: number; 12 | minMatchHighlightLength: number; 13 | }; 14 | 15 | export class Filter extends BaseFilter { 16 | filter(args: FilterArguments): Item[] { 17 | if (args.completeStr.length < args.filterParams.minMatchLength) { 18 | return args.items; 19 | } 20 | const input = args.sourceOptions.ignoreCase 21 | ? args.completeStr.toLowerCase() 22 | : args.completeStr; 23 | const needle = makeTrie(input); 24 | const ranked = args.items.map((item) => { 25 | const word = args.sourceOptions.ignoreCase 26 | ? item.word.toLowerCase() 27 | : item.word; 28 | const result = match(word, needle, { 29 | minMatchLength: args.filterParams.minMatchLength, 30 | }); 31 | return { 32 | item, 33 | result, 34 | }; 35 | }); 36 | 37 | const hl_group = args.filterParams.highlightMatched; 38 | if (hl_group != "") { 39 | const name = "ddc-filter-sorter_ngram-" + hl_group; 40 | for (const { item, result } of ranked) { 41 | item.highlights ??= []; 42 | for (const m of result.matches) { 43 | if (args.filterParams.minMatchHighlightLength <= m.len) { 44 | item.highlights.push({ 45 | name, 46 | type: "abbr", 47 | hl_group, 48 | col: 1 + byteLength(item.word.slice(0, m.start)), 49 | width: byteLength(m.text), 50 | }); 51 | } 52 | } 53 | } 54 | } 55 | 56 | return ranked.sort((a, b) => b.result.score - a.result.score) 57 | .map((value) => value.item); 58 | } 59 | 60 | params(): Params { 61 | return { 62 | highlightMatched: "", 63 | minMatchLength: 1, 64 | minMatchHighlightLength: 1, 65 | }; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /denops/@ddu-filters/sorter_ngram.ts: -------------------------------------------------------------------------------- 1 | import { makeTrie, match } from "./ngram/ngram.ts"; 2 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddu-vim/filter"; 3 | import { DduItem } from "jsr:@shougo/ddu-vim/types"; 4 | 5 | function byteLength(input: string): number { 6 | return new TextEncoder().encode(input).length; 7 | } 8 | 9 | export type Params = { 10 | highlightMatched: string; 11 | minMatchLength: number; 12 | minMatchHighlightLength: number; 13 | }; 14 | 15 | export class Filter extends BaseFilter { 16 | filter(args: FilterArguments): DduItem[] { 17 | if (args.input.length < args.filterParams.minMatchLength) { 18 | return args.items; 19 | } 20 | const ignoreCase = args.sourceOptions.ignoreCase && 21 | !(args.sourceOptions.smartCase && /[A-Z]/.test(args.input)); 22 | const input = ignoreCase ? args.input.toLowerCase() : args.input; 23 | const needle = makeTrie(input); 24 | const ranked = args.items.map((item) => { 25 | const key = ignoreCase ? item.matcherKey.toLowerCase() : item.matcherKey; 26 | const result = match(key, needle, { 27 | minMatchLength: args.filterParams.minMatchLength, 28 | }); 29 | return { 30 | item, 31 | result, 32 | }; 33 | }); 34 | 35 | const hl_group = args.filterParams.highlightMatched; 36 | if (hl_group != "") { 37 | const name = "ddu-filter-ngram-" + hl_group; 38 | for (const { item, result } of ranked) { 39 | item.highlights ??= []; 40 | for (const m of result.matches) { 41 | if (args.filterParams.minMatchHighlightLength <= m.len) { 42 | item.highlights.push({ 43 | name, 44 | hl_group, 45 | col: 1 + byteLength(item.word.slice(0, m.start)), 46 | width: byteLength(m.text), 47 | }); 48 | } 49 | } 50 | } 51 | } 52 | 53 | return ranked.sort((a, b) => b.result.score - a.result.score) 54 | .map((value) => value.item); 55 | } 56 | 57 | params(): Params { 58 | return { 59 | highlightMatched: "", 60 | minMatchLength: 1, 61 | minMatchHighlightLength: 1, 62 | }; 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /conf/rc/colors/def/gruvbit_monaqa.vim: -------------------------------------------------------------------------------- 1 | " gruvbit colorscheme with @monaqa config 2 | " https://github.com/monaqa/dotfiles/blob/424b0ab2d7623005f4b79544570b0f07a76e921a/.config/nvim/scripts/plugin.vim#L34-L67 3 | 4 | if has('gui_running') 5 | let g:gruvbit_transp_bg = 0 6 | else 7 | let g:gruvbit_transp_bg = 1 8 | endif 9 | set background=dark 10 | colorscheme gruvbit 11 | 12 | hi! FoldColumn guibg=#303030 13 | hi! NonText guifg=#496da9 14 | hi! CocHintFloat guibg=#444444 guifg=#45daef 15 | hi! link CocRustChainingHint CocHintFloat 16 | " Diff に関しては前のバージョン 17 | " (https://github.com/habamax/vim-gruvbit/commit/a19259a1f02bbfff37d72eebef6b5d5d22f22248) 18 | " のほうが好みだったので。 19 | hi! DiffChange guifg=NONE guibg=#314a5c gui=NONE cterm=NONE 20 | hi! DiffDelete guifg=#968772 guibg=#5c3728 gui=NONE cterm=NONE 21 | hi! MatchParen guifg=#ebdbb2 guibg=#51547d gui=NONE cterm=NONE 22 | 23 | hi! VertSplit guifg=#c8c8c8 guibg=NONE gui=NONE cterm=NONE 24 | hi! Visual guifg=NONE guibg=#4d564e gui=NONE cterm=NONE 25 | hi! VisualBlue guifg=NONE guibg=#4d569e gui=NONE cterm=NONE 26 | hi! Folded guifg=#9e8f7a guibg=#535657 gui=NONE cterm=NONE 27 | 28 | hi! CursorLine guifg=NONE guibg=#535657 29 | hi! CursorColumn guifg=NONE guibg=#535657 30 | 31 | hi! BufferCurrent guifg=#ebdbb2 guibg=#444444 gui=bold 32 | hi! BufferCurrentMod guifg=#dc9656 guibg=#444444 gui=bold 33 | hi! BufferCurrentSign guifg=#e9593d guibg=#444444 gui=bold 34 | hi! BufferCurrentTarget guifg=red guibg=#444444 gui=bold 35 | hi! BufferInactive guifg=#bbbbbb guibg=#777777 36 | hi! BufferInactiveMod guifg=#dc9656 guibg=#777777 37 | hi! BufferInactiveSign guifg=#444444 guibg=#777777 38 | hi! BufferInactiveTarget guifg=red guibg=#777777 39 | hi! BufferVisible guifg=#888888 guibg=#444444 40 | hi! BufferVisibleMod guifg=#dc9656 guibg=#444444 41 | hi! BufferVisibleSign guifg=#888888 guibg=#444444 42 | hi! BufferVisibleTarget guifg=red guibg=#444444 43 | hi! BufferTabpages guifg=#e9593d guibg=#444444 gui=bold 44 | hi! BufferTabpageFill guifg=#888888 guibg=#c8c8c8 45 | hi! TabLineFill guibg=#c8c8c8 46 | 47 | " modified by @kuuote 48 | 49 | " LSPのエラーが鬱陶しい 50 | hi! link Todo Underlined 51 | -------------------------------------------------------------------------------- /denops/@vimrc/yank.ts: -------------------------------------------------------------------------------- 1 | import { Denops } from "jsr:@denops/std"; 2 | import { encodeBase64 } from "jsr:@std/encoding/base64"; 3 | 4 | async function yankWayland(text: string) { 5 | const wlCopy = new Deno.Command("wl-copy", { 6 | args: ["--type", "text/plain"], 7 | stdin: "piped", 8 | stdout: "null", 9 | stderr: "null", 10 | }).spawn(); 11 | const w = wlCopy.stdin.getWriter(); 12 | w.write(new TextEncoder().encode(text)) 13 | .finally(() => w.close()); 14 | await wlCopy.status; 15 | } 16 | 17 | async function oscyank(denops: Denops, text: string) { 18 | const content = `\x1b]52;c;${encodeBase64(text)}\x1b\\`; 19 | if (denops.meta.host == "vim") { 20 | await denops.call("echoraw", content); 21 | } else { 22 | await denops.call("luaeval", "vim.api.nvim_chan_send(2, _A)", content); 23 | } 24 | } 25 | 26 | function union(text: unknown) { 27 | if (Array.isArray(text)) { 28 | return text.join("\n"); 29 | } 30 | return String(text); 31 | } 32 | 33 | // X 34 | export async function main(denops: Denops) { 35 | let type = ""; 36 | const isWayland = Deno.env.get("WAYLAND_DISPLAY") != "" && 37 | Boolean(await denops.call("executable", "wl-copy")); 38 | if (isWayland) { 39 | type = "wayland"; 40 | } else { 41 | type = "osc52"; 42 | } 43 | await denops.cmd("autocmd vimrc User vimrc.yank :"); 44 | denops.dispatcher = { 45 | async yank(text: unknown) { 46 | const trimText = union(text).trimEnd(); 47 | if (type === "wayland") { 48 | await yankWayland(trimText); 49 | } else if (type === "osc52") { 50 | await oscyank(denops, trimText); 51 | } else { 52 | await denops.cmd("echomsg msg", { msg: "no yank provider: " + type }); 53 | return; 54 | } 55 | await denops.cmd("echomsg msg", { msg: "yank text" }); 56 | await denops.cmd("doautocmd User vimrc.yank"); 57 | }, 58 | }; 59 | // await denops.cmd( 60 | // `nnoremap call denops#request('${denops.name}', 'yank', [getline(1, '$')->join("\\n")])`, 61 | // ); 62 | // await denops.cmd( 63 | // `xnoremap ycall denops#request('${denops.name}', 'yank', [getreg(v:register)])`, 64 | // ); 65 | } 66 | -------------------------------------------------------------------------------- /denops/@vimrc/lib/lambda/map.ts: -------------------------------------------------------------------------------- 1 | import { is, maybe } from "jsr:@core/unknownutil"; 2 | import { Denops } from "jsr:@denops/std"; 3 | import * as fn from "jsr:@denops/std/function"; 4 | import * as lambda from "jsr:@denops/std/lambda"; 5 | import * as mapping from "jsr:@denops/std/mapping"; 6 | 7 | const { bufnr } = fn; 8 | 9 | const dispatchName = "lambda.map" + performance.now(); 10 | const dispatcher = new Map(); 11 | 12 | export async function map( 13 | denops: Denops, 14 | lhs: string, 15 | rhs: lambda.Fn, 16 | options: mapping.MapOptions = {}, 17 | ): Promise { 18 | denops.dispatcher[dispatchName] = (functionName: unknown) => 19 | dispatcher.get(String(functionName))?.() ?? Promise.resolve(); 20 | const mode = options.mode; 21 | const modeStr = maybe(mode, is.Array)?.join("") ?? 22 | maybe(mode, is.String) ?? 23 | ""; 24 | const bufNr = options.buffer ? await bufnr(denops) : -1; 25 | const lhsEscaped = lhs.replaceAll(/call denops#request('${denops.name}', '${dispatchName}', ['${functionName}'])`; 30 | await mapping.map(denops, lhs, rhsStr, options); 31 | } 32 | 33 | export type CommandOptions = { 34 | async?: boolean; 35 | buffer?: boolean; 36 | }; 37 | 38 | export type CommandArg = { 39 | bang: boolean; 40 | arg: string; 41 | }; 42 | 43 | export type CommandFn = (arg: CommandArg) => void | Promise; 44 | 45 | const cmdFunc = "vimrc.lambda.cmd" + Math.random(); 46 | const cmdTable: Record = {}; 47 | 48 | export async function cmd( 49 | denops: Denops, 50 | name: string, 51 | fn: CommandFn, 52 | opt: CommandOptions = {}, 53 | ) { 54 | denops.dispatcher[cmdFunc] = ( 55 | functionName: unknown, 56 | bang: unknown, 57 | arg: unknown, 58 | ) => 59 | cmdTable[String(functionName)]?.({ 60 | bang: Boolean(bang), 61 | arg: String(arg), 62 | }) ?? Promise.resolve(); 63 | const bufNr = opt.buffer ? Number(await denops.call("bufnr")) : -1; 64 | const functionName = `${bufNr}:${name}`; 65 | cmdTable[functionName] = fn; 66 | await denops.cmd( 67 | `command! ${opt.buffer ? "-buffer" : ""} -nargs=* ${name} call denops#${ 68 | opt.async ? "notify" : "request" 69 | }('${denops.name}', '${cmdFunc}', ['${functionName}', 0, ])`, 70 | ); 71 | } 72 | -------------------------------------------------------------------------------- /denops/@ddc-filters/sorter_fzf.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter, FilterArguments } from "jsr:@shougo/ddc-vim/filter"; 2 | import { Item } from "jsr:@shougo/ddc-vim/types"; 3 | // @deno-types=./sorter_fzf/fzf_type.ts 4 | import { Fzf } from "npm:fzf@0.5.2"; 5 | 6 | type Never = Record; 7 | 8 | function commonString(haystack: string, needle: string): string { 9 | haystack = haystack.toLowerCase(); 10 | needle = needle.toLowerCase(); 11 | const matches: string[] = []; 12 | let pos = 0; 13 | for (const c of needle) { 14 | const p = haystack.indexOf(c, pos); 15 | if (p !== -1) { 16 | matches.push(c); 17 | pos = p + 1; 18 | } 19 | } 20 | return matches.join(""); 21 | } 22 | 23 | function commonString2(haystack: string, needle: string): string { 24 | const found = []; 25 | for (let offset = 0; offset < needle.length; offset++) { 26 | const n = needle.slice(offset); 27 | const matches = commonString(haystack, n); 28 | found.push(matches); 29 | if (matches.length == n.length) { 30 | break; 31 | } 32 | } 33 | found.sort((a, b) => b.length - a.length); 34 | return found[0] ?? ""; 35 | } 36 | 37 | export class Filter extends BaseFilter { 38 | filter(args: FilterArguments): Item[] { 39 | const a = args.items.map((item, index) => { 40 | const common = commonString2(item.word, args.completeStr); 41 | return { 42 | common, 43 | index, 44 | item, 45 | }; 46 | }); 47 | const b = Map.groupBy(a, (e) => e.common); 48 | const c = [...b.entries()].map(([key, es]) => { 49 | const fzf = new Fzf(es, { 50 | selector: (e) => e.item.word, 51 | sort: false, 52 | }); 53 | return fzf.find(key); 54 | }) 55 | .flat() 56 | .sort((a, b) => { 57 | const c = b.item.common.length - a.item.common.length; 58 | if (c != 0) { 59 | return c; 60 | } 61 | const s = b.score - a.score; 62 | if (s != 0) { 63 | return s; 64 | } 65 | return a.item.index - b.item.index; 66 | }); 67 | return c.map((e) => { 68 | const newItem = { ...e.item.item }; 69 | newItem.highlights = [...e.positions] 70 | .map((p) => ({ 71 | name: "ddc-filter-sorter_fzf", 72 | type: "abbr", 73 | hl_group: "PumHighlight", 74 | col: p + 1, 75 | width: 1, 76 | })); 77 | return newItem; 78 | }); 79 | } 80 | params() { 81 | return {}; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /script/time/time.ts: -------------------------------------------------------------------------------- 1 | // rhysd/vim-startuptimeと同じことをしてくれるやつ 2 | 3 | const withTempFile = async (fn: (file: string) => unknown) => { 4 | const file = await Deno.makeTempFile(); 5 | try { 6 | await fn(file); 7 | } finally { 8 | await Deno.remove(file).catch(() => {}); 9 | } 10 | }; 11 | 12 | type Time = [inclusive: number, exclusive: number]; 13 | 14 | const parseLine = ( 15 | line: string, 16 | ): [key: string, time: Time] => { 17 | const [time, key] = line.split(/: /); 18 | const times = time.split(/\s+/) 19 | .map((t) => parseFloat(t)); 20 | return [key, [times[1], times[2] ?? 0]]; 21 | }; 22 | 23 | const timeToString = (time: number): string => time.toFixed(3).padStart(7, "0"); 24 | 25 | const collectResult = ( 26 | totals: number[], 27 | times: Map, 28 | exclusive: boolean, 29 | ): string => { 30 | const a = [...times.entries()] 31 | .map(([key, times]): [string, number] => [ 32 | key, 33 | times.map((t) => t[exclusive ? 1 : 0]).reduce((a, b) => a + b) / 34 | times.length, 35 | ]) 36 | .sort((a, b) => a[1] - b[1]) 37 | .map(([key, time]) => timeToString(time) + " " + key); 38 | a.push( 39 | `avg: ${ 40 | timeToString(totals.reduce((a, b) => a + b) / totals.length) 41 | } max: ${timeToString(Math.max(...totals))} min: ${ 42 | timeToString(Math.min(...totals)) 43 | }`, 44 | ); 45 | return a.join("\n"); 46 | }; 47 | 48 | withTempFile(async (file: string) => { 49 | const totals: number[] = []; 50 | const times = new Map(); 51 | // warmup 52 | await new Deno.Command(Deno.args[0], { args: [file] }).output(); 53 | for (let i = 0; i < 50; i++) { 54 | await Deno.stderr.write(new TextEncoder().encode("\r" + (i + 1))); 55 | await Deno.remove(file).catch(() => {}); 56 | await new Deno.Command(Deno.args[0], { args: [file] }).output(); 57 | const lines = (await Deno.readTextFile(file)).split(/\n/); 58 | const total = parseFloat( 59 | lines.find((line) => line.includes("VIM STARTED")) 60 | ?.replace(/\s.*/, "") ?? "", 61 | ); 62 | totals.push(total); 63 | for (const line of lines) { 64 | if (line.match(/^\d/) == null) { 65 | continue; 66 | } 67 | const [key, time] = parseLine(line); 68 | times.set(key, [time].concat(times.get(key) ?? [])); 69 | } 70 | } 71 | console.log("inclusive"); 72 | console.log(collectResult(totals, times, false)); 73 | console.log("exclusive"); 74 | console.log(collectResult(totals, times, true)); 75 | }); 76 | -------------------------------------------------------------------------------- /conf/plug/ddu/filer.ts: -------------------------------------------------------------------------------- 1 | import { register } from "../../../denops/@vimrc/lib/lambda/autocmd.ts"; 2 | import * as autocmd from "jsr:@denops/std/autocmd" 3 | import * as lambda from "jsr:@denops/std/lambda" 4 | import * as mapping from "jsr:@denops/std/mapping" 5 | import { assert, is } from "jsr:@core/unknownutil"; 6 | import { BaseConfig, ConfigArguments } from "jsr:@shougo/ddu-vim/config"; 7 | 8 | const augroup = "vimrc.ddu-ui-filer"; 9 | 10 | async function setupFileTypeAutocmd(args: ConfigArguments) { 11 | const { denops } = args; 12 | const opt: mapping.MapOptions = { 13 | buffer: true, 14 | nowait: true, 15 | }; 16 | const nno: mapping.MapOptions = { 17 | ...opt, 18 | mode: ["n"], 19 | }; 20 | const action = (name: string, params?: unknown) => { 21 | const paramsStr = params == null ? "" : ", " + 22 | JSON.stringify(params, (_, v) => is.Boolean(v) ? "__ddu__" + v : v) 23 | .replaceAll(/"__ddu__(\w+)"/g, "v:$1"); 24 | return `call ddu#ui#do_action('${name}'${paramsStr})`; 25 | }; 26 | const itemAction = (name: string, params: unknown = {}) => { 27 | return action("itemAction", { name, params }); 28 | }; 29 | const setupTable: Record = { 30 | _: async () => { 31 | await mapping.map(denops, "", action("itemAction"), nno); 32 | await mapping.map(denops, "d", itemAction("narrow", { path: ".." }), nno); 33 | await mapping.map(denops, "h", action("collapseItem"), nno); 34 | await mapping.map( 35 | denops, 36 | "l", 37 | action("expandItem", { isInTree: true }), 38 | nno, 39 | ); 40 | await mapping.map(denops, "q", action("quit"), nno); 41 | await mapping.map( 42 | denops, 43 | "s", 44 | action("toggleSelectItem") + action("cursorNext"), 45 | nno, 46 | ); 47 | }, 48 | }; 49 | const ddu_filer = register(denops, async (name: unknown) => { 50 | await setupTable["_"]?.(); 51 | assert(name, is.String); 52 | // const names = (aliases[name] ?? name).split(/:/g); 53 | // for (const name of names) { 54 | // await setupTable[name]?.(); 55 | // } 56 | }, { args: "b:ddu_ui_name" }); 57 | await autocmd.group(denops, augroup, (helper) => { 58 | helper.define( 59 | "FileType", 60 | "ddu-filer", 61 | ddu_filer, 62 | ); 63 | }); 64 | } 65 | export class Config extends BaseConfig { 66 | override async config(args: ConfigArguments) { 67 | const nvim = args.denops.meta.host === "nvim"; 68 | args.contextBuilder.patchGlobal({ 69 | uiParams: { 70 | filer: { 71 | split: nvim ? "floating" : "tab", 72 | sort: "filename", 73 | sortTreesFirst: true, 74 | }, 75 | }, 76 | }); 77 | await setupFileTypeAutocmd(args); 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /denops/@vimrc/lib/lambda/autocmd.ts: -------------------------------------------------------------------------------- 1 | import { find } from "../ahocorasick.ts"; 2 | import { generateDenopsCall, GenerateDenopsCallOptions } from "../denops.ts"; 3 | import { Denops } from "jsr:@denops/std"; 4 | import * as autocmd from "jsr:@denops/std/autocmd"; 5 | import * as lambda from "jsr:@denops/std/lambda"; 6 | 7 | const dispatchName = "lambda.autocmd#" + performance.now(); 8 | const dispatcher = new Map(); 9 | 10 | export async function garbagecollect(denops: Denops) { 11 | const autocmds = String(await denops.call("execute", "autocmd")); 12 | const names = [...dispatcher.keys()]; 13 | const found = find(autocmds, names); 14 | for (const name of dispatcher.keys()) { 15 | if (!found.has(name)) { 16 | dispatcher.delete(name); 17 | } 18 | } 19 | } 20 | 21 | type RegisterOptions = GenerateDenopsCallOptions & { 22 | args?: string; 23 | }; 24 | 25 | export function register( 26 | denops: Denops, 27 | fn: lambda.Fn, 28 | options: RegisterOptions = {}, 29 | ): string { 30 | denops.dispatcher[dispatchName] = (name: unknown, ...args: unknown[]) => 31 | dispatcher.get(String(name))?.(...args); 32 | const id = crypto.randomUUID(); 33 | dispatcher.set(id, fn); 34 | return "call " + generateDenopsCall( 35 | denops, 36 | dispatchName, 37 | `['${id}', ${options.args ?? ""}]`, 38 | options, 39 | ); 40 | } 41 | 42 | type LambdaGroupDefineOptions = 43 | & autocmd.GroupDefineOptions 44 | & GenerateDenopsCallOptions 45 | & { 46 | args?: string; 47 | description?: string; 48 | }; 49 | 50 | class LambdaGroupHelper { 51 | #denops; 52 | #helper; 53 | constructor(denops: Denops, helper: autocmd.GroupHelper) { 54 | this.#denops = denops; 55 | this.#helper = helper; 56 | } 57 | 58 | /** 59 | * Define an autocmd 60 | */ 61 | define( 62 | event: autocmd.AutocmdEvent | autocmd.AutocmdEvent[], 63 | pat: string | string[], 64 | cmd: string | lambda.Fn, 65 | options: LambdaGroupDefineOptions = {}, 66 | ): void { 67 | if (typeof cmd != "string") { 68 | cmd = register(this.#denops, cmd, options); 69 | } 70 | this.#helper.define(event, pat, cmd, options); 71 | } 72 | 73 | /** 74 | * Remove an autocmd 75 | */ 76 | remove( 77 | event?: "*" | autocmd.AutocmdEvent | autocmd.AutocmdEvent[], 78 | pat?: string | string[], 79 | options: autocmd.GroupRemoveOptions = {}, 80 | ): void { 81 | this.#helper.remove(event, pat, options); 82 | } 83 | } 84 | 85 | export type { LambdaGroupHelper }; 86 | 87 | export async function group( 88 | denops: Denops, 89 | name: string, 90 | executor: (helper: LambdaGroupHelper) => void, 91 | ): Promise { 92 | await autocmd.group( 93 | denops, 94 | name, 95 | (helper) => executor(new LambdaGroupHelper(denops, helper)), 96 | ); 97 | await garbagecollect(denops); 98 | } 99 | -------------------------------------------------------------------------------- /denops/@ddc-filters/ngram/ngram.ts: -------------------------------------------------------------------------------- 1 | export type Trie = { 2 | next: Record; 3 | start: number; 4 | len: number; 5 | }; 6 | 7 | /* 8 | 9 | ngramをベースとした曖昧マッチ&スコアリングプログラム 10 | 入力をhogeとして 11 | - hoge 12 | - oge 13 | - ge 14 | - e 15 | のように分解してTrieを構築、任意長でこれと文字列をマッチすると入力の一部分からなるマッチ情報が手に入る 16 | - Trieの構築を除くと実行効率多分O(n)くらい? 17 | 18 | */ 19 | 20 | export type Needle = { 21 | trie: Trie; 22 | length: number; 23 | }; 24 | 25 | export function makeTrie(input: string): Needle { 26 | const root: Trie = { 27 | next: {}, 28 | start: -1, 29 | len: 0, 30 | }; 31 | for (let start = 0; start < input.length; start++) { 32 | const pinput = input.slice(start); 33 | let current = root; 34 | for (let i = 0; i < pinput.length; i++) { 35 | const c = pinput[i]; 36 | // 重複した場合に末尾の候補を優先したいので上書きする。 37 | // 例えばhogepiyoを絞り込んだ後、改めてpiyoを前に持ってきたかったら、 38 | // 再びpiyoを打てば実現できるようにしたい 39 | current.next[c] = { 40 | next: current.next[c]?.next ?? {}, 41 | start, 42 | len: i + 1, 43 | }; 44 | current = current.next[c]; 45 | } 46 | } 47 | return { 48 | trie: root, 49 | length: input.length, 50 | }; 51 | } 52 | 53 | export type MatchResult = { 54 | start: number; 55 | len: number; 56 | text: string; 57 | needleStart: number; 58 | }; 59 | 60 | export type Result = { 61 | matches: MatchResult[]; 62 | score: number; 63 | }; 64 | 65 | export type MatchOptions = { 66 | minMatchLength?: number; 67 | }; 68 | 69 | export function match( 70 | input: string, 71 | needle: Needle, 72 | options: MatchOptions = {}, 73 | ): Result { 74 | const matches: MatchResult[] = []; 75 | const root = needle.trie; 76 | let current = root; 77 | const score = Array(needle.length).fill(0); 78 | 79 | // 終了後にチェックするのがめんどいので末尾+1まで処理させる 80 | for (let i = 0; i <= input.length; i++) { 81 | const c = input[i]; 82 | if (current.next[c] == null) { 83 | if (current.len != 0) { 84 | const len = current.len; 85 | const start = i - current.len; 86 | if (options.minMatchLength ?? 1 <= len) { 87 | matches.push({ 88 | start, 89 | len, 90 | text: input.slice(start, start + len), 91 | needleStart: current.start, 92 | }); 93 | // 類似度と言っても、重複の多い文字列が優先されるのも嬉しくないので 94 | // score matrixっぽいことをやってみる 95 | for (let i = current.start; i < current.start + len; i++) { 96 | score[i] = Math.max(score[i], len); 97 | } 98 | } 99 | } 100 | current = root; 101 | } 102 | if (current.next[c] != null) { 103 | current = current.next[c]; 104 | } 105 | } 106 | return { 107 | matches, 108 | score: score.reduce((a, b) => a + b), 109 | }; 110 | } 111 | -------------------------------------------------------------------------------- /denops/@ddu-filters/ngram/ngram.ts: -------------------------------------------------------------------------------- 1 | export type Trie = { 2 | next: Record; 3 | start: number; 4 | len: number; 5 | }; 6 | 7 | /* 8 | 9 | ngramをベースとした曖昧マッチ&スコアリングプログラム 10 | 入力をhogeとして 11 | - hoge 12 | - oge 13 | - ge 14 | - e 15 | のように分解してTrieを構築、任意長でこれと文字列をマッチすると入力の一部分からなるマッチ情報が手に入る 16 | - Trieの構築を除くと実行効率多分O(n)くらい? 17 | 18 | */ 19 | 20 | export type Needle = { 21 | trie: Trie; 22 | length: number; 23 | }; 24 | 25 | export function makeTrie(input: string): Needle { 26 | const root: Trie = { 27 | next: {}, 28 | start: -1, 29 | len: 0, 30 | }; 31 | for (let start = 0; start < input.length; start++) { 32 | const pinput = input.slice(start); 33 | let current = root; 34 | for (let i = 0; i < pinput.length; i++) { 35 | const c = pinput[i]; 36 | // 重複した場合に末尾の候補を優先したいので上書きする。 37 | // 例えばhogepiyoを絞り込んだ後、改めてpiyoを前に持ってきたかったら、 38 | // 再びpiyoを打てば実現できるようにしたい 39 | current.next[c] = { 40 | next: current.next[c]?.next ?? {}, 41 | start, 42 | len: i + 1, 43 | }; 44 | current = current.next[c]; 45 | } 46 | } 47 | return { 48 | trie: root, 49 | length: input.length, 50 | }; 51 | } 52 | 53 | export type MatchResult = { 54 | start: number; 55 | len: number; 56 | text: string; 57 | needleStart: number; 58 | }; 59 | 60 | export type Result = { 61 | matches: MatchResult[]; 62 | score: number; 63 | }; 64 | 65 | export type MatchOptions = { 66 | minMatchLength?: number; 67 | }; 68 | 69 | export function match( 70 | input: string, 71 | needle: Needle, 72 | options: MatchOptions = {}, 73 | ): Result { 74 | const matches: MatchResult[] = []; 75 | const root = needle.trie; 76 | let current = root; 77 | const score = Array(needle.length).fill(0); 78 | 79 | // 終了後にチェックするのがめんどいので末尾+1まで処理させる 80 | for (let i = 0; i <= input.length; i++) { 81 | const c = input[i]; 82 | if (current.next[c] == null) { 83 | if (current.len != 0) { 84 | const len = current.len; 85 | const start = i - current.len; 86 | if (options.minMatchLength ?? 1 <= len) { 87 | matches.push({ 88 | start, 89 | len, 90 | text: input.slice(start, start + len), 91 | needleStart: current.start, 92 | }); 93 | // 類似度と言っても、重複の多い文字列が優先されるのも嬉しくないので 94 | // score matrixっぽいことをやってみる 95 | for (let i = current.start; i < current.start + len; i++) { 96 | score[i] = Math.max(score[i], len); 97 | } 98 | } 99 | } 100 | current = root; 101 | } 102 | if (current.next[c] != null) { 103 | current = current.next[c]; 104 | } 105 | } 106 | return { 107 | matches, 108 | score: score.reduce((a, b) => a + b), 109 | }; 110 | } 111 | -------------------------------------------------------------------------------- /denops/@vimrc/blocksort.ts: -------------------------------------------------------------------------------- 1 | import { assert, is } from "jsr:@core/unknownutil"; 2 | import { Denops } from "jsr:@denops/std"; 3 | 4 | // 例えば↑のimportを整理するにはvip後に 5 | // call vimrc#denops#request('blocksort', 'do', [line("'<"), line("'>"), 'import', ' from .*']) 6 | 7 | // dpp.vimのTOMLだとこう 8 | // call vimrc#denops#request('blocksort', 'do', [1, line("$"), 'plugins]]', 'repo.*']) 9 | 10 | export function main(denops: Denops) { 11 | denops.dispatcher = { 12 | async do( 13 | start: unknown, 14 | end: unknown, 15 | findRegExpStr: unknown, 16 | keyRegExpStr: unknown, 17 | ) { 18 | assert(start, is.Number); 19 | assert(end, is.Number); 20 | assert(findRegExpStr, is.String); 21 | assert(keyRegExpStr, is.String); 22 | const findRegExp = new RegExp(findRegExpStr); 23 | // 複数行に跨るのでdotAllを入れておく 24 | const keyRegExp = new RegExp(keyRegExpStr, "s"); 25 | const lines = await denops.call( 26 | "getbufline", 27 | "%", 28 | start, 29 | end, 30 | ) as string[]; 31 | 32 | // findRegExpにマッチする物を見出しとして与えられた行をブロックにバラす 33 | const blocks: string[][] = []; 34 | let lineStart = 0; 35 | for (let i = 0; i < lines.length; i++) { 36 | if (lines[i].match(findRegExp) && lineStart !== i) { 37 | blocks.push(lines.slice(lineStart, i)); 38 | lineStart = i; 39 | } 40 | } 41 | blocks.push(lines.slice(lineStart, lines.length)); 42 | 43 | // 文中のkeyRegExpにマッチする物をキーとしてソートして繋ぎ直す 44 | const sorted = blocks 45 | .map((lines) => { 46 | const text = lines.join("\n"); 47 | return { 48 | lines, 49 | key: text.match(keyRegExp)?.[0] ?? text, 50 | }; 51 | }) 52 | .sort((a, b) => a.key.localeCompare(b.key)) 53 | .flatMap((b) => b.lines); 54 | 55 | await denops.call("setbufline", "%", start, sorted); 56 | }, 57 | async shuf( 58 | start: unknown, 59 | end: unknown, 60 | findRegExpStr: unknown, 61 | ) { 62 | assert(start, is.Number); 63 | assert(end, is.Number); 64 | assert(findRegExpStr, is.String); 65 | const findRegExp = new RegExp(findRegExpStr); 66 | // 複数行に跨るのでdotAllを入れておく 67 | const lines = await denops.call( 68 | "getbufline", 69 | "%", 70 | start, 71 | end, 72 | ) as string[]; 73 | 74 | // findRegExpにマッチする物を見出しとして与えられた行をブロックにバラす 75 | const blocks: string[][] = []; 76 | let lineStart = 0; 77 | for (let i = 0; i < lines.length; i++) { 78 | if (lines[i].match(findRegExp) && lineStart !== i) { 79 | blocks.push(lines.slice(lineStart, i)); 80 | lineStart = i; 81 | } 82 | } 83 | blocks.push(lines.slice(lineStart, lines.length)); 84 | for (let i = blocks.length - 1; i >= 1; i--) { 85 | const j = Math.floor(Math.random() * (i + 1)); 86 | [blocks[i], blocks[j]] = [blocks[j], blocks[i]]; 87 | } 88 | await denops.call("setbufline", "%", start, blocks.flat()); 89 | }, 90 | }; 91 | } 92 | -------------------------------------------------------------------------------- /conf/plug/ddc/main.ts: -------------------------------------------------------------------------------- 1 | import { BaseConfig, ConfigArguments } from "jsr:@shougo/ddc-vim/config"; 2 | import { SourceOptions } from "jsr:@shougo/ddc-vim/types"; 3 | 4 | type Filters = Record; 9 | 10 | export class Config extends BaseConfig { 11 | override config(args: ConfigArguments): Promise { 12 | const filters = { 13 | fuzzy: { 14 | matchers: ["matcher_fuzzy"], 15 | sorters: ["sorter_fuzzy"], 16 | converters: ["converter_fuzzy"], 17 | }, 18 | none: { 19 | matchers: [], 20 | sorters: [], 21 | converters: [], 22 | }, 23 | sorter_fzf: { 24 | matchers: [], 25 | sorters: ["sorter_fzf"], 26 | converters: [], 27 | }, 28 | } satisfies Filters; 29 | 30 | args.contextBuilder.patchGlobal( 31 | { 32 | autoCompleteEvents: [ 33 | "InsertEnter", 34 | "TextChangedI", 35 | "TextChangedP", 36 | "TextChangedT", 37 | "CmdlineEnter", 38 | "CmdlineChanged", 39 | ], 40 | cmdlineSources: { 41 | "/": [], 42 | ":": ["cmdline"], 43 | "?": [], 44 | "@": [], 45 | }, 46 | sources: ["yank", "around"], 47 | sourceOptions: { 48 | _: { 49 | ...filters.sorter_fzf, 50 | ignoreCase: true, 51 | }, 52 | around: { 53 | mark: "周", 54 | }, 55 | cmdline: { 56 | isVolatile: true, 57 | minAutoCompleteLength: 1, 58 | mark: "令", 59 | }, 60 | file: { 61 | ...filters.none, 62 | sorters: ["sorter_file", "sorter_fzf"], 63 | forceCompletionPattern: "\\S/\\S*", 64 | mark: "紙", 65 | }, 66 | input: { 67 | isVolatile: true, 68 | mark: "入", 69 | minAutoCompleteLength: 0, 70 | }, 71 | line: { 72 | mark: "行", 73 | }, 74 | lsp: { 75 | mark: "語", 76 | }, 77 | "shell-native": { 78 | mark: "殻", 79 | }, 80 | skkeleton: { 81 | ...filters.none, 82 | isVolatile: true, 83 | maxItems: 50, 84 | minAutoCompleteLength: 1, 85 | mark: "変", 86 | }, 87 | skkeleton_okuri: { 88 | ...filters.none, 89 | isVolatile: true, 90 | mark: "送", 91 | }, 92 | yank: { 93 | ...filters.fuzzy, 94 | mark: "貼", 95 | }, 96 | }, 97 | sourceParams: { 98 | lsp: { 99 | lspEngine: "lspoints", 100 | }, 101 | "shell-native": { 102 | "shell": "fish", 103 | }, 104 | }, 105 | ui: "pum", 106 | }, 107 | ); 108 | return Promise.resolve(); 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /bundle/gin-preview.vim/plugin/gin_preview.vim: -------------------------------------------------------------------------------- 1 | augroup gin-preview 2 | autocmd User gin-preview:* : 3 | augroup END 4 | 5 | function s:open(curwin) abort 6 | " in before VimEnter, do lazy evaluation 7 | " because gin.vim is using denops.vim 8 | if !denops#plugin#is_loaded('gin') 9 | execute 'autocmd gin-preview User DenopsPluginPost:gin ++nested call s:open(' .. a:curwin .. ')' 10 | return 11 | endif 12 | 13 | " git root by gin 14 | let root = gin#util#worktree() 15 | 16 | " open window 17 | if a:curwin 18 | silent! only 19 | else 20 | tab split 21 | endif 22 | 23 | " cd to git root 24 | call chdir(root, 'tabpage') 25 | " open status window 26 | GinStatus 27 | " remove previous handler 28 | autocmd! gin-preview * 29 | let t:gin_preview = {'cursor': [-1, -1], 'status': win_getid()} 30 | " open worktree window 31 | belowright new 32 | diffthis 33 | let t:gin_preview.worktree = win_getid() 34 | " open index window 35 | vnew 36 | diffthis 37 | let t:gin_preview.index = win_getid() 38 | " resize status window 39 | call win_gotoid(t:gin_preview.status) 40 | execute 'resize' &lines / 4 41 | " define handler 42 | autocmd gin-preview CursorMoved ++nested call s:moved() 43 | doautocmd User gin-preview:open 44 | endfunction 45 | 46 | function! s:moved() abort 47 | if !exists('t:gin_preview') 48 | return 49 | endif 50 | let new_cursor = [line('.'), col('.')] 51 | if t:gin_preview.cursor == new_cursor 52 | return 53 | endif 54 | let t:gin_preview.cursor = new_cursor 55 | let line = getline('.') 56 | if line =~# '^##' 57 | return 58 | endif 59 | diffoff! 60 | let file = fnamemodify(line[3:], ':p') 61 | call win_execute(t:gin_preview.worktree, 'edit ' .. file .. ' | diffthis') 62 | call win_execute(t:gin_preview.worktree, 'doautocmd User gin-preview:worktree') 63 | if line =~# '^??' 64 | call win_execute(t:gin_preview.index, 'call s:open_not_index(' .. string(file) ..')') 65 | else 66 | call win_execute(t:gin_preview.index, 'GinEdit ' .. file .. ' | diffthis') 67 | endif 68 | call win_execute(t:gin_preview.index, 'doautocmd User gin-preview:index') 69 | call win_execute(t:gin_preview.worktree, 'set wrap') 70 | call win_execute(t:gin_preview.index, 'set wrap') 71 | endfunction 72 | 73 | command! -bang GinPreview call s:open(0) 74 | 75 | function! s:open_not_index(file) abort 76 | let path = 'ginpreview://' .. a:file 77 | let b = bufnr(path) 78 | if b != -1 79 | execute 'buf' b 80 | diffthis 81 | return 82 | endif 83 | enew 84 | diffthis 85 | let b:gin_preview_file = a:file 86 | setlocal buftype=acwrite bufhidden=hide noswapfile 87 | autocmd gin-preview BufWriteCmd call timer_start(0, function('s:write_not_index')) 88 | execute 'file' path 89 | endfunction 90 | 91 | function! s:write_not_index(...) abort 92 | let b = bufnr() 93 | let file = b:gin_preview_file 94 | let text = getline(1, '$') 95 | call system('git add -N ' .. file) 96 | execute 'GinEdit ' .. file .. ' | diffthis' 97 | call setline(1, text) 98 | write 99 | execute 'bdelete!' b 100 | endfunction 101 | -------------------------------------------------------------------------------- /script/gitupdate/snap/dps_diff.ts: -------------------------------------------------------------------------------- 1 | import { exec, isRepo } from "./libsnapshot.ts"; 2 | import { assert, ensure, is } from "jsr:@core/unknownutil"; 3 | import { type Denops } from "jsr:@denops/std"; 4 | 5 | export async function run(denops: Denops, args: unknown) { 6 | assert( 7 | args, 8 | is.TupleOf( 9 | [ 10 | is.String, 11 | ] as const, 12 | ), 13 | ); 14 | const [snapshotPath] = args; 15 | 16 | const repos = ensure( 17 | JSON.parse( 18 | await Deno.readTextFile(snapshotPath), 19 | ), 20 | is.ArrayOf(isRepo), 21 | ); 22 | 23 | await denops.cmd( 24 | [ 25 | "tabnew", 26 | "setlocal buftype=nofile bufhidden=wipe noswapfile nowrap", 27 | "syntax match Number /^ [^|]\\+\\ze|/", 28 | "syntax match diffAdded /+/", 29 | "syntax match diffRemoved /-/", 30 | ].join("|"), 31 | ); 32 | const bufnr = Number(await denops.call("bufnr")); 33 | await denops.call("setbufline", bufnr, "$", "plugins diff output v1"); 34 | 35 | await Deno.remove("/data/vim/diff", { 36 | recursive: true, 37 | }).catch(console.trace); 38 | await Deno.mkdir("/data/vim/diff", { 39 | recursive: true, 40 | }); 41 | 42 | for (const repo of repos) { 43 | const hash = await exec(["git", "rev-parse", "@"], repo.path); 44 | if (repo.hash === hash) { 45 | continue; 46 | } 47 | 48 | const diff = (await exec( 49 | ["git", "diff", "--stat", repo.hash, "HEAD"], 50 | repo.path, 51 | )).split(/\n/); 52 | 53 | await denops.call("appendbufline", bufnr, "$", repo.path); 54 | await denops.call("appendbufline", bufnr, "$", diff); 55 | 56 | await denops.redraw(); 57 | 58 | const hashes = await exec( 59 | [ 60 | "git", 61 | "log", 62 | "--since=" + (repo.date + 1), 63 | "--pretty=format:%H", 64 | ], 65 | repo.path, 66 | ) 67 | .then((o) => o.split(/\n/)); 68 | if (hashes[0] === "") { 69 | continue; 70 | } 71 | const dir = "/data/vim/diff/" + repo.path.replaceAll(/\//g, "_") + "/"; 72 | Deno.mkdir(dir); 73 | const pad = String(hashes.length).length; 74 | for (let i = 0; i < hashes.length; i++) { 75 | const show = await exec( 76 | ["git", "show", hashes[i]], 77 | repo.path, 78 | ); 79 | const msg = show.split("diff --git")[0]; 80 | if (msg.includes("vim-patch")) { 81 | continue; 82 | } 83 | if (msg.includes("renovate[bot]")) { 84 | continue; 85 | } 86 | if (msg.includes("Merge pull request #")) { 87 | continue; 88 | } 89 | await Deno.writeTextFile( 90 | dir + String(i + 1).padStart(pad, "0") + ".diff", 91 | show, 92 | ); 93 | } 94 | } 95 | await denops.cmd( 96 | [ 97 | "tabnew", 98 | "setlocal buftype=nofile bufhidden=wipe noswapfile nowrap", 99 | ].join("|"), 100 | ); 101 | await denops.call("setline", "1", "done"); 102 | await denops.redraw(); 103 | await denops.cmd("doautocmd User GitUpdateDiffPost"); 104 | } 105 | 106 | export function main(denops: Denops) { 107 | denops.dispatcher = { 108 | run: (...args: unknown[]) => run(denops, args), 109 | }; 110 | } 111 | -------------------------------------------------------------------------------- /lua/vimrc/plug/skkeleton/tsuki2-263mod.lua: -------------------------------------------------------------------------------- 1 | local call = require('vimrc.conv').call 2 | 3 | -- ; を開けるために / に移している 4 | 5 | return function() 6 | call('skkeleton#register_kanatable', 'tsuki2-263', { 7 | [' '] = 'henkanFirst', 8 | [';'] = 'henkanPoint', 9 | ld = 'katakana', 10 | kk = 'disable', 11 | 12 | -- シフト無し 13 | ['q'] = { 'そ' }, 14 | ['w'] = { 'こ' }, 15 | ['e'] = { 'し' }, 16 | ['r'] = { 'て' }, 17 | ['t'] = { 'ょ' }, 18 | ['y'] = { 'つ' }, 19 | ['u'] = { 'ん' }, 20 | ['i'] = { 'い' }, 21 | ['o'] = { 'の' }, 22 | ['p'] = { 'り' }, 23 | ['@'] = { 'ち' }, -- JIS 24 | ['['] = { 'ち' }, -- US 25 | 26 | ['a'] = { 'は' }, 27 | ['s'] = { 'か' }, 28 | ['f'] = { 'と' }, 29 | ['g'] = { 'た' }, 30 | ['h'] = { 'く' }, 31 | ['j'] = { 'う' }, 32 | [':'] = { 'れ' }, -- JIS 33 | ["'"] = { 'れ' }, -- US 34 | 35 | ['z'] = { 'す' }, 36 | ['x'] = { 'け' }, 37 | ['c'] = { 'に' }, 38 | ['v'] = { 'な' }, 39 | ['b'] = { 'さ' }, 40 | ['n'] = { 'っ' }, 41 | ['m'] = { 'る' }, 42 | [','] = { '、' }, 43 | ['.'] = { '。' }, 44 | ['/'] = { 'き' }, 45 | 46 | -- 中指シフト(左始点) 47 | ['dy'] = { 'ぬ' }, 48 | ['du'] = { 'え' }, 49 | ['di'] = { 'み' }, 50 | ['do'] = { 'や' }, 51 | ['dp'] = { 'ぇ' }, 52 | ['d@'] = { '「' }, -- JIS 53 | ['d['] = { '「' }, -- US 54 | 55 | ['dh'] = { 'ま' }, 56 | ['dj'] = { 'お' }, 57 | ['dk'] = { 'も' }, 58 | ['dl'] = { 'わ' }, 59 | ['d;'] = { 'ぉ' }, 60 | ['d:'] = { '」' }, -- JIS 61 | ["d'"] = { '」' }, -- US 62 | ['dn'] = { 'む' }, 63 | ['dm'] = { 'ろ' }, 64 | ['d,'] = { 'ね' }, 65 | ['d.'] = { 'ー' }, 66 | ['d/'] = { 'ゆ' }, 67 | 68 | -- 中指シフト(右始点) 69 | ['kq'] = { 'ぁ' }, 70 | ['kw'] = { 'ひ' }, 71 | ['ke'] = { 'ほ' }, 72 | ['kr'] = { 'ふ' }, 73 | ['kt'] = { 'め' }, 74 | 75 | ['ka'] = { 'ぃ' }, 76 | ['ks'] = { 'を' }, 77 | ['kd'] = { 'ら' }, 78 | ['kf'] = { 'あ' }, 79 | ['kg'] = { 'よ' }, 80 | 81 | ['kz'] = { 'ぅ' }, 82 | ['kx'] = { 'へ' }, 83 | ['kc'] = { 'せ' }, 84 | ['kv'] = { 'ゅ' }, 85 | ['kb'] = { 'ゃ' }, 86 | 87 | -- 濁点シフト 88 | ['lq'] = { 'ぞ' }, 89 | ['lw'] = { 'ご' }, 90 | ['le'] = { 'じ' }, 91 | ['lr'] = { 'で' }, 92 | ['ly'] = { 'づ' }, 93 | ['lu'] = { 'ん' }, 94 | ['li'] = { 'い' }, 95 | ['lo'] = { 'の' }, 96 | ['lp'] = { 'り' }, 97 | ['l@'] = { 'ぢ' }, -- JIS 98 | ['l['] = { 'ぢ' }, -- US 99 | 100 | ['la'] = { 'ば' }, 101 | ['ls'] = { 'が' }, 102 | ['lf'] = { 'ど' }, 103 | ['lg'] = { 'だ' }, 104 | ['lh'] = { 'ぐ' }, 105 | ['lj'] = { 'ゔ' }, 106 | -- ['ll'] = { '゛' }, 107 | 108 | ['lz'] = { 'ず' }, 109 | ['lx'] = { 'げ' }, 110 | ['lb'] = { 'ざ' }, 111 | ['l/'] = { 'ぎ' }, 112 | 113 | -- 半濁点シフト 114 | -- 単スラッシュを開けるために手数を増やしている 115 | ['llw'] = { 'ぴ' }, 116 | ['lle'] = { 'ぽ' }, 117 | ['llr'] = { 'ぷ' }, 118 | ['lla'] = { 'ぱ' }, 119 | ['llx'] = { 'ぺ' }, 120 | 121 | -- 濁点+中指シフト 122 | ['lkw'] = { 'び' }, 123 | ['lke'] = { 'ぼ' }, 124 | ['lkr'] = { 'ぶ' }, 125 | ['lkx'] = { 'べ' }, 126 | ['lkc'] = { 'ぜ' }, 127 | }, true) 128 | 129 | call('skkeleton#config', { 130 | kanaTable = 'tsuki2-263', 131 | }) 132 | end 133 | -------------------------------------------------------------------------------- /conf/rc/colors/def/candy.vim: -------------------------------------------------------------------------------- 1 | colorscheme candy 2 | 3 | "" from https://github.com/Shougo/shougo-s-github/blob/5c3f2114ec87e01d47cf73a1c0cb38e76c996aa2/vim/rc/deinlazy.toml#L458-L520 4 | " Custom colors 5 | highlight CandyBlue gui=NONE guibg=#2c2c2c guifg=#1e95fd 6 | highlight CandyCranberry gui=NONE guibg=#2c2c2c guifg=#4ae2e2 7 | highlight CandyEmerald gui=NONE guibg=#2c2c2c guifg=#44ff44 8 | highlight CandyGreen gui=NONE guibg=#2c2c2c guifg=#66ff66 9 | highlight CandyLime gui=NONE guibg=#2c2c2c guifg=#4ae2e2 10 | highlight CandyOrange gui=NONE guibg=#2c2c2c guifg=#ffb30a 11 | highlight CandyRed gui=NONE guibg=#2c2c2c guifg=#ff6666 12 | highlight CandySky gui=NONE guibg=#2c2c2c guifg=#6699ff 13 | highlight CandyViolet gui=NONE guibg=#2c2c2c guifg=#ff13ff 14 | highlight CandyWhite gui=NONE guibg=#2c2c2c guifg=#cccccc 15 | highlight CandyYellow gui=NONE guibg=#2c2c2c guifg=#ffd30a 16 | highlight CandyCoral gui=NONE guibg=#2c2c2c guifg=#f820ff 17 | highlight CandyTurquoise gui=NONE guibg=#2c2c2c guifg=#1bc8c8 18 | highlight CandyCrimson gui=NONE guibg=#2c2c2c guifg=#ff4444 19 | 20 | " neovim treesitter colors 21 | highlight! link TSAnnotation CandyViolet 22 | highlight! link TSAttribute CandySky 23 | highlight! link TSBoolean Boolean 24 | highlight! link TSCharacter Character 25 | highlight! link TSConditional CandyCoral 26 | highlight! link TSConstBuiltin CandyGreen 27 | highlight! link TSConstMacro CandyViolet 28 | highlight! link TSConstant Constant 29 | highlight! link TSConstructor CandyEmerald 30 | highlight! link TSError Error 31 | highlight! link TSException Exception 32 | highlight! link TSField CandyBlue 33 | highlight! link TSFloat Float 34 | highlight! link TSFuncBuiltin CandySky 35 | highlight! link TSFuncMacro CandySky 36 | highlight! link TSFunction CandyCranberry 37 | highlight! link TSInclude CandyCranberry 38 | highlight! link TSKeyword CandyEmerald 39 | highlight! link TSKeywordFunction Keyword 40 | highlight! link TSKeywordOperator CandyViolet 41 | highlight! link TSLabel Label 42 | highlight! link TSLiteral CandyYellow 43 | highlight! link TSMethod CandyTurquoise 44 | highlight! link TSNamespace CandyBlue 45 | highlight! link TSNone Normal 46 | highlight! link TSNumber Number 47 | highlight! link TSOperator Operator 48 | highlight! link TSParameter CandyWhite 49 | highlight! link TSParameterReference CandyWhite 50 | highlight! link TSProperty Identifier 51 | highlight! link TSPunctBracket CandyOrange 52 | highlight! link TSPunctDelimiter CandyLime 53 | highlight! link TSPunctSpecial Special 54 | highlight! link TSRepeat Repeat 55 | highlight! link TSString String 56 | highlight! link TSStringEscape SpecialChar 57 | highlight! link TSStringRegex String 58 | highlight! link TSTag CandyBlue 59 | highlight! link TSTagDelimiter CandyLime 60 | highlight! link TSText TSNone 61 | highlight! link TSTitle Title 62 | highlight! link TSType Type 63 | highlight! link TSTypeBuiltin Type 64 | highlight! link TSURL Underlined 65 | highlight! link TSUnderline Underlined 66 | highlight! link TSVariableBuiltin CandyLime 67 | -------------------------------------------------------------------------------- /conf/plug/nvim/insx.lua: -------------------------------------------------------------------------------- 1 | -- vim.cmd("doautocmd InsertEnter", vim.fn.bufname()) 2 | if false then 3 | require("insx.preset.standard").setup({}) 4 | return 5 | end 6 | local insx = require("insx") 7 | local esc = require("insx.helper.regex").esc 8 | insx.add("", require("insx.recipe.fast_wrap")({ close = ")" })) 9 | local function auto_pair(key, open, close) 10 | insx.add( 11 | key, 12 | require("insx.recipe.auto_pair")({ 13 | open = open, 14 | close = close, 15 | }) 16 | ) 17 | local function delete_pair(key) 18 | insx.add( 19 | key, 20 | require("insx.recipe.delete_pair")({ 21 | open_pat = esc(open), 22 | close_pat = esc(close), 23 | }) 24 | ) 25 | end 26 | delete_pair("") 27 | delete_pair("") 28 | end 29 | auto_pair("'b", "`", "`") 30 | auto_pair("'g", "<", ">") 31 | auto_pair("'f", "(", ")") 32 | auto_pair("'d", "[", "]") 33 | auto_pair("'s", "{", "}") 34 | auto_pair("'w", "'", "'") 35 | auto_pair("'q", '"', '"') 36 | auto_pair("' b", "`", "`;") 37 | auto_pair("' g", "<", ">;") 38 | auto_pair("' f", "(", ");") 39 | auto_pair("' d", "[", "];") 40 | auto_pair("' s", "{", "};") 41 | auto_pair("' w", "'", "';") 42 | auto_pair("' q", '"', '";') 43 | 44 | local function fast_break(open, close) 45 | insx.add( 46 | "", 47 | require("insx.recipe.fast_break")({ 48 | open_pat = esc(open), 49 | close_pat = esc(close), 50 | }) 51 | ) 52 | end 53 | fast_break("(", ")") 54 | fast_break("[", "]") 55 | fast_break("{", "}") 56 | fast_break("''", "''") -- Nixの文字列がdoubleでTOMLの文字列がtriple 57 | 58 | -- 行を跨ぐためにhelper.search.get_next()に差し替えたやつ 59 | -- MIT License 60 | -- Copyright (c) 2025 hrsh7th 61 | local function jump_next(option) 62 | local kit = require('insx.kit') 63 | local helper = require('insx.helper') 64 | local jump_pat = kit.to_array(option.jump_pat) 65 | return { 66 | ---@param ctx insx.Context 67 | enabled = function(ctx) 68 | local curr_pos = { math.huge, math.huge } 69 | for _, pat in ipairs(jump_pat) do 70 | local pos = helper.search.get_next(pat) 71 | if pos then 72 | if helper.position.lt(pos, curr_pos) then 73 | curr_pos = pos 74 | end 75 | end 76 | end 77 | return curr_pos[1] ~= math.huge 78 | end, 79 | ---@param ctx insx.Context 80 | action = function(ctx) 81 | local curr_pos = { math.huge, math.huge } 82 | for _, pat in ipairs(jump_pat) do 83 | local pos = helper.search.get_next(pat) 84 | if pos then 85 | if helper.position.lt(pos, curr_pos) then 86 | curr_pos = pos 87 | end 88 | end 89 | end 90 | ctx.move(unpack(curr_pos)) 91 | end, 92 | } 93 | end 94 | insx.add( 95 | "", 96 | jump_next({ 97 | jump_pat = { 98 | [[\%#\s*]] .. esc(")") .. [[\zs]], 99 | [[\%#$\n\s*]] .. esc(")") .. [[\zs]], 100 | [[\%#\s*]] .. esc(";") .. [[\zs]], 101 | [[\%#\s*]] .. esc("]") .. [[\zs]], 102 | [[\%#$\n\s*]] .. esc("]") .. [[\zs]], 103 | [[\%#\s*]] .. esc("}") .. [[\zs]], 104 | [[\%#$\n\s*]] .. esc("}") .. [[\zs]], 105 | [[\%#\s*]] .. esc(">") .. [[\zs]], 106 | [[\%#\s*]] .. esc('"') .. [[\zs]], 107 | [[\%#\s*]] .. esc("'") .. [[\zs]], 108 | [[\%#\s*]] .. esc("`") .. [[\zs]], 109 | }, 110 | }) 111 | ) 112 | 113 | local function loadrfile(path) 114 | loadfile(vim.fn.expand('