From 17975ffc46cc18ca49304b4780f20a5b0b91e4ca Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 27 Nov 2021 21:59:34 +0900 Subject: vim: minimize .vimrc --- .config/nvim/my | 1 - .config/nvim/my/after/ftplugin/c.vim | 20 + .config/nvim/my/after/ftplugin/cmake.vim | 16 + .config/nvim/my/after/ftplugin/cpp.vim | 20 + .config/nvim/my/after/ftplugin/css.vim | 16 + .config/nvim/my/after/ftplugin/gitcommit.vim | 14 + .config/nvim/my/after/ftplugin/go.vim | 17 + .config/nvim/my/after/ftplugin/haskell.vim | 22 + .config/nvim/my/after/ftplugin/html.vim | 16 + .config/nvim/my/after/ftplugin/javascript.vim | 16 + .config/nvim/my/after/ftplugin/json.vim | 16 + .config/nvim/my/after/ftplugin/lisp.vim | 16 + .config/nvim/my/after/ftplugin/lua.vim | 16 + .config/nvim/my/after/ftplugin/markdown.vim | 18 + .config/nvim/my/after/ftplugin/php.vim | 30 + .config/nvim/my/after/ftplugin/python.vim | 21 + .config/nvim/my/after/ftplugin/qf.vim | 40 + .config/nvim/my/after/ftplugin/ruby.vim | 18 + .config/nvim/my/after/ftplugin/toml.vim | 16 + .config/nvim/my/after/ftplugin/typescript.vim | 16 + .config/nvim/my/after/ftplugin/vim.vim | 22 + .config/nvim/my/after/ftplugin/yaml.vim | 16 + .config/nvim/my/after/syntax/json.vim | 23 + .config/nvim/my/after/syntax/python.vim | 19 + .config/nvim/my/after/syntax/vim.vim | 30 + .config/nvim/my/autoload/autosave.vim | 70 + .config/nvim/my/autoload/dummy.vim | 39 + .config/nvim/my/colors/ocean.vim | 262 ++++ .config/nvim/my/plugin/autosave.vim | 29 + .config/nvim/my/plugin/dummy.vim | 15 + .config/nvim/my/syntax/gitcommit.vim | 96 ++ .config/vim/my/after/ftplugin/c.vim | 20 - .config/vim/my/after/ftplugin/cmake.vim | 16 - .config/vim/my/after/ftplugin/cpp.vim | 20 - .config/vim/my/after/ftplugin/css.vim | 16 - .config/vim/my/after/ftplugin/gitcommit.vim | 14 - .config/vim/my/after/ftplugin/go.vim | 17 - .config/vim/my/after/ftplugin/haskell.vim | 22 - .config/vim/my/after/ftplugin/html.vim | 16 - .config/vim/my/after/ftplugin/javascript.vim | 16 - .config/vim/my/after/ftplugin/json.vim | 16 - .config/vim/my/after/ftplugin/lisp.vim | 16 - .config/vim/my/after/ftplugin/lua.vim | 16 - .config/vim/my/after/ftplugin/markdown.vim | 18 - .config/vim/my/after/ftplugin/php.vim | 30 - .config/vim/my/after/ftplugin/python.vim | 21 - .config/vim/my/after/ftplugin/qf.vim | 40 - .config/vim/my/after/ftplugin/ruby.vim | 18 - .config/vim/my/after/ftplugin/toml.vim | 16 - .config/vim/my/after/ftplugin/typescript.vim | 16 - .config/vim/my/after/ftplugin/vim.vim | 22 - .config/vim/my/after/ftplugin/yaml.vim | 16 - .config/vim/my/after/syntax/json.vim | 23 - .config/vim/my/after/syntax/python.vim | 19 - .config/vim/my/after/syntax/vim.vim | 30 - .config/vim/my/autoload/autosave.vim | 70 - .config/vim/my/autoload/dummy.vim | 39 - .config/vim/my/colors/ocean.vim | 262 ---- .config/vim/my/plugin/autosave.vim | 29 - .config/vim/my/plugin/dummy.vim | 15 - .config/vim/my/syntax/gitcommit.vim | 96 -- .gitignore | 1 - .vimrc | 1774 +------------------------ scripts/nvim-startup.sh | 5 + scripts/vim-startup.sh | 11 - setup.sh | 6 - 66 files changed, 1025 insertions(+), 2743 deletions(-) delete mode 120000 .config/nvim/my create mode 100644 .config/nvim/my/after/ftplugin/c.vim create mode 100644 .config/nvim/my/after/ftplugin/cmake.vim create mode 100644 .config/nvim/my/after/ftplugin/cpp.vim create mode 100644 .config/nvim/my/after/ftplugin/css.vim create mode 100644 .config/nvim/my/after/ftplugin/gitcommit.vim create mode 100644 .config/nvim/my/after/ftplugin/go.vim create mode 100644 .config/nvim/my/after/ftplugin/haskell.vim create mode 100644 .config/nvim/my/after/ftplugin/html.vim create mode 100644 .config/nvim/my/after/ftplugin/javascript.vim create mode 100644 .config/nvim/my/after/ftplugin/json.vim create mode 100644 .config/nvim/my/after/ftplugin/lisp.vim create mode 100644 .config/nvim/my/after/ftplugin/lua.vim create mode 100644 .config/nvim/my/after/ftplugin/markdown.vim create mode 100644 .config/nvim/my/after/ftplugin/php.vim create mode 100644 .config/nvim/my/after/ftplugin/python.vim create mode 100644 .config/nvim/my/after/ftplugin/qf.vim create mode 100644 .config/nvim/my/after/ftplugin/ruby.vim create mode 100644 .config/nvim/my/after/ftplugin/toml.vim create mode 100644 .config/nvim/my/after/ftplugin/typescript.vim create mode 100644 .config/nvim/my/after/ftplugin/vim.vim create mode 100644 .config/nvim/my/after/ftplugin/yaml.vim create mode 100644 .config/nvim/my/after/syntax/json.vim create mode 100644 .config/nvim/my/after/syntax/python.vim create mode 100644 .config/nvim/my/after/syntax/vim.vim create mode 100644 .config/nvim/my/autoload/autosave.vim create mode 100644 .config/nvim/my/autoload/dummy.vim create mode 100644 .config/nvim/my/colors/ocean.vim create mode 100644 .config/nvim/my/plugin/autosave.vim create mode 100644 .config/nvim/my/plugin/dummy.vim create mode 100644 .config/nvim/my/syntax/gitcommit.vim delete mode 100644 .config/vim/my/after/ftplugin/c.vim delete mode 100644 .config/vim/my/after/ftplugin/cmake.vim delete mode 100644 .config/vim/my/after/ftplugin/cpp.vim delete mode 100644 .config/vim/my/after/ftplugin/css.vim delete mode 100644 .config/vim/my/after/ftplugin/gitcommit.vim delete mode 100644 .config/vim/my/after/ftplugin/go.vim delete mode 100644 .config/vim/my/after/ftplugin/haskell.vim delete mode 100644 .config/vim/my/after/ftplugin/html.vim delete mode 100644 .config/vim/my/after/ftplugin/javascript.vim delete mode 100644 .config/vim/my/after/ftplugin/json.vim delete mode 100644 .config/vim/my/after/ftplugin/lisp.vim delete mode 100644 .config/vim/my/after/ftplugin/lua.vim delete mode 100644 .config/vim/my/after/ftplugin/markdown.vim delete mode 100644 .config/vim/my/after/ftplugin/php.vim delete mode 100644 .config/vim/my/after/ftplugin/python.vim delete mode 100644 .config/vim/my/after/ftplugin/qf.vim delete mode 100644 .config/vim/my/after/ftplugin/ruby.vim delete mode 100644 .config/vim/my/after/ftplugin/toml.vim delete mode 100644 .config/vim/my/after/ftplugin/typescript.vim delete mode 100644 .config/vim/my/after/ftplugin/vim.vim delete mode 100644 .config/vim/my/after/ftplugin/yaml.vim delete mode 100644 .config/vim/my/after/syntax/json.vim delete mode 100644 .config/vim/my/after/syntax/python.vim delete mode 100644 .config/vim/my/after/syntax/vim.vim delete mode 100644 .config/vim/my/autoload/autosave.vim delete mode 100644 .config/vim/my/autoload/dummy.vim delete mode 100644 .config/vim/my/colors/ocean.vim delete mode 100644 .config/vim/my/plugin/autosave.vim delete mode 100644 .config/vim/my/plugin/dummy.vim delete mode 100644 .config/vim/my/syntax/gitcommit.vim create mode 100755 scripts/nvim-startup.sh delete mode 100755 scripts/vim-startup.sh diff --git a/.config/nvim/my b/.config/nvim/my deleted file mode 120000 index dd11040..0000000 --- a/.config/nvim/my +++ /dev/null @@ -1 +0,0 @@ -../vim/my \ No newline at end of file diff --git a/.config/nvim/my/after/ftplugin/c.vim b/.config/nvim/my/after/ftplugin/c.vim new file mode 100644 index 0000000..12de33e --- /dev/null +++ b/.config/nvim/my/after/ftplugin/c.vim @@ -0,0 +1,20 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_c_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=4 +FtpluginSetLocal softtabstop=4 +FtpluginSetLocal cinoptions=:0,l1 + +let g:c_comment_strings = v:true +let g:c_space_errors = v:true + + + +let b:did_ftplugin_c_after = 1 diff --git a/.config/nvim/my/after/ftplugin/cmake.vim b/.config/nvim/my/after/ftplugin/cmake.vim new file mode 100644 index 0000000..b4f5591 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/cmake.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_cmake_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_cmake_after = 1 \ No newline at end of file diff --git a/.config/nvim/my/after/ftplugin/cpp.vim b/.config/nvim/my/after/ftplugin/cpp.vim new file mode 100644 index 0000000..13c0374 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/cpp.vim @@ -0,0 +1,20 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_cpp_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=4 +FtpluginSetLocal softtabstop=4 +FtpluginSetLocal cinoptions=:0,l1,g0,N-s + +let g:c_comment_strings = v:true +let g:c_space_errors = v:true + + + +let b:did_ftplugin_cpp_after = 1 \ No newline at end of file diff --git a/.config/nvim/my/after/ftplugin/css.vim b/.config/nvim/my/after/ftplugin/css.vim new file mode 100644 index 0000000..e4743e8 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/css.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_css_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_css_after = 1 diff --git a/.config/nvim/my/after/ftplugin/gitcommit.vim b/.config/nvim/my/after/ftplugin/gitcommit.vim new file mode 100644 index 0000000..915a193 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/gitcommit.vim @@ -0,0 +1,14 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_gitcommit_after') + finish +endif + + + +FtpluginSetLocal spell + + + +let b:did_ftplugin_gitcommit_after = 1 diff --git a/.config/nvim/my/after/ftplugin/go.vim b/.config/nvim/my/after/ftplugin/go.vim new file mode 100644 index 0000000..54aa34b --- /dev/null +++ b/.config/nvim/my/after/ftplugin/go.vim @@ -0,0 +1,17 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_go_after') + finish +endif + + + +FtpluginSetLocal noexpandtab +FtpluginSetLocal shiftwidth=4 +FtpluginSetLocal softtabstop=4 +FtpluginSetLocal tabstop=4 + + + +let b:did_ftplugin_go_after = 1 \ No newline at end of file diff --git a/.config/nvim/my/after/ftplugin/haskell.vim b/.config/nvim/my/after/ftplugin/haskell.vim new file mode 100644 index 0000000..676dcce --- /dev/null +++ b/.config/nvim/my/after/ftplugin/haskell.vim @@ -0,0 +1,22 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_haskell_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=4 +FtpluginSetLocal softtabstop=4 + +let g:hs_highlight_boolean = v:true +let g:hs_highlight_types = v:true +let g:hs_highlight_more_types = v:true +let g:hs_highlight_debug = v:true +let g:hs_allow_hash_operator = v:true + + + +let b:did_ftplugin_haskell_after = 1 diff --git a/.config/nvim/my/after/ftplugin/html.vim b/.config/nvim/my/after/ftplugin/html.vim new file mode 100644 index 0000000..a7b36ad --- /dev/null +++ b/.config/nvim/my/after/ftplugin/html.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_html_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_html_after = 1 \ No newline at end of file diff --git a/.config/nvim/my/after/ftplugin/javascript.vim b/.config/nvim/my/after/ftplugin/javascript.vim new file mode 100644 index 0000000..a79e644 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/javascript.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_javascript_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_javascript_after = 1 diff --git a/.config/nvim/my/after/ftplugin/json.vim b/.config/nvim/my/after/ftplugin/json.vim new file mode 100644 index 0000000..9886a95 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/json.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_json_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_json_after = 1 diff --git a/.config/nvim/my/after/ftplugin/lisp.vim b/.config/nvim/my/after/ftplugin/lisp.vim new file mode 100644 index 0000000..13c1abc --- /dev/null +++ b/.config/nvim/my/after/ftplugin/lisp.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_lisp_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_lisp_after = 1 diff --git a/.config/nvim/my/after/ftplugin/lua.vim b/.config/nvim/my/after/ftplugin/lua.vim new file mode 100644 index 0000000..d0eb8b2 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/lua.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_lua_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=3 +FtpluginSetLocal softtabstop=3 + + + +let b:did_ftplugin_lua_after = 1 diff --git a/.config/nvim/my/after/ftplugin/markdown.vim b/.config/nvim/my/after/ftplugin/markdown.vim new file mode 100644 index 0000000..36791bc --- /dev/null +++ b/.config/nvim/my/after/ftplugin/markdown.vim @@ -0,0 +1,18 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_markdown_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=4 +FtpluginSetLocal softtabstop=4 + +let g:markdown_syntax_conceal = v:false + + + +let b:did_ftplugin_markdown_after = 1 diff --git a/.config/nvim/my/after/ftplugin/php.vim b/.config/nvim/my/after/ftplugin/php.vim new file mode 100644 index 0000000..ec7fd3e --- /dev/null +++ b/.config/nvim/my/after/ftplugin/php.vim @@ -0,0 +1,30 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_php_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +" If a buffer is empty, insert ` p zzp +nnoremap dd :call del_entry() +xnoremap d :call del_entry() +nnoremap u :call undo_entry() + + +if exists('*s:undo_entry') + finish +endif + + +function! s:undo_entry() + let history = get(w:, 'qf_history', []) + if !empty(history) + call setqflist(remove(history, -1), 'r') + endif +endfunction + +function! s:del_entry() range + let qf = getqflist() + let history = get(w:, 'qf_history', []) + call add(history, copy(qf)) + let w:qf_history = history + unlet! qf[a:firstline - 1 : a:lastline - 1] + call setqflist(qf, 'r') + execute a:firstline +endfunction + + + +let b:did_ftplugin_qf_after = 1 diff --git a/.config/nvim/my/after/ftplugin/ruby.vim b/.config/nvim/my/after/ftplugin/ruby.vim new file mode 100644 index 0000000..0421a5a --- /dev/null +++ b/.config/nvim/my/after/ftplugin/ruby.vim @@ -0,0 +1,18 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_ruby_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + +let g:ruby_space_errors = v:true + + + +let b:did_ftplugin_ruby_after = 1 diff --git a/.config/nvim/my/after/ftplugin/toml.vim b/.config/nvim/my/after/ftplugin/toml.vim new file mode 100644 index 0000000..84f6ca7 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/toml.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_toml_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_toml_after = 1 diff --git a/.config/nvim/my/after/ftplugin/typescript.vim b/.config/nvim/my/after/ftplugin/typescript.vim new file mode 100644 index 0000000..cdb1674 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/typescript.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_typescript_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_typescript_after = 1 diff --git a/.config/nvim/my/after/ftplugin/vim.vim b/.config/nvim/my/after/ftplugin/vim.vim new file mode 100644 index 0000000..1ffa6a3 --- /dev/null +++ b/.config/nvim/my/after/ftplugin/vim.vim @@ -0,0 +1,22 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_vim_after') + finish +endif + + + +FtpluginSetLocal colorcolumn=+1 +FtpluginSetLocal expandtab +FtpluginSetLocal iskeyword-=# +FtpluginSetLocal keywordprg=:help +FtpluginSetLocal shiftwidth=4 +FtpluginSetLocal softtabstop=4 +FtpluginSetLocal textwidth=78 + +let g:vim_indent_cont = 4 + + + +let b:did_ftplugin_vim_after = 1 \ No newline at end of file diff --git a/.config/nvim/my/after/ftplugin/yaml.vim b/.config/nvim/my/after/ftplugin/yaml.vim new file mode 100644 index 0000000..5b4734e --- /dev/null +++ b/.config/nvim/my/after/ftplugin/yaml.vim @@ -0,0 +1,16 @@ +scriptencoding utf-8 + + +if exists('b:did_ftplugin_yaml_after') + finish +endif + + + +FtpluginSetLocal expandtab +FtpluginSetLocal shiftwidth=2 +FtpluginSetLocal softtabstop=2 + + + +let b:did_ftplugin_yaml_after = 1 diff --git a/.config/nvim/my/after/syntax/json.vim b/.config/nvim/my/after/syntax/json.vim new file mode 100644 index 0000000..0d2651e --- /dev/null +++ b/.config/nvim/my/after/syntax/json.vim @@ -0,0 +1,23 @@ +scriptencoding utf-8 + +if exists("b:current_syntax_my_json") + finish +endif + +if b:current_syntax !=# 'json' + finish +endif + + +" $VIMRUNTIME/syntax/json.vim +" Language: JSON +" Maintainer: Eli Parra +" Last Change: 2014 Aug 23 +" Version: 0.12 +" Overwrite syntax by non-conceal version even if 'conceal' is enabled. +syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained +syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained + + + +let b:current_syntax_my_json = 1 diff --git a/.config/nvim/my/after/syntax/python.vim b/.config/nvim/my/after/syntax/python.vim new file mode 100644 index 0000000..834ab1f --- /dev/null +++ b/.config/nvim/my/after/syntax/python.vim @@ -0,0 +1,19 @@ +scriptencoding utf-8 + + +if exists("b:current_syntax_my_python") + finish +endif + +if b:current_syntax !=# 'python' + finish +endif + + + +" Highlight "self". +syn keyword pythonSelf self +hi default link pythonSelf Identifier + + +let b:current_syntax_my_python = 1 diff --git a/.config/nvim/my/after/syntax/vim.vim b/.config/nvim/my/after/syntax/vim.vim new file mode 100644 index 0000000..a6b0d31 --- /dev/null +++ b/.config/nvim/my/after/syntax/vim.vim @@ -0,0 +1,30 @@ +scriptencoding utf-8 + + +if exists("b:current_syntax_my_vim") + finish +endif + +if b:current_syntax !=# 'vim' + finish +endif + + + +" Tags +syn match vimrcDocTagFollowingName /@\(param\|var\|const\|field\)/ contained skipwhite nextgroup=vimrcDocName,vimrcDocName2 +syn match vimrcDocTagFollowingType /@\(return\|class\|ctor\|method\|type\)/ contained skipwhite nextgroup=vimrcDocType +syn match vimrcDocName /\w\+/ contained skipwhite nextgroup=vimrcDocType +syn match vimrcDocName2 /\[\w\+\]/hs=s+1,he=e-1 contained skipwhite nextgroup=vimrcDocType +syn match vimrcDocType /(\w\+)/hs=s+1,he=e-1 contained skipwhite nextgroup=vimrcDocType + +syn cluster vimCommentGroup add=vimrcDocTagFollowingName,vimrcDocTagFollowingType + +hi def link vimrcDocTagFollowingName Statement +hi def link vimrcDocTagFollowingType Statement +hi def link vimrcDocName Identifier +hi def link vimrcDocName2 Identifier +hi def link vimrcDocType Type + + +let b:current_syntax_my_vim = 1 diff --git a/.config/nvim/my/autoload/autosave.vim b/.config/nvim/my/autoload/autosave.vim new file mode 100644 index 0000000..2773460 --- /dev/null +++ b/.config/nvim/my/autoload/autosave.vim @@ -0,0 +1,70 @@ +scriptencoding utf-8 + + + +if !exists('g:autosave_interval_ms') + let g:autosave_interval_ms = 10 * 1000 +endif + +if !exists('g:autosave_silent') + let g:autosave_silent = v:true +endif + + + +function! autosave#handler(timer_id) abort + if !&modified + return + endif + if &readonly + return + endif + if &buftype !=# '' + return + endif + if expand('%') ==# '' + return + endif + + if !g:autosave_silent + echohl Comment + echo 'Auto-saving...' + echohl None + endif + + silent! write + + if !g:autosave_silent + echohl Comment + echo 'Saved.' + echohl None + endif +endfunction + + +function! autosave#enable() abort + if !has('timers') && !has('nvim') + echohl Error + echo "Feature '+timers' not available." + echohl None + return + endif + if exists('b:autosave_timer') + return + endif + + let b:autosave_timer = timer_start( + \ g:autosave_interval_ms, + \ 'autosave#handler', + \ { 'repeat': -1 }) +endfunction + + +function! autosave#disable() abort + if !exists('b:autosave_timer') + return + endif + + call timer_stop('b:autosave_timer') + unlet b:autosave_timer +endfunction diff --git a/.config/nvim/my/autoload/dummy.vim b/.config/nvim/my/autoload/dummy.vim new file mode 100644 index 0000000..3019bdf --- /dev/null +++ b/.config/nvim/my/autoload/dummy.vim @@ -0,0 +1,39 @@ +scriptencoding utf-8 + + + +let s:text = {} + +let s:text.lipsum = [ + \ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor', + \ 'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis', + \ 'nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', + \ 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore', + \ 'eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt', + \ 'in culpa qui officia deserunt mollit anim id est laborum.', + \ ] + +let s:text.lipsum1 = join(s:text.lipsum) + +let s:text.quickbrownfox = 'The quick brown fox jumps over the lazy dog.' + +let s:text.ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + +let s:text.abc = 'abcdefghijklmnopqrstuvwxyz' + +let s:text.hiragana = 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん' + +let s:text.katakana = 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン' + +let s:text.ihatovo = 'あのイーハトーヴォのすきとおった風、夏でも底に冷たさをもつ青いそら、うつくしい森で飾られたモリーオ市、郊外のぎらぎらひかる草の波。' + + + +function! dummy#insert(type) + call append(line('.'), get(s:text, a:type, '')) +endfunction + + +function! dummy#complete(arglead, cmdline, cursorpos) abort + return sort(filter(keys(s:text), {idx, val -> val[0:len(a:arglead)-1] =~? a:arglead})) +endfunction diff --git a/.config/nvim/my/colors/ocean.vim b/.config/nvim/my/colors/ocean.vim new file mode 100644 index 0000000..c3b0a46 --- /dev/null +++ b/.config/nvim/my/colors/ocean.vim @@ -0,0 +1,262 @@ +scriptencoding utf-8 + + +hi clear +let g:colors_name = 'ocean' + + + +" Color palette {{{1 + +if &background ==# 'dark' + let s:palette = { + \ 'NONE': 'NONE', + \ 'fg': '#b1b1c8', + \ 'bg': '#101020', + \ 'blue': '#6e6eff', + \ 'blue-bg': '#202050', + \ 'blue2': '#70b0ff', + \ 'comment': '#8686bf', + \ 'cursor': '#5b5bb6', + \ 'gray': '#353535', + \ 'gray2': '#202020', + \ 'green': '#c4e088', + \ 'green-bg': '#204020', + \ 'orange': '#deab52', + \ 'orange2': '#ff7100', + \ 'red': '#a65f49', + \ 'red-bg': '#402020', + \ 'selection': '#303060', + \ 'yellow': '#a68f49', + \ 'yellow2': '#a89562', + \ 'yellow3': '#5c5241', + \ } +else + let s:palette = { + \ 'NONE': 'NONE', + \ 'fg': '#203050', + \ 'bg': '#f5f5ff', + \ 'blue': '#6e6eff', + \ 'blue-bg': '#202050', + \ 'blue2': '#6f8fff', + \ 'comment': '#a0a0e0', + \ 'cursor': '#5b5bb6', + \ 'gray': '#bebebe', + \ 'gray2': '#171717', + \ 'green': '#6f9226', + \ 'green-bg': '#204020', + \ 'orange': '#e79230', + \ 'orange2': '#ff7100', + \ 'red': '#d77253', + \ 'red-bg': '#402020', + \ 'selection': '#f0f0d0', + \ 'yellow': '#cba224', + \ 'yellow2': '#af8e29', + \ 'yellow3': '#c6b683', + \ } +endif + + + +" Semantic highlight group {{{1 + +function! s:hl(group_name, guifg, guibg, attr) abort + execute printf('hi! ocean%s guifg=%s guibg=%s gui=%s cterm=%s', + \ a:group_name, + \ s:palette[a:guifg], + \ s:palette[a:guibg], + \ a:attr, + \ a:attr) +endfunction + + +call s:hl('AnalysisError', 'red', 'NONE', 'underline') +call s:hl('AnalysisWarning', 'yellow2', 'NONE', 'underline') +call s:hl('Cursor', 'fg', 'cursor', 'NONE') +call s:hl('DecorationBold', 'NONE', 'NONE', 'bold') +call s:hl('DecorationUnderlined', 'NONE', 'NONE', 'underline') +call s:hl('DiffAdd', 'NONE', 'blue-bg', 'NONE') +call s:hl('DiffChange', 'NONE', 'green-bg', 'NONE') +call s:hl('DiffDelete', 'NONE', 'red-bg', 'NONE') +call s:hl('DiffText', 'NONE', 'green-bg', 'underline') +call s:hl('Error', 'red', 'NONE', 'NONE') +call s:hl('Hidden', 'bg', 'bg', 'NONE') +call s:hl('Normal', 'fg', 'bg', 'NONE') +call s:hl('Prompt', 'comment', 'NONE', 'bold') +call s:hl('Search', 'bg', 'yellow3', 'NONE') +call s:hl('Special', 'red', 'NONE', 'NONE') +call s:hl('SpecialKey', 'gray', 'NONE', 'NONE') +call s:hl('SyntaxComment', 'comment', 'NONE', 'NONE') +call s:hl('SyntaxCommentSpecial', 'fg', 'NONE', 'bold') +call s:hl('SyntaxConstant', 'red', 'NONE', 'NONE') +call s:hl('SyntaxIdentifier', 'green', 'NONE', 'NONE') +call s:hl('SyntaxStatement', 'blue', 'NONE', 'bold') +call s:hl('SyntaxStatement2', 'blue', 'NONE', 'NONE') +call s:hl('SyntaxString', 'yellow', 'NONE', 'NONE') +call s:hl('SyntaxType', 'blue2', 'NONE', 'NONE') +call s:hl('Title', 'orange', 'NONE', 'NONE') +call s:hl('UiCompletion', 'fg', 'gray', 'NONE') +call s:hl('UiSelection', 'NONE', 'selection', 'NONE') +call s:hl('UiStatusLine', 'fg', 'gray', 'NONE') +call s:hl('UiStatusLineModeCommand', 'bg', 'blue', 'bold') +call s:hl('UiStatusLineModeInsert', 'bg', 'green', 'bold') +call s:hl('UiStatusLineModeNormal', 'bg', 'blue', 'bold') +call s:hl('UiStatusLineModeOperator', 'bg', 'blue', 'bold') +call s:hl('UiStatusLineModeOther', 'bg', 'blue', 'bold') +call s:hl('UiStatusLineModeReplace', 'bg', 'red', 'bold') +call s:hl('UiStatusLineModeTerminal', 'bg', 'blue', 'bold') +call s:hl('UiStatusLineModeVisual', 'bg', 'orange', 'bold') +call s:hl('UiStatusLineNC', 'fg', 'gray2', 'NONE') +call s:hl('UiTabLine', 'fg', 'gray', 'NONE') +call s:hl('UiTabLineNC', 'fg', 'bg', 'NONE') +call s:hl('UiTarget', 'orange2', 'NONE', 'underline') +call s:hl('Warning', 'yellow2', 'NONE', 'NONE') + +delfunction! s:hl + + + +" Highlight link {{{1 + +" :sort /hi! link \w\+ \+/ + +" Vim builtins {{{2 + +hi! link SpellBad oceanAnalysisError +hi! link SpellCap oceanAnalysisError +hi! link SpellLocal oceanAnalysisWarning +hi! link SpellRare oceanAnalysisWarning +hi! link Cursor oceanCursor +hi! link CursorIM oceanCursor +hi! link Underlined oceanDecorationUnderlined +hi! link DiffAdd oceanDiffAdd +hi! link DiffChange oceanDiffChange +hi! link DiffDelete oceanDiffDelete +hi! link DiffText oceanDiffText +hi! link Error oceanError +hi! link ErrorMsg oceanError +hi! link EndOfBuffer oceanHidden +hi! link MatchParen oceanHidden +hi! link CursorLineNr oceanNormal +hi! link Normal oceanNormal +hi! link PMenu oceanUiCompletion +hi! link PMenuSbar oceanUiCompletion +hi! link PMenuThumb oceanUiCompletion +hi! link MoreMsg oceanPrompt +hi! link Question oceanPrompt +hi! link IncSearch oceanSearch +hi! link Search oceanSearch +hi! link CursorColumn oceanUiSelection +hi! link CursorLine oceanUiSelection +hi! link FoldColumn oceanUiSelection +hi! link LineNr oceanUiSelection +hi! link PMenuSel oceanUiSelection +hi! link SignColumn oceanUiSelection +hi! link Visual oceanUiSelection +hi! link Special oceanSpecial +hi! link NonText oceanSpecialKey +hi! link SpecialKey oceanSpecialKey +hi! link VertSplit oceanUiStatusLine +hi! link Comment oceanSyntaxComment +hi! link Folded oceanSyntaxComment +hi! link ModeMsg oceanSyntaxComment +hi! link SpecialComment oceanSyntaxCommentSpecial +hi! link Todo oceanSyntaxCommentSpecial +hi! link Constant oceanSyntaxConstant +hi! link Identifier oceanSyntaxIdentifier +hi! link Statement oceanSyntaxStatement +hi! link Operator oceanSyntaxStatement2 +hi! link PreProc oceanSyntaxStatement2 +hi! link Character oceanSyntaxString +hi! link String oceanSyntaxString +hi! link Directory oceanSyntaxType +hi! link Type oceanSyntaxType +hi! link Title oceanTitle +hi! link WildMenu oceanTitle +hi! link ColorColumn oceanUiSelection +hi! link WarningMsg oceanWarning + + +" 'statusline' and 'tabline' {{{2 + +" Cited from ':h hl-StatusLineNC': +" > Note: if this is equal to "StatusLine" Vim will use "^^^" in +" > the status line of the current window. +hi! link StatusLine oceanUiStatusLine +hi! link StatusLineNC oceanUiStatusLineNC +hi! link statusLineModeNormal oceanUiStatusLineModeNormal +hi! link statusLineModeInsert oceanUiStatusLineModeInsert +hi! link statusLineModeVisual oceanUiStatusLineModeVisual +hi! link statusLineModeOperator oceanUiStatusLineModeOperator +hi! link statusLineModeReplace oceanUiStatusLineModeReplace +hi! link statusLineModeCommand oceanUiStatusLineModeCommand +hi! link statusLineModeTerminal oceanUiStatusLineModeTerminal +hi! link statusLineModeOther oceanUiStatusLineModeOther + + +hi! link TabLineSel oceanUiTabLine +hi! link TabLine oceanUiTabLineNC +hi! link TabLineFill oceanHidden + + +" Third-party plugins {{{2 + +hi! link YankRoundRegion oceanUiSelection + +hi! link OperatorSandwichAdd oceanUiSelection +hi! link OperatorSandwichBuns oceanUiSelection +hi! link OperatorSandwichChange oceanUiSelection +hi! link OperatorSandwichDelete oceanUiSelection + +hi! link EasyMotionMoveHL oceanSearch +hi! link EasyMotionTarget oceanUiTarget + + +" File types {{{2 + +" c {{{3 + +hi! link cOctalZero oceanConstant + +" cpp {{{3 + +hi! link cppRawStringDelimiter oceanSyntaxString + +" html {{{3 + +hi! link htmlEndTag oceanSyntaxStatement2 +hi! link htmlTag oceanSyntaxStatement2 +hi! link htmlTagName oceanSyntaxStatement2 + +" php {{{3 + +hi! link phpParent oceanNormal +hi! link phpOperator oceanNormal +hi! link phpRelation oceanNormal +hi! link phpDocTags oceanSyntaxCommentSpecial +hi! link phpSpecialFunction oceanSyntaxIdentifier + +" ruby {{{3 + +hi! link rubyDataDirective oceanSyntaxStatement2 +hi! link rubyStringDelimiter oceanSyntaxString + + + + + +" sh {{{3 + +hi! link shQuote oceanSyntaxString +hi! link shDerefSimple oceanSyntaxIdentifier +hi! link shDerefVar oceanSyntaxIdentifier + + + + + +" Utilities {{{1 + +command! -bar + \ OceanGetHighlightGroupName + \ echo synIDattr(synID(line('.'), col('.'), v:false), 'name') diff --git a/.config/nvim/my/plugin/autosave.vim b/.config/nvim/my/plugin/autosave.vim new file mode 100644 index 0000000..6339dcb --- /dev/null +++ b/.config/nvim/my/plugin/autosave.vim @@ -0,0 +1,29 @@ +scriptencoding utf-8 + +if exists('g:loaded_autosave') + finish +endif + + + +command! -bar + \ AutosaveEnable + \ call autosave#enable() + + +command! -bar + \ AutosaveDisable + \ call autosave#disable() + + +command! -bar + \ AutosaveToggle + \ if exists('b:autosave_timer') | + \ call autosave#disable() | + \ else | + \ call autosave#enable() | + \ endif + + + +let g:loaded_autosave = 1 diff --git a/.config/nvim/my/plugin/dummy.vim b/.config/nvim/my/plugin/dummy.vim new file mode 100644 index 0000000..ce7b901 --- /dev/null +++ b/.config/nvim/my/plugin/dummy.vim @@ -0,0 +1,15 @@ +scriptencoding utf-8 + +if exists('g:loaded_dummy') + finish +endif + + + +command! -bar -complete=customlist,dummy#complete -nargs=1 + \ Dummy + \ call dummy#insert() + + + +let g:loaded_dummy = 1 diff --git a/.config/nvim/my/syntax/gitcommit.vim b/.config/nvim/my/syntax/gitcommit.vim new file mode 100644 index 0000000..14232a2 --- /dev/null +++ b/.config/nvim/my/syntax/gitcommit.vim @@ -0,0 +1,96 @@ +" Vim syntax file +" Language: git commit file +" Maintainer: Tim Pope +" Filenames: *.git/COMMIT_EDITMSG +" Last Change: 2019 Dec 05 +" +" Modified By: nsfisis +" Changed comment char from '#' (git default) to ';'. + +if exists("b:current_syntax") + finish +endif + +syn case match +syn sync minlines=50 + +if has("spell") + syn spell toplevel +endif + +syn include @gitcommitDiff syntax/diff.vim +syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff + +syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell +syn match gitcommitOverflow ".*" contained contains=@Spell +syn match gitcommitBlank "^[^;].*" contained contains=@Spell + +if get(g:, "gitcommit_cleanup") is# "scissors" + syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank skipnl + syn region gitcommitComment start=/^; -\+ >8 -\+$/ end=/\%$/ contains=gitcommitDiff +else + syn match gitcommitFirstLine "\%^[^;].*" nextgroup=gitcommitBlank skipnl + syn match gitcommitComment "^;.*" +endif + +syn match gitcommitHead "^\%(; .*\n\)\+;$" contained transparent +syn match gitcommitOnBranch "\%(^; \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite +syn match gitcommitOnBranch "\%(^; \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite +syn match gitcommitBranch "[^ ']\+" contained +syn match gitcommitNoBranch "\%(^; \)\@<=Not currently on any branch." contained containedin=gitcommitComment +syn match gitcommitHeader "\%(^; \)\@<=.*:$" contained containedin=gitcommitComment +syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^; \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent +syn match gitcommitNoChanges "\%(^; \)\@<=No changes$" contained containedin=gitcommitComment + +syn region gitcommitUntracked start=/^; Untracked files:/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold +syn match gitcommitUntrackedFile "\t\@<=.*" contained + +syn region gitcommitDiscarded start=/^; Change\%(s not staged for commit\|d but not updated\):/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold +syn region gitcommitSelected start=/^; Changes to be committed:/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold +syn region gitcommitUnmerged start=/^; Unmerged paths:/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold + + +syn match gitcommitDiscardedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite +syn match gitcommitSelectedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite +syn match gitcommitUnmergedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite +syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow +syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow +syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow +syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile +syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile +syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile + +syn match gitcommitWarning "\%^[^;].*: needs merge$" nextgroup=gitcommitWarning skipnl +syn match gitcommitWarning "^[^;].*: needs merge$" nextgroup=gitcommitWarning skipnl contained +syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$" + +hi def link gitcommitSummary Keyword +hi def link gitcommitComment Comment +hi def link gitcommitUntracked gitcommitComment +hi def link gitcommitDiscarded gitcommitComment +hi def link gitcommitSelected gitcommitComment +hi def link gitcommitUnmerged gitcommitComment +hi def link gitcommitOnBranch Comment +hi def link gitcommitBranch Special +hi def link gitcommitNoBranch gitCommitBranch +hi def link gitcommitDiscardedType gitcommitType +hi def link gitcommitSelectedType gitcommitType +hi def link gitcommitUnmergedType gitcommitType +hi def link gitcommitType Type +hi def link gitcommitNoChanges gitcommitHeader +hi def link gitcommitHeader PreProc +hi def link gitcommitUntrackedFile gitcommitFile +hi def link gitcommitDiscardedFile gitcommitFile +hi def link gitcommitSelectedFile gitcommitFile +hi def link gitcommitUnmergedFile gitcommitFile +hi def link gitcommitFile Constant +hi def link gitcommitDiscardedArrow gitcommitArrow +hi def link gitcommitSelectedArrow gitcommitArrow +hi def link gitcommitUnmergedArrow gitcommitArrow +hi def link gitcommitArrow gitcommitComment +"hi def link gitcommitOverflow Error +hi def link gitcommitBlank Error + +hi def link gitcommitIssue Constant + +let b:current_syntax = "gitcommit" diff --git a/.config/vim/my/after/ftplugin/c.vim b/.config/vim/my/after/ftplugin/c.vim deleted file mode 100644 index 12de33e..0000000 --- a/.config/vim/my/after/ftplugin/c.vim +++ /dev/null @@ -1,20 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_c_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 -FtpluginSetLocal cinoptions=:0,l1 - -let g:c_comment_strings = v:true -let g:c_space_errors = v:true - - - -let b:did_ftplugin_c_after = 1 diff --git a/.config/vim/my/after/ftplugin/cmake.vim b/.config/vim/my/after/ftplugin/cmake.vim deleted file mode 100644 index b4f5591..0000000 --- a/.config/vim/my/after/ftplugin/cmake.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_cmake_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_cmake_after = 1 \ No newline at end of file diff --git a/.config/vim/my/after/ftplugin/cpp.vim b/.config/vim/my/after/ftplugin/cpp.vim deleted file mode 100644 index 13c0374..0000000 --- a/.config/vim/my/after/ftplugin/cpp.vim +++ /dev/null @@ -1,20 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_cpp_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 -FtpluginSetLocal cinoptions=:0,l1,g0,N-s - -let g:c_comment_strings = v:true -let g:c_space_errors = v:true - - - -let b:did_ftplugin_cpp_after = 1 \ No newline at end of file diff --git a/.config/vim/my/after/ftplugin/css.vim b/.config/vim/my/after/ftplugin/css.vim deleted file mode 100644 index e4743e8..0000000 --- a/.config/vim/my/after/ftplugin/css.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_css_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_css_after = 1 diff --git a/.config/vim/my/after/ftplugin/gitcommit.vim b/.config/vim/my/after/ftplugin/gitcommit.vim deleted file mode 100644 index 915a193..0000000 --- a/.config/vim/my/after/ftplugin/gitcommit.vim +++ /dev/null @@ -1,14 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_gitcommit_after') - finish -endif - - - -FtpluginSetLocal spell - - - -let b:did_ftplugin_gitcommit_after = 1 diff --git a/.config/vim/my/after/ftplugin/go.vim b/.config/vim/my/after/ftplugin/go.vim deleted file mode 100644 index 54aa34b..0000000 --- a/.config/vim/my/after/ftplugin/go.vim +++ /dev/null @@ -1,17 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_go_after') - finish -endif - - - -FtpluginSetLocal noexpandtab -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 -FtpluginSetLocal tabstop=4 - - - -let b:did_ftplugin_go_after = 1 \ No newline at end of file diff --git a/.config/vim/my/after/ftplugin/haskell.vim b/.config/vim/my/after/ftplugin/haskell.vim deleted file mode 100644 index 676dcce..0000000 --- a/.config/vim/my/after/ftplugin/haskell.vim +++ /dev/null @@ -1,22 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_haskell_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 - -let g:hs_highlight_boolean = v:true -let g:hs_highlight_types = v:true -let g:hs_highlight_more_types = v:true -let g:hs_highlight_debug = v:true -let g:hs_allow_hash_operator = v:true - - - -let b:did_ftplugin_haskell_after = 1 diff --git a/.config/vim/my/after/ftplugin/html.vim b/.config/vim/my/after/ftplugin/html.vim deleted file mode 100644 index a7b36ad..0000000 --- a/.config/vim/my/after/ftplugin/html.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_html_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_html_after = 1 \ No newline at end of file diff --git a/.config/vim/my/after/ftplugin/javascript.vim b/.config/vim/my/after/ftplugin/javascript.vim deleted file mode 100644 index a79e644..0000000 --- a/.config/vim/my/after/ftplugin/javascript.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_javascript_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_javascript_after = 1 diff --git a/.config/vim/my/after/ftplugin/json.vim b/.config/vim/my/after/ftplugin/json.vim deleted file mode 100644 index 9886a95..0000000 --- a/.config/vim/my/after/ftplugin/json.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_json_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_json_after = 1 diff --git a/.config/vim/my/after/ftplugin/lisp.vim b/.config/vim/my/after/ftplugin/lisp.vim deleted file mode 100644 index 13c1abc..0000000 --- a/.config/vim/my/after/ftplugin/lisp.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_lisp_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_lisp_after = 1 diff --git a/.config/vim/my/after/ftplugin/lua.vim b/.config/vim/my/after/ftplugin/lua.vim deleted file mode 100644 index d0eb8b2..0000000 --- a/.config/vim/my/after/ftplugin/lua.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_lua_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=3 -FtpluginSetLocal softtabstop=3 - - - -let b:did_ftplugin_lua_after = 1 diff --git a/.config/vim/my/after/ftplugin/markdown.vim b/.config/vim/my/after/ftplugin/markdown.vim deleted file mode 100644 index 36791bc..0000000 --- a/.config/vim/my/after/ftplugin/markdown.vim +++ /dev/null @@ -1,18 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_markdown_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 - -let g:markdown_syntax_conceal = v:false - - - -let b:did_ftplugin_markdown_after = 1 diff --git a/.config/vim/my/after/ftplugin/php.vim b/.config/vim/my/after/ftplugin/php.vim deleted file mode 100644 index ec7fd3e..0000000 --- a/.config/vim/my/after/ftplugin/php.vim +++ /dev/null @@ -1,30 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_php_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -" If a buffer is empty, insert ` p zzp -nnoremap dd :call del_entry() -xnoremap d :call del_entry() -nnoremap u :call undo_entry() - - -if exists('*s:undo_entry') - finish -endif - - -function! s:undo_entry() - let history = get(w:, 'qf_history', []) - if !empty(history) - call setqflist(remove(history, -1), 'r') - endif -endfunction - -function! s:del_entry() range - let qf = getqflist() - let history = get(w:, 'qf_history', []) - call add(history, copy(qf)) - let w:qf_history = history - unlet! qf[a:firstline - 1 : a:lastline - 1] - call setqflist(qf, 'r') - execute a:firstline -endfunction - - - -let b:did_ftplugin_qf_after = 1 diff --git a/.config/vim/my/after/ftplugin/ruby.vim b/.config/vim/my/after/ftplugin/ruby.vim deleted file mode 100644 index 0421a5a..0000000 --- a/.config/vim/my/after/ftplugin/ruby.vim +++ /dev/null @@ -1,18 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_ruby_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - -let g:ruby_space_errors = v:true - - - -let b:did_ftplugin_ruby_after = 1 diff --git a/.config/vim/my/after/ftplugin/toml.vim b/.config/vim/my/after/ftplugin/toml.vim deleted file mode 100644 index 84f6ca7..0000000 --- a/.config/vim/my/after/ftplugin/toml.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_toml_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_toml_after = 1 diff --git a/.config/vim/my/after/ftplugin/typescript.vim b/.config/vim/my/after/ftplugin/typescript.vim deleted file mode 100644 index cdb1674..0000000 --- a/.config/vim/my/after/ftplugin/typescript.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_typescript_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_typescript_after = 1 diff --git a/.config/vim/my/after/ftplugin/vim.vim b/.config/vim/my/after/ftplugin/vim.vim deleted file mode 100644 index 1ffa6a3..0000000 --- a/.config/vim/my/after/ftplugin/vim.vim +++ /dev/null @@ -1,22 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_vim_after') - finish -endif - - - -FtpluginSetLocal colorcolumn=+1 -FtpluginSetLocal expandtab -FtpluginSetLocal iskeyword-=# -FtpluginSetLocal keywordprg=:help -FtpluginSetLocal shiftwidth=4 -FtpluginSetLocal softtabstop=4 -FtpluginSetLocal textwidth=78 - -let g:vim_indent_cont = 4 - - - -let b:did_ftplugin_vim_after = 1 \ No newline at end of file diff --git a/.config/vim/my/after/ftplugin/yaml.vim b/.config/vim/my/after/ftplugin/yaml.vim deleted file mode 100644 index 5b4734e..0000000 --- a/.config/vim/my/after/ftplugin/yaml.vim +++ /dev/null @@ -1,16 +0,0 @@ -scriptencoding utf-8 - - -if exists('b:did_ftplugin_yaml_after') - finish -endif - - - -FtpluginSetLocal expandtab -FtpluginSetLocal shiftwidth=2 -FtpluginSetLocal softtabstop=2 - - - -let b:did_ftplugin_yaml_after = 1 diff --git a/.config/vim/my/after/syntax/json.vim b/.config/vim/my/after/syntax/json.vim deleted file mode 100644 index 0d2651e..0000000 --- a/.config/vim/my/after/syntax/json.vim +++ /dev/null @@ -1,23 +0,0 @@ -scriptencoding utf-8 - -if exists("b:current_syntax_my_json") - finish -endif - -if b:current_syntax !=# 'json' - finish -endif - - -" $VIMRUNTIME/syntax/json.vim -" Language: JSON -" Maintainer: Eli Parra -" Last Change: 2014 Aug 23 -" Version: 0.12 -" Overwrite syntax by non-conceal version even if 'conceal' is enabled. -syn region jsonString oneline matchgroup=jsonQuote start=/"/ skip=/\\\\\|\\"/ end=/"/ contains=jsonEscape contained -syn region jsonKeyword matchgroup=jsonQuote start=/"/ end=/"\ze[[:blank:]\r\n]*\:/ contained - - - -let b:current_syntax_my_json = 1 diff --git a/.config/vim/my/after/syntax/python.vim b/.config/vim/my/after/syntax/python.vim deleted file mode 100644 index 834ab1f..0000000 --- a/.config/vim/my/after/syntax/python.vim +++ /dev/null @@ -1,19 +0,0 @@ -scriptencoding utf-8 - - -if exists("b:current_syntax_my_python") - finish -endif - -if b:current_syntax !=# 'python' - finish -endif - - - -" Highlight "self". -syn keyword pythonSelf self -hi default link pythonSelf Identifier - - -let b:current_syntax_my_python = 1 diff --git a/.config/vim/my/after/syntax/vim.vim b/.config/vim/my/after/syntax/vim.vim deleted file mode 100644 index a6b0d31..0000000 --- a/.config/vim/my/after/syntax/vim.vim +++ /dev/null @@ -1,30 +0,0 @@ -scriptencoding utf-8 - - -if exists("b:current_syntax_my_vim") - finish -endif - -if b:current_syntax !=# 'vim' - finish -endif - - - -" Tags -syn match vimrcDocTagFollowingName /@\(param\|var\|const\|field\)/ contained skipwhite nextgroup=vimrcDocName,vimrcDocName2 -syn match vimrcDocTagFollowingType /@\(return\|class\|ctor\|method\|type\)/ contained skipwhite nextgroup=vimrcDocType -syn match vimrcDocName /\w\+/ contained skipwhite nextgroup=vimrcDocType -syn match vimrcDocName2 /\[\w\+\]/hs=s+1,he=e-1 contained skipwhite nextgroup=vimrcDocType -syn match vimrcDocType /(\w\+)/hs=s+1,he=e-1 contained skipwhite nextgroup=vimrcDocType - -syn cluster vimCommentGroup add=vimrcDocTagFollowingName,vimrcDocTagFollowingType - -hi def link vimrcDocTagFollowingName Statement -hi def link vimrcDocTagFollowingType Statement -hi def link vimrcDocName Identifier -hi def link vimrcDocName2 Identifier -hi def link vimrcDocType Type - - -let b:current_syntax_my_vim = 1 diff --git a/.config/vim/my/autoload/autosave.vim b/.config/vim/my/autoload/autosave.vim deleted file mode 100644 index 2773460..0000000 --- a/.config/vim/my/autoload/autosave.vim +++ /dev/null @@ -1,70 +0,0 @@ -scriptencoding utf-8 - - - -if !exists('g:autosave_interval_ms') - let g:autosave_interval_ms = 10 * 1000 -endif - -if !exists('g:autosave_silent') - let g:autosave_silent = v:true -endif - - - -function! autosave#handler(timer_id) abort - if !&modified - return - endif - if &readonly - return - endif - if &buftype !=# '' - return - endif - if expand('%') ==# '' - return - endif - - if !g:autosave_silent - echohl Comment - echo 'Auto-saving...' - echohl None - endif - - silent! write - - if !g:autosave_silent - echohl Comment - echo 'Saved.' - echohl None - endif -endfunction - - -function! autosave#enable() abort - if !has('timers') && !has('nvim') - echohl Error - echo "Feature '+timers' not available." - echohl None - return - endif - if exists('b:autosave_timer') - return - endif - - let b:autosave_timer = timer_start( - \ g:autosave_interval_ms, - \ 'autosave#handler', - \ { 'repeat': -1 }) -endfunction - - -function! autosave#disable() abort - if !exists('b:autosave_timer') - return - endif - - call timer_stop('b:autosave_timer') - unlet b:autosave_timer -endfunction diff --git a/.config/vim/my/autoload/dummy.vim b/.config/vim/my/autoload/dummy.vim deleted file mode 100644 index 3019bdf..0000000 --- a/.config/vim/my/autoload/dummy.vim +++ /dev/null @@ -1,39 +0,0 @@ -scriptencoding utf-8 - - - -let s:text = {} - -let s:text.lipsum = [ - \ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor', - \ 'incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis', - \ 'nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.', - \ 'Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore', - \ 'eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt', - \ 'in culpa qui officia deserunt mollit anim id est laborum.', - \ ] - -let s:text.lipsum1 = join(s:text.lipsum) - -let s:text.quickbrownfox = 'The quick brown fox jumps over the lazy dog.' - -let s:text.ABC = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - -let s:text.abc = 'abcdefghijklmnopqrstuvwxyz' - -let s:text.hiragana = 'あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん' - -let s:text.katakana = 'アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲン' - -let s:text.ihatovo = 'あのイーハトーヴォのすきとおった風、夏でも底に冷たさをもつ青いそら、うつくしい森で飾られたモリーオ市、郊外のぎらぎらひかる草の波。' - - - -function! dummy#insert(type) - call append(line('.'), get(s:text, a:type, '')) -endfunction - - -function! dummy#complete(arglead, cmdline, cursorpos) abort - return sort(filter(keys(s:text), {idx, val -> val[0:len(a:arglead)-1] =~? a:arglead})) -endfunction diff --git a/.config/vim/my/colors/ocean.vim b/.config/vim/my/colors/ocean.vim deleted file mode 100644 index c3b0a46..0000000 --- a/.config/vim/my/colors/ocean.vim +++ /dev/null @@ -1,262 +0,0 @@ -scriptencoding utf-8 - - -hi clear -let g:colors_name = 'ocean' - - - -" Color palette {{{1 - -if &background ==# 'dark' - let s:palette = { - \ 'NONE': 'NONE', - \ 'fg': '#b1b1c8', - \ 'bg': '#101020', - \ 'blue': '#6e6eff', - \ 'blue-bg': '#202050', - \ 'blue2': '#70b0ff', - \ 'comment': '#8686bf', - \ 'cursor': '#5b5bb6', - \ 'gray': '#353535', - \ 'gray2': '#202020', - \ 'green': '#c4e088', - \ 'green-bg': '#204020', - \ 'orange': '#deab52', - \ 'orange2': '#ff7100', - \ 'red': '#a65f49', - \ 'red-bg': '#402020', - \ 'selection': '#303060', - \ 'yellow': '#a68f49', - \ 'yellow2': '#a89562', - \ 'yellow3': '#5c5241', - \ } -else - let s:palette = { - \ 'NONE': 'NONE', - \ 'fg': '#203050', - \ 'bg': '#f5f5ff', - \ 'blue': '#6e6eff', - \ 'blue-bg': '#202050', - \ 'blue2': '#6f8fff', - \ 'comment': '#a0a0e0', - \ 'cursor': '#5b5bb6', - \ 'gray': '#bebebe', - \ 'gray2': '#171717', - \ 'green': '#6f9226', - \ 'green-bg': '#204020', - \ 'orange': '#e79230', - \ 'orange2': '#ff7100', - \ 'red': '#d77253', - \ 'red-bg': '#402020', - \ 'selection': '#f0f0d0', - \ 'yellow': '#cba224', - \ 'yellow2': '#af8e29', - \ 'yellow3': '#c6b683', - \ } -endif - - - -" Semantic highlight group {{{1 - -function! s:hl(group_name, guifg, guibg, attr) abort - execute printf('hi! ocean%s guifg=%s guibg=%s gui=%s cterm=%s', - \ a:group_name, - \ s:palette[a:guifg], - \ s:palette[a:guibg], - \ a:attr, - \ a:attr) -endfunction - - -call s:hl('AnalysisError', 'red', 'NONE', 'underline') -call s:hl('AnalysisWarning', 'yellow2', 'NONE', 'underline') -call s:hl('Cursor', 'fg', 'cursor', 'NONE') -call s:hl('DecorationBold', 'NONE', 'NONE', 'bold') -call s:hl('DecorationUnderlined', 'NONE', 'NONE', 'underline') -call s:hl('DiffAdd', 'NONE', 'blue-bg', 'NONE') -call s:hl('DiffChange', 'NONE', 'green-bg', 'NONE') -call s:hl('DiffDelete', 'NONE', 'red-bg', 'NONE') -call s:hl('DiffText', 'NONE', 'green-bg', 'underline') -call s:hl('Error', 'red', 'NONE', 'NONE') -call s:hl('Hidden', 'bg', 'bg', 'NONE') -call s:hl('Normal', 'fg', 'bg', 'NONE') -call s:hl('Prompt', 'comment', 'NONE', 'bold') -call s:hl('Search', 'bg', 'yellow3', 'NONE') -call s:hl('Special', 'red', 'NONE', 'NONE') -call s:hl('SpecialKey', 'gray', 'NONE', 'NONE') -call s:hl('SyntaxComment', 'comment', 'NONE', 'NONE') -call s:hl('SyntaxCommentSpecial', 'fg', 'NONE', 'bold') -call s:hl('SyntaxConstant', 'red', 'NONE', 'NONE') -call s:hl('SyntaxIdentifier', 'green', 'NONE', 'NONE') -call s:hl('SyntaxStatement', 'blue', 'NONE', 'bold') -call s:hl('SyntaxStatement2', 'blue', 'NONE', 'NONE') -call s:hl('SyntaxString', 'yellow', 'NONE', 'NONE') -call s:hl('SyntaxType', 'blue2', 'NONE', 'NONE') -call s:hl('Title', 'orange', 'NONE', 'NONE') -call s:hl('UiCompletion', 'fg', 'gray', 'NONE') -call s:hl('UiSelection', 'NONE', 'selection', 'NONE') -call s:hl('UiStatusLine', 'fg', 'gray', 'NONE') -call s:hl('UiStatusLineModeCommand', 'bg', 'blue', 'bold') -call s:hl('UiStatusLineModeInsert', 'bg', 'green', 'bold') -call s:hl('UiStatusLineModeNormal', 'bg', 'blue', 'bold') -call s:hl('UiStatusLineModeOperator', 'bg', 'blue', 'bold') -call s:hl('UiStatusLineModeOther', 'bg', 'blue', 'bold') -call s:hl('UiStatusLineModeReplace', 'bg', 'red', 'bold') -call s:hl('UiStatusLineModeTerminal', 'bg', 'blue', 'bold') -call s:hl('UiStatusLineModeVisual', 'bg', 'orange', 'bold') -call s:hl('UiStatusLineNC', 'fg', 'gray2', 'NONE') -call s:hl('UiTabLine', 'fg', 'gray', 'NONE') -call s:hl('UiTabLineNC', 'fg', 'bg', 'NONE') -call s:hl('UiTarget', 'orange2', 'NONE', 'underline') -call s:hl('Warning', 'yellow2', 'NONE', 'NONE') - -delfunction! s:hl - - - -" Highlight link {{{1 - -" :sort /hi! link \w\+ \+/ - -" Vim builtins {{{2 - -hi! link SpellBad oceanAnalysisError -hi! link SpellCap oceanAnalysisError -hi! link SpellLocal oceanAnalysisWarning -hi! link SpellRare oceanAnalysisWarning -hi! link Cursor oceanCursor -hi! link CursorIM oceanCursor -hi! link Underlined oceanDecorationUnderlined -hi! link DiffAdd oceanDiffAdd -hi! link DiffChange oceanDiffChange -hi! link DiffDelete oceanDiffDelete -hi! link DiffText oceanDiffText -hi! link Error oceanError -hi! link ErrorMsg oceanError -hi! link EndOfBuffer oceanHidden -hi! link MatchParen oceanHidden -hi! link CursorLineNr oceanNormal -hi! link Normal oceanNormal -hi! link PMenu oceanUiCompletion -hi! link PMenuSbar oceanUiCompletion -hi! link PMenuThumb oceanUiCompletion -hi! link MoreMsg oceanPrompt -hi! link Question oceanPrompt -hi! link IncSearch oceanSearch -hi! link Search oceanSearch -hi! link CursorColumn oceanUiSelection -hi! link CursorLine oceanUiSelection -hi! link FoldColumn oceanUiSelection -hi! link LineNr oceanUiSelection -hi! link PMenuSel oceanUiSelection -hi! link SignColumn oceanUiSelection -hi! link Visual oceanUiSelection -hi! link Special oceanSpecial -hi! link NonText oceanSpecialKey -hi! link SpecialKey oceanSpecialKey -hi! link VertSplit oceanUiStatusLine -hi! link Comment oceanSyntaxComment -hi! link Folded oceanSyntaxComment -hi! link ModeMsg oceanSyntaxComment -hi! link SpecialComment oceanSyntaxCommentSpecial -hi! link Todo oceanSyntaxCommentSpecial -hi! link Constant oceanSyntaxConstant -hi! link Identifier oceanSyntaxIdentifier -hi! link Statement oceanSyntaxStatement -hi! link Operator oceanSyntaxStatement2 -hi! link PreProc oceanSyntaxStatement2 -hi! link Character oceanSyntaxString -hi! link String oceanSyntaxString -hi! link Directory oceanSyntaxType -hi! link Type oceanSyntaxType -hi! link Title oceanTitle -hi! link WildMenu oceanTitle -hi! link ColorColumn oceanUiSelection -hi! link WarningMsg oceanWarning - - -" 'statusline' and 'tabline' {{{2 - -" Cited from ':h hl-StatusLineNC': -" > Note: if this is equal to "StatusLine" Vim will use "^^^" in -" > the status line of the current window. -hi! link StatusLine oceanUiStatusLine -hi! link StatusLineNC oceanUiStatusLineNC -hi! link statusLineModeNormal oceanUiStatusLineModeNormal -hi! link statusLineModeInsert oceanUiStatusLineModeInsert -hi! link statusLineModeVisual oceanUiStatusLineModeVisual -hi! link statusLineModeOperator oceanUiStatusLineModeOperator -hi! link statusLineModeReplace oceanUiStatusLineModeReplace -hi! link statusLineModeCommand oceanUiStatusLineModeCommand -hi! link statusLineModeTerminal oceanUiStatusLineModeTerminal -hi! link statusLineModeOther oceanUiStatusLineModeOther - - -hi! link TabLineSel oceanUiTabLine -hi! link TabLine oceanUiTabLineNC -hi! link TabLineFill oceanHidden - - -" Third-party plugins {{{2 - -hi! link YankRoundRegion oceanUiSelection - -hi! link OperatorSandwichAdd oceanUiSelection -hi! link OperatorSandwichBuns oceanUiSelection -hi! link OperatorSandwichChange oceanUiSelection -hi! link OperatorSandwichDelete oceanUiSelection - -hi! link EasyMotionMoveHL oceanSearch -hi! link EasyMotionTarget oceanUiTarget - - -" File types {{{2 - -" c {{{3 - -hi! link cOctalZero oceanConstant - -" cpp {{{3 - -hi! link cppRawStringDelimiter oceanSyntaxString - -" html {{{3 - -hi! link htmlEndTag oceanSyntaxStatement2 -hi! link htmlTag oceanSyntaxStatement2 -hi! link htmlTagName oceanSyntaxStatement2 - -" php {{{3 - -hi! link phpParent oceanNormal -hi! link phpOperator oceanNormal -hi! link phpRelation oceanNormal -hi! link phpDocTags oceanSyntaxCommentSpecial -hi! link phpSpecialFunction oceanSyntaxIdentifier - -" ruby {{{3 - -hi! link rubyDataDirective oceanSyntaxStatement2 -hi! link rubyStringDelimiter oceanSyntaxString - - - - - -" sh {{{3 - -hi! link shQuote oceanSyntaxString -hi! link shDerefSimple oceanSyntaxIdentifier -hi! link shDerefVar oceanSyntaxIdentifier - - - - - -" Utilities {{{1 - -command! -bar - \ OceanGetHighlightGroupName - \ echo synIDattr(synID(line('.'), col('.'), v:false), 'name') diff --git a/.config/vim/my/plugin/autosave.vim b/.config/vim/my/plugin/autosave.vim deleted file mode 100644 index 6339dcb..0000000 --- a/.config/vim/my/plugin/autosave.vim +++ /dev/null @@ -1,29 +0,0 @@ -scriptencoding utf-8 - -if exists('g:loaded_autosave') - finish -endif - - - -command! -bar - \ AutosaveEnable - \ call autosave#enable() - - -command! -bar - \ AutosaveDisable - \ call autosave#disable() - - -command! -bar - \ AutosaveToggle - \ if exists('b:autosave_timer') | - \ call autosave#disable() | - \ else | - \ call autosave#enable() | - \ endif - - - -let g:loaded_autosave = 1 diff --git a/.config/vim/my/plugin/dummy.vim b/.config/vim/my/plugin/dummy.vim deleted file mode 100644 index ce7b901..0000000 --- a/.config/vim/my/plugin/dummy.vim +++ /dev/null @@ -1,15 +0,0 @@ -scriptencoding utf-8 - -if exists('g:loaded_dummy') - finish -endif - - - -command! -bar -complete=customlist,dummy#complete -nargs=1 - \ Dummy - \ call dummy#insert() - - - -let g:loaded_dummy = 1 diff --git a/.config/vim/my/syntax/gitcommit.vim b/.config/vim/my/syntax/gitcommit.vim deleted file mode 100644 index 14232a2..0000000 --- a/.config/vim/my/syntax/gitcommit.vim +++ /dev/null @@ -1,96 +0,0 @@ -" Vim syntax file -" Language: git commit file -" Maintainer: Tim Pope -" Filenames: *.git/COMMIT_EDITMSG -" Last Change: 2019 Dec 05 -" -" Modified By: nsfisis -" Changed comment char from '#' (git default) to ';'. - -if exists("b:current_syntax") - finish -endif - -syn case match -syn sync minlines=50 - -if has("spell") - syn spell toplevel -endif - -syn include @gitcommitDiff syntax/diff.vim -syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff - -syn match gitcommitSummary "^.*\%<51v." contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell -syn match gitcommitOverflow ".*" contained contains=@Spell -syn match gitcommitBlank "^[^;].*" contained contains=@Spell - -if get(g:, "gitcommit_cleanup") is# "scissors" - syn match gitcommitFirstLine "\%^.*" nextgroup=gitcommitBlank skipnl - syn region gitcommitComment start=/^; -\+ >8 -\+$/ end=/\%$/ contains=gitcommitDiff -else - syn match gitcommitFirstLine "\%^[^;].*" nextgroup=gitcommitBlank skipnl - syn match gitcommitComment "^;.*" -endif - -syn match gitcommitHead "^\%(; .*\n\)\+;$" contained transparent -syn match gitcommitOnBranch "\%(^; \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite -syn match gitcommitOnBranch "\%(^; \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite -syn match gitcommitBranch "[^ ']\+" contained -syn match gitcommitNoBranch "\%(^; \)\@<=Not currently on any branch." contained containedin=gitcommitComment -syn match gitcommitHeader "\%(^; \)\@<=.*:$" contained containedin=gitcommitComment -syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^; \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent -syn match gitcommitNoChanges "\%(^; \)\@<=No changes$" contained containedin=gitcommitComment - -syn region gitcommitUntracked start=/^; Untracked files:/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold -syn match gitcommitUntrackedFile "\t\@<=.*" contained - -syn region gitcommitDiscarded start=/^; Change\%(s not staged for commit\|d but not updated\):/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold -syn region gitcommitSelected start=/^; Changes to be committed:/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold -syn region gitcommitUnmerged start=/^; Unmerged paths:/ end=/^;$\|^;\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold - - -syn match gitcommitDiscardedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite -syn match gitcommitSelectedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite -syn match gitcommitUnmergedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite -syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow -syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow -syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow -syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile -syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile -syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile - -syn match gitcommitWarning "\%^[^;].*: needs merge$" nextgroup=gitcommitWarning skipnl -syn match gitcommitWarning "^[^;].*: needs merge$" nextgroup=gitcommitWarning skipnl contained -syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$" - -hi def link gitcommitSummary Keyword -hi def link gitcommitComment Comment -hi def link gitcommitUntracked gitcommitComment -hi def link gitcommitDiscarded gitcommitComment -hi def link gitcommitSelected gitcommitComment -hi def link gitcommitUnmerged gitcommitComment -hi def link gitcommitOnBranch Comment -hi def link gitcommitBranch Special -hi def link gitcommitNoBranch gitCommitBranch -hi def link gitcommitDiscardedType gitcommitType -hi def link gitcommitSelectedType gitcommitType -hi def link gitcommitUnmergedType gitcommitType -hi def link gitcommitType Type -hi def link gitcommitNoChanges gitcommitHeader -hi def link gitcommitHeader PreProc -hi def link gitcommitUntrackedFile gitcommitFile -hi def link gitcommitDiscardedFile gitcommitFile -hi def link gitcommitSelectedFile gitcommitFile -hi def link gitcommitUnmergedFile gitcommitFile -hi def link gitcommitFile Constant -hi def link gitcommitDiscardedArrow gitcommitArrow -hi def link gitcommitSelectedArrow gitcommitArrow -hi def link gitcommitUnmergedArrow gitcommitArrow -hi def link gitcommitArrow gitcommitComment -"hi def link gitcommitOverflow Error -hi def link gitcommitBlank Error - -hi def link gitcommitIssue Constant - -let b:current_syntax = "gitcommit" diff --git a/.gitignore b/.gitignore index ee53bdc..bd0ad04 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ /.config/vim/autoload/plug.vim /.config/emacs -vim-startup.log nvim-startup.log diff --git a/.vimrc b/.vimrc index bafac8b..63bbd2e 100644 --- a/.vimrc +++ b/.vimrc @@ -1,109 +1,41 @@ -" Set Vim's internal encodding. -" Note: This option must be set before 'scriptencoding' is set. set encoding=utf-8 -" Set this file's encoding. scriptencoding utf-8 -" Global settings {{{1 - -" Global constants {{{2 - -let g:MY_ENV = {} - -if has('unix') - let g:MY_ENV.os = 'unix' -elseif has('mac') - let g:MY_ENV.os = 'mac' -elseif has('wsl') - let g:MY_ENV.os = 'wsl' -elseif has('win32') || has('win64') - let g:MY_ENV.os = 'windows' -else - let g:MY_ENV.os = 'unknown' -endif - -if empty($XDG_CONFIG_HOME) - let g:MY_ENV.config_home = $HOME . '/.config' -else - let g:MY_ENV.config_home = $XDG_CONFIG_HOME -endif -if empty($XDG_CACHE_HOME) - let g:MY_ENV.cache_home = $HOME . '/.cache' -else - let g:MY_ENV.cache_home = $XDG_CONFIG_HOME -endif if empty($XDG_DATA_HOME) - let g:MY_ENV.data_home = $HOME . '/.local/share' + let s:data_home = $HOME . '/.local/share' else - let g:MY_ENV.data_home = $XDG_DATA_HOME + let s:data_home = $XDG_DATA_HOME endif -let g:MY_ENV.config_dir = g:MY_ENV.config_home . '/vim' -let g:MY_ENV.cache_dir = g:MY_ENV.cache_home . '/vim' -let g:MY_ENV.data_dir = g:MY_ENV.data_home . '/vim' - -let g:MY_ENV.my_dir = g:MY_ENV.config_dir . '/my' -let g:MY_ENV.plug_dir = g:MY_ENV.data_dir . '/plugged' -let g:MY_ENV.undo_dir = g:MY_ENV.data_dir . '/undo' -let g:MY_ENV.backup_dir = g:MY_ENV.data_dir . '/backup' -let g:MY_ENV.swap_dir = g:MY_ENV.data_dir . '/swap' -let g:MY_ENV.vimindo = g:MY_ENV.data_dir . '/viminfo' -let g:MY_ENV.yankround_dir = g:MY_ENV.data_dir . '/yankround' -let g:MY_ENV.skk_dir = g:MY_ENV.config_home . '/skk' +let s:my_env = { + \ 'backup_dir': s:data_home . '/vim/backup', + \ 'swap_dir': s:data_home . '/vim/swap', + \ 'undo_dir': s:data_home . '/vim/undo', + \ 'viminfo': s:data_home . '/vim/viminfo', + \ } -for [s:k, s:v] in items(g:MY_ENV) +for [s:k, s:v] in items(s:my_env) if s:k =~# '_dir$' && !isdirectory(s:v) call mkdir(s:v, 'p') endif endfor -unlet s:k s:v - - - - -" The autogroup used in .vimrc {{{2 +unlet s:k s:v s:data_home -augroup Vimrc - autocmd! -augroup END - - -" Note: |:autocmd| does not accept |-bar|. -command! -nargs=* - \ Autocmd - \ autocmd Vimrc - - - -" Language {{{2 -" Disable L10N. language messages C language time C +syntax on +filetype plugin indent on - -" Options {{{1 - -" * Use |:set|, not |:setglobal|. -" |:setglobal| does not set local options, so options are not set in -" the starting buffer you specified as commandline arguments like -" "$ vim ~/.vimrc". - -" Moving around, searching and patterns {{{2 - set nowrapscan set incsearch set ignorecase set smartcase - - -" Displaying text {{{2 - set scrolloff=7 set wrap set linebreak @@ -113,59 +45,26 @@ let &showbreak = '> ' set sidescrolloff=20 set display=lastline let &fillchars = 'vert: ,fold: ,diff: ' -set cmdheight=2 set list -let &listchars = "eol:\u00ac,tab:\u25b8 ,trail:\u00b7,extends:\u00bb,precedes:\u00ab" +let &listchars = "eol: ,tab:> ,trail:^,extends:>,precedes:<" set concealcursor=cnv - - -" Syntax, highlighting and spelling {{{2 - -set background=dark set synmaxcol=500 set hlsearch -" Execute nohlsearch to avoid highlighting last searched pattern when reloading -" .vimrc. -nohlsearch -if exists('+termguicolors') - let &t_8f="\[38;2;%lu;%lu;%lum" - let &t_8b="\[48;2;%lu;%lu;%lum" - set termguicolors -endif set t_Co=256 set colorcolumn=+1 - -" Multiple windows {{{2 - set laststatus=2 set winminheight=0 set hidden set switchbuf=usetab - - -" Multiple tabpages {{{2 - -set showtabline=2 - - - -" Terminal {{{2 +set showtabline=1 set notitle - - -" Using the mouse {{{2 - set mouse= - - -" Messages and info {{{2 - set shortmess+=a set shortmess+=s set shortmess+=I @@ -176,18 +75,10 @@ set report=999 set confirm set belloff=all - - -" Selecting text {{{2 - set clipboard=unnamed - - -" Editing text {{{2 - set undofile -let &undodir = g:MY_ENV.undo_dir +let &undodir = s:my_env.undo_dir set textwidth=0 set backspace=indent,eol,start set completeopt-=preview @@ -198,12 +89,6 @@ set nojoinspaces set nrformats-=octal set nrformats+=unsigned - - -" Tabs and indenting {{{2 -" Note: you should also set them for each file types. -" These following settings are global, used for unknown file types. - set tabstop=4 set shiftwidth=4 set smarttab @@ -214,471 +99,81 @@ set smartindent set copyindent set preserveindent - - -" Folding {{{2 - set foldlevelstart=0 set foldopen+=insert set foldmethod=marker - - -" Diff mode {{{2 - set diffopt+=vertical - \ diffopt+=foldcolumn:3 - - - -" Mapping {{{2 +set diffopt+=foldcolumn:3 set maxmapdepth=10 set notimeout set ttimeout set ttimeoutlen=100 - - -" Reading and writing files {{{2 - set nofixendofline -" Note: if 'fileformat' is empty, the first item of 'fileformats' is used. set fileformats=unix,dos -" Note: these settings make one backup. If you want more backups, see -" |'backupext'|. set backup -let &backupdir = g:MY_ENV.backup_dir +let &backupdir = s:my_env.backup_dir set autowrite set autoread +let &directory = s:my_env.swap_dir . '//' - -" The swap file {{{2 - -" Note: 'dictionary' is swap files' directory. -" '//' is converted to swap file's path. -" If you are editing 'a/b.vim', Vim makes '{g:MY_ENV.swap_dir}/a/b.vim'. -let &directory = g:MY_ENV.swap_dir . '//' - - - -" Command line editing {{{2 set history=2000 set wildignore+=*.o,*.obj,*.lib set wildignorecase set wildmenu - - -" Executing external commands {{{2 - set shell=zsh set keywordprg= - - -" Encoding {{{2 - -" Note: if 'fileencoding' is empty, 'encoding' is used. set fileencodings=utf-8,cp932,euc-jp - - -" Misc. {{{2 - set sessionoptions+=localoptions set sessionoptions+=resize set sessionoptions+=winpos -let &viminfofile = g:MY_ENV.vimindo - - - -" Installed plugins {{{1 - -" === BEGIN === {{{2 - -execute 'set runtimepath+=' . g:MY_ENV.config_dir -call plug#begin(g:MY_ENV.plug_dir) - - -" Text editing {{{2 - -" IME {{{3 - -" SKK (Simple Kana to Kanji conversion program) for Vim. -Plug 'vim-skk/eskk.vim' - -" Operators {{{3 - -" Support for user-defined operators. -Plug 'kana/vim-operator-user' - -" Extract expression and make assingment statement. -Plug 'tek/vim-operator-assign' - -" Replace text without updating registers. -Plug 'kana/vim-operator-replace' - -" Reverse text. -Plug 'tyru/operator-reverse.vim' - -" Search in a specific region. -Plug 'osyo-manga/vim-operator-search' - -" Shiffle text. -Plug 'pekepeke/vim-operator-shuffle' - -" Sort text characterwise and linewise. -Plug 'emonkak/vim-operator-sort' - -" Super surround. -Plug 'machakann/vim-sandwich' - -" Non-operators {{{3 - -" Comment out. -Plug 'tyru/caw.vim' - -" Align text. -Plug 'junegunn/vim-easy-align', { 'on': '(EasyAlign)' } - - -" Text objects {{{2 - -" Support for user-defined text objects. -Plug 'kana/vim-textobj-user' - -" Text object for blockwise. -Plug 'osyo-manga/vim-textobj-blockwise' - -" Text object for comment. -Plug 'thinca/vim-textobj-comment' - -" Text object for continuous line. -Plug 'rhysd/vim-textobj-continuous-line' - -" Text object for entire file. -Plug 'kana/vim-textobj-entire' - -" Text object for function. -Plug 'kana/vim-textobj-function' - -" Text object for indent. -Plug 'kana/vim-textobj-indent' - -" Text object for last inserted text. -Plug 'rhysd/vim-textobj-lastinserted' - -" Text object for last pasted text. -Plug 'gilligan/textobj-lastpaste' - -" Text object for last searched pattern. -Plug 'kana/vim-textobj-lastpat' - -" Text object for line. -Plug 'kana/vim-textobj-line' - -" Text object for parameter. -Plug 'sgur/vim-textobj-parameter' - -" Text object for space. -Plug 'saihoooooooo/vim-textobj-space' - -" Text object for syntax. -Plug 'kana/vim-textobj-syntax' - -" Text object for URL. -Plug 'mattn/vim-textobj-url' - -" Text object for words in words. -Plug 'h1mesuke/textobj-wiw' - - -" Search {{{2 - -" Extend * and #. -Plug 'haya14busa/vim-asterisk' - -" Extend incremental search. -Plug 'haya14busa/incsearch.vim' +let &viminfofile = s:my_env.viminfo -" NOTE: it is a fork version of jremmen/vim-ripgrep -" Integration with ripgrep, fast alternative of grep command. -Plug 'nsfisis/vim-ripgrep', { 'on': 'Rg' } +augroup Vimrc + autocmd! +augroup END -" Files {{{2 - -" Switch to related files. -Plug 'kana/vim-altr' - -" Fast Fuzzy Finder. -Plug 'ctrlpvim/ctrlp.vim', { 'on': '(ctrlp)' } - -" CtrlP's matcher by builtin `matchfuzzy()`. -Plug 'mattn/ctrlp-matchfuzzy', { 'on': '(ctrlp)' } - -" Filer for minimalists. -Plug 'justinmk/vim-dirvish' - - -" Appearance {{{2 - -" Show highlight. -Plug 'cocopon/colorswatch.vim', { 'on': 'ColorSwatchGenerate' } - -" NOTE: it is a fork of godlygeek/csapprox -" Make gui-only color schemes 256colors-compatible. -Plug 'nsfisis/csapprox' - -" Makes folding text cool. -Plug 'LeafCage/foldCC.vim' - -" Show indent. -Plug 'Yggdroot/indentLine' - -" Highlight matched parentheses. -Plug 'itchyny/vim-parenmatch' - -" Highlight specified words. -Plug 't9md/vim-quickhl', { 'on': [ 'QuickhlManualReset', '(quickhl-manual-this)'] } - - -" Filetypes {{{2 - -" Syntax {{{3 - -" HCL -Plug 'b4b4r07/vim-hcl' - -" JavaScript -Plug 'pangloss/vim-javascript', { 'for': 'javascript' } - -" JSON5 -Plug 'GutenYe/json5.vim' - -" MoonScript -Plug 'leafo/moonscript-vim' - -" Nginx conf -Plug 'chr4/nginx.vim' - -" Rust -Plug 'rust-lang/rust.vim', { 'for': 'rust' } - -" TOML -Plug 'cespare/vim-toml', { 'for': 'toml' } - -" TypeScript -Plug 'leafgarland/typescript-vim', { 'for': 'typescript' } - -" Tools {{{3 - -" C/C++: clang-format -Plug 'rhysd/vim-clang-format', { 'for': ['c', 'cpp'] } - -" Python: autopep8 -Plug 'tell-k/vim-autopep8', { 'for': 'python' } - - -" QoL {{{2 - -" If a directory is missing, make it automatically. -Plug 'mopp/autodirmake.vim' - -" Capture the output of a command. -Plug 'tyru/capture.vim' - -" Write git commit message. -Plug 'rhysd/committia.vim' - -" Motion on speed. -Plug 'easymotion/vim-easymotion', { 'on': [ - \ '(easymotion-Fl)', - \ '(easymotion-N)', - \ '(easymotion-Tl)', - \ '(easymotion-bd-w)', - \ '(easymotion-fl)', - \ '(easymotion-j)', - \ '(easymotion-k)', - \ '(easymotion-n)', - \ '(easymotion-s2)', - \ '(easymotion-tl)', - \ ] } - -" Integration with EditorConfig (https://editorconfig.org) -Plug 'editorconfig/editorconfig-vim' - -" Extend J. -Plug 'osyo-manga/vim-jplus' - -" Improve behaviors of I, A and gI in Blockwise-Visual mode. -Plug 'kana/vim-niceblock' - -" Edit QuickFix and reflect to original buffers. -Plug 'thinca/vim-qfreplace' - -" Run anything. -Plug 'thinca/vim-quickrun' - -" Extend dot-repeat. -Plug 'tpope/vim-repeat' - -" Split one line format and Join multiline format. -Plug 'AndrewRadev/splitjoin.vim' - -" Introduce user-defined mode. -Plug 'kana/vim-submode' - -" Swap arguments. -Plug 'machakann/vim-swap' - -" Adjust window size. -Plug 'rhysd/vim-window-adjuster' - -" Remember yank history and paste them. -Plug 'LeafCage/yankround.vim' - - -" === END === {{{2 - -Plug g:MY_ENV.my_dir - -call plug#end() - - - - -" Autocommands {{{1 - -" Auto-resize windows when Vim is resized. -Autocmd VimResized * wincmd = - - -" Calculate 'numberwidth' to fit file size. -" Note: extra 2 is the room of left and right spaces. -Autocmd BufEnter,WinEnter,BufWinEnter * - \ let &l:numberwidth = len(line('$')) + 2 - +autocmd Vimrc VimResized * wincmd = -" Jump to the last cursor position when you open a file. -Autocmd BufRead * +autocmd Vimrc BufRead * \ if 0 < line("'\"") && line("'\"") <= line('$') && \ &filetype !~# 'commit' && &filetype !~# 'rebase' | \ execute "normal g`\"" | \ endif -" Syntax highlight for .vimrc {{{2 - -Autocmd Filetype vim - \ if expand('%') =~? 'vimrc' || expand('%') =~? 'init.vim' | - \ call s:highlight_vimrc() | - \ endif - - -function! s:highlight_vimrc() abort - " Autocmd - syn keyword vimrcAutocmd Autocmd skipwhite nextgroup=vimAutoEventList - - " Plugin manager command - syn keyword vimrcPluginManager Plug - - hi def link vimrcAutocmd vimAutocmd - hi def link vimrcPluginManager vimCommand -endfunction - - - - -" Mappings {{{1 - -" Note: |:noremap| defines mappings in |Normal|, |Visual|, |Operator-Pending| -" and |Select| mode. Because I don't use |Select| mode, I use |:noremap| as -" substitute of |:nnoremap|, |:xnoremap| and |:onoremap| for simplicity. - - -" Fix the search direction. {{{2 - noremap gn v:searchforward ? 'gn' : 'gN' noremap gN v:searchforward ? 'gN' : 'gn' - noremap n v:searchforward ? 'n' : 'N' noremap N v:searchforward ? 'N' : 'n' - - nnoremap & :%&& xnoremap & :%&& - - -" Registers and macros. {{{2 - - -" Access an resister in the same way in Insert and Commandline mode. nnoremap " xnoremap " - -" Paste clipboard content with 'paste' enabled -function! s:paste_clipboard_content_with_paste_opt() abort - let old_paste = &paste - set paste - set pastetoggle=(pastetoggle) - if old_paste - return "\+" - else - " 'paste' was off when the function was called. Then, 'paste' will be - " disabled via 'pastetoggle'. - return "\+\(pastetoggle)" - endif -endfunction - -" Automatically enable 'paste' and disable it after pasting clipboard's -" content. -inoremap + paste_clipboard_content_with_paste_opt() - - let @j = 'j.' let @k = 'k.' let @n = 'n.' nnoremap @N N. - -" Repeat the last executed macro as many times as possible. -" a => all -" Note: "let @a = '@@'" does not work well. nnoremap @a 9999@@ - - -" Execute the last executed macro again. nnoremap ` @@ - - -" Emacs like key mappings in Insert and CommandLine mode. {{{2 - -function! s:go_to_beginning_of_line() abort - if col('.') == match(getline('.'), '\S') + 1 - return repeat("\U\", col('.') - 1) - else - return (col('.') < match(getline('.'), '\S')) ? - \ repeat("\U\", match(getline('.'), '\S') - col('.') + 1) : - \ repeat("\U\", col('.') - 1 - match(getline('.'), '\S')) - endif -endfunction - - inoremap -" Go elsewhere without deviding the undo history. -inoremap go_to_beginning_of_line() -inoremap repeat('U', col('$') - col('.')) +inoremap repeat("\U\", col('.') - 1) +inoremap repeat("\U\", col('$') - col('.')) inoremap U inoremap U -" Delete something deviding the undo history. inoremap u inoremap u @@ -695,51 +190,13 @@ inoremap cnoremap inoremap - - - -function! s:my_gA() - let line = getline('.') - if match(line, ';;$') != -1 " For OCaml. - return "A\U\\U\" - elseif match(line, '[,;)]$') != -1 - return "A\U\" - else - return 'A' - endif -endfunction - -nnoremap gA my_gA() - - - -" QuickFix or location list. {{{2 - -nnoremap bb :cc - -nnoremap bn :=v:count1cnext -nnoremap bp :=v:count1cprevious - -nnoremap bf :cfirst -nnoremap bl :clast - -nnoremap bS :colder -nnoremap bs :cnewer - - - -" Operators {{{2 - -" Throw deleted text into the black hole register ("_). nnoremap c "_c xnoremap c "_c nnoremap C "_C xnoremap C "_C - noremap g= = - noremap ml gu noremap mu gU @@ -748,31 +205,18 @@ noremap gU xnoremap u xnoremap U - xnoremap x "_x - nnoremap Y y$ -" In Blockwise-Visual mode, select text linewise. -" By default, select text characterwise, neither blockwise nor linewise. xnoremap Y mode() ==# 'V' ? 'y' : 'Vy' - - -" Swap the keys entering Replace mode and Visual-Replace mode. nnoremap R gR nnoremap gR R nnoremap r gr nnoremap gr r - nnoremap U - - - -" Motions {{{2 - noremap H ^ noremap L $ noremap M % @@ -787,110 +231,13 @@ noremap gj j nnoremap gff gF +nnoremap tt :tabnew +nnoremap tn :=(tabpagenr() + v:count1 - 1) % tabpagenr('$') + 1tabnext +nnoremap tp :=(tabpagenr('$') * 10 + tabpagenr() - v:count1 - 1) % tabpagenr('$') + 1tabnext -" Tabpages and windows. {{{2 - -function! s:move_current_window_to_tabpage() abort - if winnr('$') == 1 - " Leave the current window and open it in a new tabpage. - " Because :wincmd T fails when the current tabpage has only one window. - tab split - else - " Close the current window and re-open it in a new tabpage. - wincmd T - endif -endfunction - - -function! s:bdelete_bang_with_confirm() abort - if s:getchar_with_prompt('Delete? (y/n) ') ==? 'y' - bdelete! - else - echo 'Canceled' - endif -endfunction - - -function! s:choose_window_interactively() abort - const indicators = [ - \ 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ';', - \ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', - \ ] - - " List normal windows up to 20. - let wins = [] - for winnr in range(1, winnr('$')) - if winnr !=# winnr() && win_gettype(winnr) ==# '' - call add(wins, win_getid(winnr)) - endif - endfor - if len(indicators) < len(wins) - unlet wins[len(indicators):] - endif - - if len(wins) ==# 0 - return - endif - if len(wins) ==# 1 - if wins[0] ==# win_getid() - call win_gotoid(wins[1]) - else - call win_gotoid(wins[0]) - endif - return - endif - - " Show popups. - let popups = [] - for i in range(len(wins)) - let winid = wins[i] - let indicator = indicators[i] - let [winy, winx, winh, winw] = s:win_getrect(winid) - let popup = popup_create(indicator, #{ - \ line: winy + (winh - 3) / 2, - \ col: winx + (winw - 7) / 2, - \ drag: v:false, - \ resize: v:false, - \ padding: [1, 3, 1, 3], - \ border: [0, 0, 0, 0], - \ }) - call add(popups, #{ - \ winid: popup, - \ indicator: indicator, - \ target_winid: winid, - \ }) - endfor - - " Prompt - let result = s:getchar_with_prompt('Select window: ') - - " Jump - let jump_target = -1 - for popup in popups - if result ==? popup.indicator - let jump_target = popup.target_winid - endif - endfor - if jump_target !=# -1 - call win_gotoid(jump_target) - endif - - " Close popups - for popup in popups - call popup_close(popup.winid) - endfor -endfunction - - -nnoremap tt :tabnew -nnoremap tT :call move_current_window_to_tabpage() - -nnoremap tn :=(tabpagenr() + v:count1 - 1) % tabpagenr('$') + 1tabnext -nnoremap tp :=(tabpagenr('$') * 10 + tabpagenr() - v:count1 - 1) % tabpagenr('$') + 1tabnext - -nnoremap tN :tabmove + -nnoremap tP :tabmove - +nnoremap tN :tabmove + +nnoremap tP :tabmove - nnoremap tsh :leftabove vsplit nnoremap tsj :rightbelow split @@ -924,8 +271,6 @@ nnoremap tL L nnoremap tx x -" r => manual resize. -" R => automatic resize. nnoremap tRH _ nnoremap tRW nnoremap tRR _ @@ -933,126 +278,26 @@ nnoremap tRR _ nnoremap t= = nnoremap tq :bdelete -nnoremap tQ :call bdelete_bang_with_confirm() nnoremap tc c nnoremap to o nnoremap tO :tabonly -if has('popupwin') - nnoremap tg :call choose_window_interactively() -endif - - - -function! s:smart_open(command) abort - if winwidth(winnr()) < 150 - let modifiers = 'topleft' - else - let modifiers = 'vertical botright' - endif - - try - execute modifiers a:command - catch - echohl Error - echo v:exception - echohl None - return - endtry - - if &filetype ==# 'help' - if &l:textwidth > 0 - execute 'vertical resize' &l:textwidth - endif - " Help tags are often right-justfied, moving the cursor to BoL. - normal! 0 - endif -endfunction - - -command! -nargs=+ -complete=command - \ SmartOpen - \ call s:smart_open() - - - - -" Increment/decrement numbers {{{2 - -" nnoremap + -" nnoremap - -" xnoremap + -" xnoremap - -" xnoremap g+ g -" xnoremap g- g - - - -" Disable unuseful or dangerous mappings. {{{2 - -" Disable Select mode. nnoremap gh nnoremap gH nnoremap g -" Disable Ex mode. nnoremap Q nnoremap gQ nnoremap ZZ nnoremap ZQ - -" Help {{{2 - -" Search help. -nnoremap :SmartOpen help - - - -" For writing Vim script. {{{2 - - -if !v:vim_did_enter - " Define this function only when Vim is starting up. |v:vim_did_enter| - function! SourceThisFile() abort - let filename = expand('%') - if &filetype ==# 'vim' || expand('%:e') ==# 'vim' || filename =~# '\.g\?vimrc' - if &filetype !=# 'vim' - setfiletype vim - endif - update - unlet! g:loaded_{expand('%<')} - source % - else - echo filename ' is not a Vim Script.' - endif - endfunction -endif - - - -nnoremap XV :tabedit $MYVIMRC - -nnoremap XX :call SourceThisFile() - -" See |numbered-function|. -nnoremap XF :function {=v:count} - -nnoremap XM :messages - -nnoremap XP :call popup_clear(1) - - - - -" Misc. {{{2 +nnoremap :help onoremap gv :normal! gv -" Swap : and ;. nnoremap ; : nnoremap : ; xnoremap ; : @@ -1062,970 +307,21 @@ xnoremap @; @: cnoremap ; : inoremap ; : - -" Since may be mapped to something else somewhere, it should be :map, not -" :noremap. imap jk cmap jk - - nnoremap :nohlsearch - - -nnoremap (my-insert-blank-lines-after) - \ :call insert_blank_line(0) -nnoremap (my-insert-blank-lines-before) - \ :call insert_blank_line(1) - -nmap go (my-insert-blank-lines-after) -nmap gO (my-insert-blank-lines-before) - -function! s:insert_blank_line(offset) abort - for i in range(v:count1) - call append(line('.') - a:offset, '') - endfor -endfunction - - nnoremap w :write -" Abbreviations {{{1 - inoreabbrev retrun return inoreabbrev reutrn return inoreabbrev tihs this +set background=dark +colorscheme desert - -" Commands {{{1 - -" Set 'makeprg' to `ninja` if `build.ninja` exists in the current working -" directory. Then, execute :make command. -command! -bang -bar -nargs=* - \ Make - \ if filereadable('build.ninja') | - \ let &makeprg = 'ninja' | - \ endif | - \ make - - -" Reverse a selected range in line-wise. -" Note: directly calling `g/^/m` will overwrite the current search pattern with -" '^' and highlight it, which is not expected. -" :h :keeppatterns -command! -bar -range=% - \ Reverse - \ keeppatterns ,g/^/m-1 - - -function! s:dummy_man_command(mods, args) abort - " Delete the dummy command. - delcommand Man - " Load man.vim which defines |:Man|. - runtime ftplugin/man.vim - " Pass the given arguments to it. - execute printf("%s Man %s", a:mods, a:args) -endfunction - - -" To shorten Vim startup, lazily load ftplugin/man.vim. -command! -complete=shellcmd -nargs=+ - \ Man - \ call s:dummy_man_command(, ) - - - - -" ftplugin {{{1 - -" This command do the followings: -" * Execute |:setlocal| for each options. -" * Set information to restore the original setting to b:|undo_ftplugin|. - -" This command is used in ftplugin/*.vim. - -" Note: specify only single option. - -command! -nargs=+ - \ FtpluginSetLocal - \ call s:ftplugin_setlocal() - -function! s:ftplugin_setlocal(qargs) abort - execute 'setlocal' a:qargs - - let option_name = substitute(a:qargs, '\L.*', '', '') - - if option_name ==# 'shiftwidth' && exists(':IndentLinesReset') ==# 2 - IndentLinesReset - endif - - if exists('b:undo_ftplugin') - let b:undo_ftplugin .= '|setlocal ' . option_name . '<' - else - let b:undo_ftplugin = 'setlocal ' . option_name . '<' - endif -endfunction - - - - -" Appearance {{{1 - -" Color scheme {{{2 - -try - colorscheme ocean -catch - " Loading colorscheme failed. - " The color scheme, "desert", is one of the built-in ones. Probably, it - " will be loaded without any errors. - colorscheme desert -endtry - - - -" Statusline {{{2 - -set statusline=%!Statusline_build() - -function! Statusline_build() abort - let winid = g:statusline_winid - let bufnr = winbufnr(winid) - let is_active = winid ==# win_getid() - if is_active - let [mode, mode_hl] = s:statusline_mode() - let left = printf('%%#statusLineMode%s# %s %%#StatusLine#', mode_hl, mode) - else - let left = '' - endif - let ro = s:statusline_readonly(bufnr) - let fname = s:statusline_filename(bufnr) - let mod = s:statusline_modified(bufnr) - let linenum = s:statusline_linenum(winid) - let fenc = s:statusline_fenc(bufnr) - let ff = s:statusline_ff(bufnr) - let ft = s:statusline_filetype(bufnr) - return printf( - \ '%s %s%s%s %%= %s %s%s %s ', - \ left, - \ empty(ro) ? '' : ro . ' ', - \ fname, - \ empty(mod) ? '' : ' ' . mod, - \ linenum, - \ fenc, - \ ff, - \ ft) -endfunction - -function! s:statusline_mode() abort - const mode_map = { - \ 'n': ['N', 'Normal'], - \ 'no': ['O', 'Operator'], - \ 'nov': ['Oc', 'Operator'], - \ 'noV': ['Ol', 'Operator'], - \ "no\": ['Ob', 'Operator'], - \ 'niI': ['In', 'Insert'], - \ 'niR': ['Rn', 'Replace'], - \ 'niV': ['Rn', 'Replace'], - \ 'v': ['V', 'Visual'], - \ 'V': ['Vl', 'Visual'], - \ "\": ['Vb', 'Visual'], - \ 's': ['S', 'Visual'], - \ 'S': ['Sl', 'Visual'], - \ "\": ['Sb', 'Visual'], - \ 'i': ['I', 'Insert'], - \ 'ic': ['I?', 'Insert'], - \ 'ix': ['I?', 'Insert'], - \ 'R': ['R', 'Replace'], - \ 'Rc': ['R?', 'Replace'], - \ 'Rv': ['R', 'Replace'], - \ 'Rx': ['R?', 'Replace'], - \ 'c': ['C', 'Command'], - \ 'cv': ['C', 'Command'], - \ 'ce': ['C', 'Command'], - \ 'r': ['-', 'Other'], - \ 'rm': ['-', 'Other'], - \ 'r?': ['-', 'Other'], - \ '!': ['-', 'Other'], - \ 't': ['T', 'Terminal'], - \ } - let [vim_mode, hl] = get(mode_map, mode(v:true), ['-', 'Other']) - - " Calling `eskk#statusline()` makes Vim autoload eskk. If you call it - " without checking `g:loaded_autoload_eskk`, eskk is loaded on an early - " stage of the initialization (probably the first rendering of status line), - " which slows down Vim startup. Loading eskk can be delayed by checking both - " of `g:loaded_eskk` and `g:loaded_autoload_eskk`. - if exists('g:loaded_eskk') && exists('g:loaded_autoload_eskk') - let skk_mode = eskk#statusline(' (%s)', '') - else - let skk_mode = '' - endif - - return [vim_mode . skk_mode, hl] -endfunction - -function! s:statusline_readonly(bufnr) abort - let ro = getbufvar(a:bufnr, '&readonly') - return ro ? '[RO]' : '' -endfunction - -function! s:statusline_filename(bufnr) abort - let name = bufname(a:bufnr) - if empty(name) - return '[No Name]' - endif - - let other_paths = [] - for b in range(1, bufnr('$')) - if bufexists(b) && b !=# a:bufnr - call add(other_paths, split(bufname(b), '[\/]')) - endif - endfor - let this_path = split(name, '[\/]') - let i = -1 - while v:true - let this_path_part = get(this_path, i, '') - let unique = v:true - let no_parts_remained = v:true - for other_path in other_paths - let other_path_part = get(other_path, i, '') - if this_path_part ==? other_path_part - let unique = v:false - break - endif - if other_path_part !=# '' - let no_parts_remained = v:false - endif - endfor - if unique - break - endif - if this_path_part ==# '' && no_parts_remained - break - endif - let i -= 1 - endwhile - - let ret = '' - for k in range(i, -1) - if len(this_path) < -k - continue - endif - if k ==# i || k == -1 - let ret .= '/' . this_path[k] - else - let ret .= '/' . matchlist(this_path[k], '.')[0] - endif - endfor - return ret[1:-1] -endfunction - -function! s:statusline_modified(bufnr) abort - let mod = getbufvar(a:bufnr, '&modified') - let ma = getbufvar(a:bufnr, '&modifiable') - if mod - return '[+]' - elseif ma - return '' - else - return '[-]' - endif -endfunction - -function! s:statusline_linenum(winid) abort - return line('.', a:winid) . '/' . line('$', a:winid) -endfunction - -function! s:statusline_fenc(bufnr) abort - let fenc = getbufvar(a:bufnr, '&fileencoding') - let bom = getbufvar(a:bufnr, '&bomb') " BOMB!! - - if fenc ==# '' - let fencs = split(&fileencodings, ',') - let fenc = get(fencs, 0, &encoding) - endif - if fenc ==# 'utf-8' - return bom ? 'U8[BOM]' : 'U8' - elseif fenc ==# 'utf-16' - return 'U16[BE]' - elseif fenc ==# 'utf-16le' - return 'U16[LE]' - elseif fenc ==# 'ucs-4' - return 'U32[BE]' - elseif fenc ==# 'ucs-4le' - return 'U32[LE]' - else - return toupper(fenc) - endif -endfunction - -function! s:statusline_ff(bufnr) abort - let ff = getbufvar(a:bufnr, '&fileformat') - if ff ==# 'unix' - return '' - elseif ff ==# 'dos' - return ' (CRLF)' - elseif ff ==# 'mac' - return ' (CR)' - else - return ' (Unknown)' - endif -endfunction - -function! s:statusline_filetype(bufnr) abort - let ft = getbufvar(a:bufnr, '&filetype') - return empty(ft) ? '[None]' : ft -endfunction - - - -" Tabline {{{2 - -set tabline=%!Tabline_build() - -function! Tabline_build() abort - let tal = '' - for tabnr in range(1, tabpagenr('$')) - let is_active = tabnr ==# tabpagenr() - let buflist = tabpagebuflist(tabnr) - let bufnr = buflist[tabpagewinnr(tabnr) - 1] - let tal .= printf( - \ '%%#%s# %s ', - \ is_active ? 'TabLineSel' : 'TabLine', - \ s:statusline_filename(bufnr)) - endfor - return tal . '%#TabLineFill#' -endfunction - - -" Plugins configuration {{{1 - -" Disable standard plugins. {{{2 - -let g:loaded_2html_plugin = 1 -let g:loaded_getscriptPlugin = 1 -let g:loaded_gzip = 1 -let g:loaded_logiPat = 1 -let g:loaded_matchparen = 1 -let g:loaded_netrw = 1 -let g:loaded_netrwPlugin = 1 -let g:loaded_rrhelper = 1 -let g:loaded_spellfile_plugin = 1 -let g:loaded_tarPlugin = 1 -let g:loaded_vimballPlugin = 1 -let g:loaded_zipPlugin = 1 - - - -" altr {{{2 - -" For vim -call altr#define('autoload/%.vim', 'doc/%.txt', 'plugin/%.vim') -" For C and C++ -call altr#define('%.c', '%.cpp', '%.cc', '%.h', '%.hh', '%.hpp') - -" Go to File Alternative -nmap gfa (altr-forward) - - - - -" asterisk {{{2 - -function! s:asterisk(ret, keeppos) - let g:asterisk#keeppos = a:keeppos - return a:ret -endfunction - -" Do not keep the relative cursor position. -nmap * asterisk('(asterisk-z*)', 0) -omap * asterisk('(asterisk-z*)', 0) -xmap * asterisk('(asterisk-z*)', 0) -nmap g* asterisk('(asterisk-gz*)', 0) -omap g* asterisk('(asterisk-gz*)', 0) -xmap g* asterisk('(asterisk-gz*)', 0) - -" Keep the relative cursor position (use offset like /s+1). -" Note: I fix the search direction in typing 'n' and 'N', so there is no -" difference between '*' and '#'. -nmap # asterisk('(asterisk-z*)', 1) -omap # asterisk('(asterisk-z*)', 1) -xmap # asterisk('(asterisk-z*)', 1) -nmap g# asterisk('(asterisk-gz*)', 1) -omap g# asterisk('(asterisk-gz*)', 1) -xmap g# asterisk('(asterisk-gz*)', 1) - - - -" autodirmake {{{2 - -let g:autodirmake#msg_highlight = 'Question' - - - -" autopep8 {{{2 - -let g:autopep8_on_save = 1 -let g:autopep8_disable_show_diff = 1 - -command! - \ Autopep8Disable - \ let g:autopep8_on_save = 0 - - - -" caw {{{2 - -let g:caw_no_default_keymappings = 1 - -nmap m// (caw:hatpos:toggle) -xmap m// (caw:hatpos:toggle) -nmap m/w (caw:wrap:comment) -xmap m/w (caw:wrap:comment) -nmap m/W (caw:wrap:uncomment) -xmap m/W (caw:wrap:uncomment) -nmap m/b (caw:box:comment) -xmap m/b (caw:box:comment) - - - -" clang-format {{{2 - -let g:clang_format#auto_format = 1 -Autocmd FileType javascript ClangFormatAutoDisable -Autocmd FileType typescript ClangFormatAutoDisable - - - -" ctrlp {{{2 - -let g:ctrlp_map = 'f' -let g:ctrlp_match_func = {'match': 'ctrlp_matchfuzzy#matcher'} - - - -" dirvish {{{2 - -" Prevent dirvish from mapping hyphen key to "(dirvish_up)". -" nmap (nomap-dirvish_up) (dirvish_up) - - - -" easyalign {{{2 - -nmap = (EasyAlign) -xmap = (EasyAlign) - - - -" easymotion {{{2 - -let g:EasyMotion_keys = 'asdfghweryuiocvbnmjkl;' -let g:EasyMotion_space_jump_first = 1 -let g:EasyMotion_do_shade = 0 -let g:EasyMotion_do_mappings = 0 -let g:EasyMotion_smartcase = 1 -let g:EasyMotion_verbose = 0 -let g:EasyMotion_startofline = 0 - -nmap f (easymotion-fl) -omap f (easymotion-fl) -xmap f (easymotion-fl) -nmap F (easymotion-Fl) -omap F (easymotion-Fl) -xmap F (easymotion-Fl) -omap t (easymotion-tl) -xmap t (easymotion-tl) -omap T (easymotion-Tl) -xmap T (easymotion-Tl) - -" Note: Don't use the following key sequences! It is used 'vim-sandwich'. -" * sa -" * sd -" * sr -nmap ss (easymotion-s2) -omap ss (easymotion-s2) -xmap ss (easymotion-s2) -nmap sw (easymotion-bd-w) -omap sw (easymotion-bd-w) -xmap sw (easymotion-bd-w) -nmap sn (easymotion-n) -omap sn (easymotion-n) -xmap sn (easymotion-n) -nmap sN (easymotion-N) -omap sN (easymotion-N) -xmap sN (easymotion-N) -nmap sj (easymotion-j) -omap sj (easymotion-j) -xmap sj (easymotion-j) -nmap sk (easymotion-k) -omap sk (easymotion-k) -xmap sk (easymotion-k) - - - -" eskk {{{2 - -let g:eskk#dictionary = { - \ 'path': g:MY_ENV.skk_dir . '/jisyo', - \ 'sorted': 0, - \ 'encoding': 'utf-8', - \ } - -let g:eskk#large_dictionary = { - \ 'path': g:MY_ENV.skk_dir . '/jisyo.L', - \ 'sorted': 1, - \ 'encoding': 'euc-jp', - \ } - -let g:eskk#backup_dictionary = g:eskk#dictionary.path . ".bak" - -let g:eskk#kakutei_when_unique_candidate = v:true -let g:eskk#enable_completion = v:false -let g:eskk#egg_like_newline = v:true - -" Change default markers because they are EAW (East Asian Width) characters. -let g:eskk#marker_henkan = '[!]' -let g:eskk#marker_okuri = '-' -let g:eskk#marker_henkan_select = '[#]' -let g:eskk#marker_jisyo_touroku = '[?]' - - - -function! s:eskk_initialize_pre() abort - let t = eskk#table#new('rom_to_hira*', 'rom_to_hira') - call t.add_map('z ', ' ') - call t.add_map('0.', '0.') - call t.add_map('1.', '1.') - call t.add_map('2.', '2.') - call t.add_map('3.', '3.') - call t.add_map('4.', '4.') - call t.add_map('5.', '5.') - call t.add_map('6.', '6.') - call t.add_map('7.', '7.') - call t.add_map('8.', '8.') - call t.add_map('9.', '9.') - call eskk#register_mode_table('hira', t) -endfunction - - -Autocmd User eskk-initialize-pre call s:eskk_initialize_pre() - - -function! s:eskk_initialize_post() abort - " I don't use hankata mode for now. - EskkUnmap -type=mode:hira:toggle-hankata - EskkUnmap -type=mode:kata:toggle-hankata - - " I don't use abbrev mode for now. - EskkUnmap -type=mode:hira:to-abbrev - EskkUnmap -type=mode:kata:to-abbrev - - " I don't use ascii mode for now. - EskkUnmap -type=mode:hira:to-ascii - EskkUnmap -type=mode:kata:to-ascii - - " Instead, l key disable SKK input. - EskkMap -type=disable l - EskkMap -type=disable l - - " Custom highlight for henkan markers. - syntax match skkMarker '\[[!#?]\]' - hi link skkMarker Special -endfunction - - -Autocmd User eskk-initialize-post call s:eskk_initialize_post() - - - -" foldcc {{{2 - -set foldtext=FoldCCtext() -let g:foldCCtext_head = 'repeat(">", v:foldlevel) . " "' - - - -" incsearch {{{2 - -" let g:incsearch#magic = '\v' - -nmap / (incsearch-forward) -omap / (incsearch-forward) -xmap / (incsearch-forward) -nmap ? (incsearch-backward) -omap ? (incsearch-backward) -xmap ? (incsearch-backward) -nmap g/ (incsearch-stay) -omap g/ (incsearch-stay) -xmap g/ (incsearch-stay) - - - -" indentline {{{2 - -let g:indentLine_conceallevel = 1 -let g:indentLine_fileTypeExclude = ['help'] - - - -" jplus {{{2 - -let g:jplus#input_config = { - \ '__DEFAULT__': {'delimiter_format': ' %d '}, - \ '__EMPTY__': {'delimiter_format': ''}, - \ ' ': {'delimiter_format': ' '}, - \ ',': {'delimiter_format': '%d '}, - \ ';': {'delimiter_format': '%d '}, - \ 'l': {'delimiter_format': ''}, - \ 'L': {'delimiter_format': ''}, - \ } -nmap J (jplus-getchar) -xmap J (jplus-getchar) -nmap gJ (jplus-input) -xmap gJ (jplus-input) - - - - - -" vim-lsp {{{2 - -" TODO - - - -" niceblock {{{2 - -xmap I (niceblock-I) -xmap gI (niceblock-gI) -xmap A (niceblock-A) - - - - - - -" operator-replace {{{2 - -nmap (operator-replace) -omap (operator-replace) -xmap (operator-replace) - - - -" operator-search {{{2 - -" Note: m/ is the prefix of comment out. -nmap m? (operator-search) -omap m? (operator-search) -xmap m? (operator-search) - - - -" qfreplace {{{2 - -nnoremap br :Qfreplace SmartOpen - - - -" quickhl {{{2 - -" TODO: CUI -let g:quickhl_manual_colors = [ - \ 'guifg=#101020 guibg=#8080c0 gui=bold', - \ 'guifg=#101020 guibg=#80c080 gui=bold', - \ 'guifg=#101020 guibg=#c08080 gui=bold', - \ 'guifg=#101020 guibg=#80c0c0 gui=bold', - \ 'guifg=#101020 guibg=#c0c080 gui=bold', - \ 'guifg=#101020 guibg=#a0a0ff gui=bold', - \ 'guifg=#101020 guibg=#a0ffa0 gui=bold', - \ 'guifg=#101020 guibg=#ffa0a0 gui=bold', - \ 'guifg=#101020 guibg=#a0ffff gui=bold', - \ 'guifg=#101020 guibg=#ffffa0 gui=bold', - \ ] - -nmap " (quickhl-manual-this) -xmap " (quickhl-manual-this) -nnoremap :nohlsearch QuickhlManualReset - - - -" quickrun {{{2 - -let g:quickrun_no_default_key_mappings = 1 - -if !exists('g:quickrun_config') - let g:quickrun_config = {} -endif -let g:quickrun_config.cpp = { - \ 'cmdopt': '--std=c++17 -Wall -Wextra', - \ } -let g:quickrun_config.d = { - \ 'exec': 'dub run', - \ } -let g:quickrun_config.haskell = { - \ 'exec': ['stack build', 'stack exec %{matchstr(globpath(".,..,../..,../../..", "*.cabal"), "\\w\\+\\ze\\.cabal")}'], - \ } -let g:quickrun_config.python = { - \ 'command': 'python3', - \ } - - -nmap BB (quickrun) -xmap BB (quickrun) -" nnoremap BB make - - - - -" repeat {{{2 - -nmap U (RepeatRedo) -" Autoload vim-repeat immediately in order to make (RepeatRedo) available. -" repeat#setreg() does nothing here. -call repeat#setreg('', '') - - -" Make them repeatable with vim-repeat. -nnoremap (my-insert-blank-lines-after) - \ :call insert_blank_line(0) - \ silent! call repeat#set("\Plug>(my-insert-blank-lines-after)") -nnoremap (my-insert-blank-lines-before) - \ :call insert_blank_line(1) - \ silent! call repeat#set("\Plug>(my-insert-blank-lines-before)") - - - -" ripgrep {{{2 - -" Workaround: do not open quickfix window. -" exe g:rg_window_location 'copen' -let g:rg_window_location = 'silent! echo' -let g:rg_jump_to_first = 1 - -command! -bang -nargs=* -complete=file -bar - \ RG - \ Rg - - -" rust {{{2 - -let g:rustfmt_autosave = 1 - - - - -" sandwich {{{2 - -call operator#sandwich#set('add', 'all', 'highlight', 2) -call operator#sandwich#set('delete', 'all', 'highlight', 0) -call operator#sandwich#set('replace', 'all', 'highlight', 2) - - - - - -" splitjoin {{{2 - -" Note: Don't use J{any sign}, 'Jl' and 'JL'. They will conflict with 'vim-jplus'. -let g:splitjoin_split_mapping = '' -let g:splitjoin_join_mapping = '' - -nnoremap JS :SplitjoinSplit -nnoremap JJ :SplitjoinJoin - - - -" submode {{{2 - -" Global settings {{{3 -let g:submode_always_show_submode = 1 -let g:submode_keyseqs_to_leave = ['', ''] -let g:submode_keep_leaving_key = 1 - -" yankround {{{3 -call submode#enter_with('YankRound', 'nv', 'rs', 'gp', '(yankround-p)') -call submode#enter_with('YankRound', 'nv', 'rs', 'gP', '(yankround-P)') -call submode#map('YankRound', 'nv', 'rs', 'p', '(yankround-prev)') -call submode#map('YankRound', 'nv', 'rs', 'P', '(yankround-next)') - -" swap {{{3 -call submode#enter_with('Swap', 'n', 'r', 'g>', '(swap-next)') -call submode#map('Swap', 'n', 'r', '<', '(swap-prev)') -call submode#enter_with('Swap', 'n', 'r', 'g<', '(swap-prev)') -call submode#map('Swap', 'n', 'r', '>', '(swap-next)') - -" Resizing a window (height) {{{3 -call submode#enter_with('WinResizeH', 'n', '', 'trh') -call submode#enter_with('WinResizeH', 'n', '', 'trh') -call submode#map('WinResizeH', 'n', '', '+', '+') -call submode#map('WinResizeH', 'n', '', '-', '-') - -" Resizing a window (width) {{{3 -call submode#enter_with('WinResizeW', 'n', '', 'trw') -call submode#enter_with('WinResizeW', 'n', '', 'trw') -call submode#map('WinResizeW', 'n', '', '+', '>') -call submode#map('WinResizeW', 'n', '', '-', '') - -" Super undo/redo {{{3 -call submode#enter_with('Undo/Redo', 'n', '', 'gu', 'g-') -call submode#map('Undo/Redo', 'n', '', 'u', 'g-') -call submode#enter_with('Undo/Redo', 'n', '', 'gU', 'g+') -call submode#map('Undo/Redo', 'n', '', 'U', 'g+') - - - -" swap {{{2 - -let g:swap_no_default_key_mappings = 1 - - - -" textobj-continuousline {{{2 - -let g:textobj_continuous_line_no_default_key_mappings = 1 - -omap aL (textobj-continuous-cpp-a) -xmap aL (textobj-continuous-cpp-a) -omap iL (textobj-continuous-cpp-i) -xmap iL (textobj-continuous-cpp-i) - -Autocmd FileType vim omap aL (textobj-continuous-vim-a) -Autocmd FileType vim xmap aL (textobj-continuous-vim-a) -Autocmd FileType vim omap iL (textobj-continuous-vim-i) -Autocmd FileType vim xmap iL (textobj-continuous-vim-i) - - - -" textobj-lastpaste {{{2 - -let g:textobj_lastpaste_no_default_key_mappings = 1 - -omap iP (textobj-lastpaste-i) -xmap iP (textobj-lastpaste-i) -omap aP (textobj-lastpaste-a) -xmap aP (textobj-lastpaste-a) - - - -" textobj-space {{{2 - -let g:textobj_space_no_default_key_mappings = 1 - -omap a (textobj-space-a) -xmap a (textobj-space-a) -omap i (textobj-space-i) -xmap i (textobj-space-i) - - -" textobj-wiw {{{2 - -let g:textobj_wiw_no_default_key_mappings = 1 - -nmap (textobj-wiw-n) -omap (textobj-wiw-n) -xmap (textobj-wiw-n) -nmap g (textobj-wiw-p) -omap g (textobj-wiw-p) -xmap g (textobj-wiw-p) -nmap (textobj-wiw-N) -omap (textobj-wiw-N) -xmap (textobj-wiw-N) -nmap g (textobj-wiw-P) -omap g (textobj-wiw-P) -xmap g (textobj-wiw-P) - -omap a (textobj-wiw-a) -xmap a (textobj-wiw-a) -omap i (textobj-wiw-i) -xmap i (textobj-wiw-i) - - - -" window-adjuster {{{2 - -nnoremap tRw :AdjustScreenWidth -nnoremap tRh :AdjustScreenHeight -nnoremap tRr :AdjustScreenWidth AdjustScreenHeight - - - - - -" yankround {{{2 - -let g:yankround_dir = g:MY_ENV.yankround_dir -let g:yankround_use_region_hl = 1 - - - - - - - - - - - -" Utilities {{{1 - -"" Wrapper of |getchar()|. -function! s:getchar() - let ch = getchar() - while ch == "\" - let ch = getchar() - endwhile - return type(ch) == v:t_number ? nr2char(ch) : ch -endfunction - - -"" Wrapper of |:echo| and |:echohl|. -function! s:echo(message, ...) abort - let highlight = get(a:000, 0, 'None') - redraw - execute 'echohl' highlight - echo a:message - echohl None -endfunction - - -"" Wrapper of |getchar()|. -function! s:getchar_with_prompt(prompt) abort - call s:echo(a:prompt) - return s:getchar() -endfunction - - -"" Wrapper of |input()|. -"" Only when it is used in a mapping, |inputsave()| and |inputstore()| are -"" required. -function! s:input(...) abort - call inputsave() - let result = call('input', a:000) - call inputrestore() - return result -endfunction - - -"" Wrapper of |win_screenpos()|, |winheight()| and |winwidth()|. -"" Returns quadruple consisting of y, x, width and height. -function! s:win_getrect(...) abort - let win = get(a:000, 0, 0) - let [y, x] = win_screenpos(win) - let h = winheight(win) - let w = winwidth(win) - return [y, x, h, w] -endfunction - - - -" Modelines {{{1 -" vim: expandtab:softtabstop=4:shiftwidth=4:textwidth=80:colorcolumn=+1: -" vim: foldenable:foldmethod=marker:foldlevel=0: +let &statusline = ' %f %r %m %= %l/%L %{&fileencoding} %{&fileformat} %y ' diff --git a/scripts/nvim-startup.sh b/scripts/nvim-startup.sh new file mode 100755 index 0000000..8a78253 --- /dev/null +++ b/scripts/nvim-startup.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +log="$(mktemp)" +nvim --startuptime "$log" +q +sort -nr -k2 "$log" | head -n 30 > ./nvim-startup.log diff --git a/scripts/vim-startup.sh b/scripts/vim-startup.sh deleted file mode 100755 index 036a221..0000000 --- a/scripts/vim-startup.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -if [[ "$1" == '-n' ]]; then - vim=nvim -else - vim=vim -fi - -log="$(mktemp)" -$vim --startuptime "$log" +q -sort -nr -k2 "$log" | head -n 30 > ./$vim-startup.log diff --git a/setup.sh b/setup.sh index ccd527e..9653323 100755 --- a/setup.sh +++ b/setup.sh @@ -23,7 +23,6 @@ for name in \ emacs \ git \ nvim \ - vim \ ; \ do if [ ! -L ~/.config/"$name" ]; then @@ -32,11 +31,6 @@ do fi done -if [ ! -f ~/dotfiles/.config/vim/autoload/plug.vim ]; then - echo "download: ~/dotfiles/.config/vim/autoload/plug.vim" - curl -fLo ~/dotfiles/.config/vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -fi - paq_dir="${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/pack/paqs/start/paq-nvim if [ ! -d "$paq_dir" ]; then echo "clone: $paq_dir" -- cgit v1.3-1-g0d28