if filereadable(expand('~/dotfiles/.config/nvim/min-edit.vim')) source ~/dotfiles/.config/nvim/min-edit.vim endif let g:did_install_default_menus = 1 let g:did_install_syntax_menu = 1 let g:did_indent_on = 1 let g:did_load_filetypes = 1 " load ftplugin to set commentstring " let g:did_load_ftplugin = 1 let g:loaded_2html_plugin = 1 let g:loaded_gzip = 1 let g:loaded_man = 1 let g:loaded_matchit = 1 let g:loaded_matchparen = 1 let g:loaded_netrwPlugin = 1 let g:loaded_remote_plugins = 1 let g:loaded_shada_plugin = 1 let g:loaded_spellfile_plugin = 1 let g:loaded_tarPlugin = 1 let g:loaded_tutor_mode_plugin = 1 let g:loaded_zipPlugin = 1 let g:skip_loading_mswin = 1 set autoindent set autoread " set cmdheight=2 set completeopt=longest,menu " set cursorline set display=lastline set formatoptions=tcqmMj1 set history=2000 set incsearch set infercase " set laststatus=2 set lazyredraw set linebreak set list set listchars=tab:^-,trail:~,extends:»,precedes:«,nbsp:% set matchtime=1 " set number set shiftround set shortmess+=c set signcolumn=yes set splitbelow set splitright set switchbuf=usetab " set t_Co=256 set termguicolors set textwidth=0 set title set ttyfast set updatetime=300 set wildmode=list:longest,full let g:markdown_fenced_languages = ['ts=typescript', 'js=javascript'] "----------------- " Plugs "----------------- " [Tips should also describe automatic installation for Neovim|junegunn/vim-plug](https://github.com/junegunn/vim-plug/issues/739) let s:autoload_plug_path = stdpath('config') . '/autoload/plug.vim' if !filereadable(s:autoload_plug_path) if !executable('curl') echoerr 'You have to install `curl` to install vim-plug.' execute 'quit!' endif silent execute '!curl -fL --create-dirs -o ' . s:autoload_plug_path . \ ' https://raw.github.com/junegunn/vim-plug/master/plug.vim' endif " [おい、NeoBundle もいいけど vim-plug 使えよ](https://qiita.com/b4b4r07/items/fa9c8cceb321edea5da0) function! s:AutoPlugInstall() abort let s:not_installed_plugs = get(g:, 'plugs', {})->items()->copy() \ ->filter({_,item->!isdirectory(item[1].dir)}) \ ->map({_,item->item[0]}) if empty(s:not_installed_plugs) return endif echo 'Not installed plugs: ' . string(s:not_installed_plugs) if confirm('Install now?', "yes\nNo", 2) == 1 PlugInstall --sync | close endif endfunction augroup vimrc_plug autocmd! autocmd VimEnter * call s:AutoPlugInstall() augroup END call plug#begin(stdpath('config') . '/plugged') Plug 'vim-denops/denops.vim' Plug 'Shougo/ddc.vim' Plug 'Shougo/ddc-around' Plug 'Shougo/ddc-nvim-lsp' Plug 'Shougo/pum.vim' Plug 'Shougo/ddc-matcher_head' Plug 'Shougo/neco-vim' Plug 'Shougo/ddc-cmdline' Plug 'Shougo/ddc-cmdline-history' Plug 'Shougo/ddc-converter_remove_overlap' Plug 'Shougo/ddc-rg' Plug 'matsui54/ddc-converter_truncate' Plug 'matsui54/ddc-buffer' Plug 'matsui54/ddc-dictionary' Plug 'LumaKernel/ddc-file' Plug 'LumaKernel/ddc-tabnine' Plug 'LumaKernel/ddc-registers-words' Plug 'tani/ddc-fuzzy' Plug 'gamoutatsumi/ddc-sorter_ascii' Plug 'vim-skk/denops-skkeleton.vim' Plug 'delphinus/skkeleton_indicator.nvim' Plug 'delphinus/ddc-treesitter' Plug 'matsui54/denops-popup-preview.vim' Plug 'ray-x/lsp_signature.nvim' Plug 'hrsh7th/vim-vsnip' Plug 'hrsh7th/vim-vsnip-integ' Plug 'rafamadriz/friendly-snippets' Plug 'lewis6991/impatient.nvim' Plug 'neovim/nvim-lspconfig' Plug 'williamboman/nvim-lsp-installer' Plug 'kyazdani42/nvim-web-devicons' Plug 'folke/lsp-colors.nvim' Plug 'folke/trouble.nvim' Plug 'folke/lua-dev.nvim', { 'for': 'lua' } Plug 'nvim-treesitter/nvim-treesitter', { 'do': ':TSUpdate' } Plug 'nvim-treesitter/nvim-treesitter-textobjects' Plug 'nvim-treesitter/nvim-treesitter-refactor' Plug 'JoosepAlviste/nvim-ts-context-commentstring' Plug 'p00f/nvim-ts-rainbow' Plug 'romgrk/nvim-treesitter-context' Plug 'lukas-reineke/indent-blankline.nvim' Plug 'mfussenegger/nvim-ts-hint-textobject' Plug 'lewis6991/spellsitter.nvim' Plug 'andymass/vim-matchup' Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lualine/lualine.nvim' Plug 'folke/which-key.nvim' Plug 'echasnovski/mini.nvim' Plug 'norcalli/nvim-colorizer.lua' Plug 'lewis6991/gitsigns.nvim' Plug 'kat0h/bufpreview.vim', { 'on': 'PreviewMarkdown' } Plug 'lambdalisue/gina.vim', { 'on': 'Gina' } Plug 'kdheepak/lazygit.nvim', { 'on': 'LazyGit' } Plug 'tyru/open-browser.vim', { 'on': ['OpenBrowser', '(openbrowser-'] } Plug 'tyru/capture.vim', { 'on': 'Capture' } " Plug 'obcat/vim-hitspop' Plug 'nvim-telescope/telescope.nvim' Plug 'nathom/filetype.nvim' Plug 'arthurxavierx/vim-caser' Plug 'haya14busa/vim-asterisk' Plug 'voldikss/vim-floaterm', { 'on': 'FloatermNew' } Plug 'phaazon/hop.nvim' Plug 'monaqa/dps-dial.vim' Plug 'segeljakt/vim-silicon', { 'on': 'Silicon' } Plug 'simeji/winresizer', { 'on': 'WinResizerStartResize' } Plug 'vim-jp/vimdoc-ja' call plug#end() let g:vsnip_filetypes = {} let g:vsnip_filetypes.javascriptreact = ['javascript'] let g:vsnip_filetypes.typescriptreact = ['typescript'] let g:asterisk#keeppos = 1 let g:lazygit_floating_window_scaling_factor = 1 let g:lazygit_floating_window_winblend = 20 let g:silicon = {} let g:silicon['output'] = '~/Downloads/silicon-{time:%Y-%m-%d-%H%M%S}.png' let s:dictPath = '~/.cache/nvim/google-10000-english-no-swears.txt' if !filereadable(expand(s:dictPath)) echo "10k words dictionary does not exists! '" . s:dictPath . "' is required!" let l:dictDir = fnamemodify(s:dictPath, ':h') let l:cmds = [ \ "curl -OL https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt", \ "mkdir -p " . l:dictDir, \ "mv " . fnamemodify(s:dictPath, ':t') . " " . l:dictDir, \ ] echo "To get dictionary, run:\n" . l:cmds->join("\n") . "\n" if confirm("Run automatically?", "y\nN") == 1 echo "Running..." call system(l:cmds->join(" && ")) echo "Done." endif endif call ddc#custom#patch_global('sources', [ \ 'skkeleton', 'vsnip', 'nvim-lsp', 'buffer', 'file', 'tabnine', 'treesitter', \ 'registers-words', 'dictionary', 'rg', 'around']) call ddc#custom#patch_global('completionMenu', 'pum.vim') call ddc#custom#patch_global('autoCompleteEvents', [ \ 'InsertEnter', 'TextChangedI', 'TextChangedP', \ 'CmdlineChanged', 'CmdlineEnter']) let s:source_common_option = #{ \ ignoreCase: v:true, \ matchers: ['matcher_fuzzy'], \ sorters: ['sorter_fuzzy'], \ converters: ['converter_remove_overlap', 'converter_truncate', 'converter_fuzzy'] \ } call ddc#custom#patch_global('sourceOptions', #{ \ _: s:source_common_option, \ around: #{ \ mark: 'A', \ isVolatile: v:true, \ }, \ buffer: #{ \ mark: 'B', \ maxCandidates: 10, \ }, \ dictionary: #{ \ mark: 'D', \ maxCandidates: 6, \ minAutoCompleteLength: 3, \ }, \ file: #{ \ mark: 'F', \ isVolatile: v:true, \ forceCompletionPattern: '\S/\S*', \ }, \ skkeleton: #{ \ mark: 'skk', \ matchers: ['skkeleton'], \ minAutoCompleteLength: 1, \ }, \ vsnip: #{ \ mark: 'VS', \ dup: v:true, \ }, \ tabnine: #{ \ mark: 'TN', \ maxCandidates: 6, \ isVolatile: v:true, \ minAutoCompleteLength: 1, \ }, \ treesitter: #{ \ mark: 'TS', \ }, \ registers-words: #{ \ mark: 'reg', \ minAutoCompleteLength: 3, \ }, \ rg: #{ \ mark: 'rg', \ minAutoCompleteLength: 3, \ }, \ nvim-lsp: #{ \ mark: 'lsp', \ forceCompletionPattern: '\.\w*|:\w*|->\w*', \ }, \ }) call ddc#custom#patch_global('filterParams', #{ \ converter_truncate: #{ maxAbbrWidth: 60, maxInfo: 500, ellipsis: '...' }, \ converter_fuzzy: #{ hlGroup: 'Title' }, \ }) " call ddc#custom#patch_global('specialBufferCompletion', v:true) " 10k words dictionary: " https://raw.githubusercontent.com/first20hours/google-10000-english/master/google-10000-english-no-swears.txt call ddc#custom#patch_global('sourceParams', #{ \ around: #{ maxSize: 500 }, \ buffer: #{ forceCollect: v:true, fromAltBuf: v:true, showBufName: v:true }, \ dictionary: #{ \ showMenu: v:false, \ dictPaths: [expand(s:dictPath)], \ }, \ registers-words: #{ registers: '/"0123456' }, \ nvim-lsp: #{ maxSize: 500 }, \ }) call ddc#enable() call popup_preview#enable() " {{{ mappings(ddc) imap \ vsnip#jumpable(1) ? '(vsnip-jump-next)' : \ pum#visible() ? 'call pum#map#insert_relative(+1)' : \ (col('.') <= 1 getline('.')[col('.') - 2] =~# '\s') ? \ '' : 'call ddc#map#manual_complete()' imap \ vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : \ pum#visible() ? 'call pum#map#insert_relative(-1)' : \ '' inoremap (pum#visible() ? '' : 'call ddc#map#manual_complete()') . 'call pum#map#select_relative(+1)' inoremap (pum#visible() ? '' : 'call ddc#map#manual_complete()') . 'call pum#map#select_relative(-1)' inoremap call pum#map#confirm() inoremap call pum#map#cancel() inoremap call pum#map#insert_relative_page(+1) inoremap call pum#map#insert_relative_page(-1) inoremap pum#visible() ? 'call pum#map#confirm()' : '' " }}} augroup pum-complete-done autocmd! autocmd User PumCompleteDone call vsnip_integ#on_complete_done(g:pum#completed_item) augroup END " {{{ mappings(vsnip) " imap vsnip#expandable() ? '(vsnip-expand)' : '' " smap vsnip#expandable() ? '(vsnip-expand)' : '' imap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' smap vsnip#available(1) ? '(vsnip-expand-or-jump)' : '' smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' smap j j smap k k nmap st (vsnip-select-text) xmap st (vsnip-select-text) nmap sT (vsnip-cut-text) xmap sT (vsnip-cut-text) " }}} " {{{ mappings(ddc command-line completion) " cnoremap pum#visible() ? 'call pum#map#insert_relative(+1)' : 'ddc#map#manual_complete()' " cnoremap pum#visible() ? 'call pum#map#insert_relative(-1)' : 'ddc#map#manual_complete()' cnoremap pum#visible() ? 'call pum#map#insert_relative(+1)' : ddc#map#manual_complete() cnoremap pum#visible() ? 'call pum#map#insert_relative(-1)' : ddc#map#manual_complete() " cnoremap pum#visible() ? 'call pum#map#insert_relative(+1)' : '' " cnoremap pum#visible() ? 'call pum#map#insert_relative(-1)' : '' cnoremap pum#visible() ? 'call pum#map#confirm()' : '' cnoremap call pum#map#confirm() cnoremap call pum#map#cancel() nnoremap : call CommandlinePre(): function! s:CommandlinePre() abort " Overwrite sources let s:prev_buffer_config = ddc#custom#get_buffer() call ddc#custom#patch_buffer('sources', ['cmdline', 'cmdline-history']) call ddc#custom#patch_buffer('autoCompleteEvents', ['CmdlineChanged', 'CmdlineEnter']) call ddc#custom#patch_buffer('sourceOptions', #{ \ _: s:source_common_option, \ cmdline: #{ mark: 'cmd', minAutoCompleteLength: 1 }, \ cmdline-history: #{ mark: 'hist' }, \ }) " \ necovim: #{ mark: 'neco' }, autocmd User DDCCmdlineLeave ++once call CommandlinePost() " Enable command line completion call ddc#enable_cmdline_completion() endfunction function! s:CommandlinePost() abort " Restore sources call ddc#custom#set_buffer(s:prev_buffer_config) endfunction " }}} " {{{ dps-dial.vim let g:dps_dial#augends = [ \ 'decimal', \ 'date-slash', \ #{ kind: 'constant', opts: #{ elements: ['true', 'false'] } }, \ #{ kind: 'case', opts: #{ cases: ['camelCase', 'snake_case','kebab-case','SCREAMING_SNAKE_CASE'] } }, \ ] nmap (dps-dial-increment) nmap (dps-dial-decrement) xmap (dps-dial-increment) xmap (dps-dial-decrement) xmap g g(dps-dial-increment) xmap g g(dps-dial-decrement) " }}} " {{{ nvim-ts-hint-textobject onoremap m lua require('tsht').nodes() vnoremap m lua require('tsht').nodes() " }}} " {{{ nvim-ts-hint-textobject nmap gx (openbrowser-smart-search) xmap gx (openbrowser-smart-search) " }}} " {{{ vim-asterisk map * (asterisk-z*) map # (asterisk-z#) map g* (asterisk-gz*) map g# (asterisk-gz#) " }}} " {{{ telescope.vim nnoremap ff Telescope git_files nnoremap fg Telescope live_grep nnoremap fb Telescope buffers nnoremap fh Telescope help_tags " }}} " {{{ hop.nvim nnoremap so :HopChar1 nnoremap st :HopChar2 nnoremap sl HopLine nnoremap sw HopWord " }}} " {{{ winresizer nnoremap WinResizerStartResize " }}} " {{{ user owned mappings noremap [b bprevious noremap ]b bnext noremap [B bfirst noremap ]B blast noremap [q cprevious noremap ]q cnext noremap [Q cfirst noremap ]Q clast map M % " [Vim で q を prefix キーにする - 永遠に未完成](https://thinca.hatenablog.com/entry/q-as-prefix-key-in-vim) nnoremap