From aaee2be3ab0b869702dce6bb46353655ddb9fa64 Mon Sep 17 00:00:00 2001 From: ucpr Date: Thu, 10 Oct 2024 03:06:52 +0900 Subject: [PATCH] use lazy.nvim --- mise/config.toml | 2 +- nvim/dpp.ts | 128 ------- nvim/init.lua | 21 +- nvim/lazy-lock.json | 47 +++ nvim/lua/config/lazy.lua | 35 ++ nvim/lua/{settings => core}/autocmd.lua | 0 nvim/lua/{settings => core}/disable.lua | 0 nvim/lua/{settings => core}/keymap.lua | 6 +- .../{settings/opts.lua => core/options.lua} | 12 +- .../{scripts/go_test.lua => core/scripts.lua} | 2 - nvim/lua/plugins/cmp.lua | 81 ++++ nvim/lua/plugins/colorscheme.lua | 31 ++ nvim/lua/plugins/colorscheme/dein_lazy.toml | 4 - nvim/lua/plugins/colorscheme/onedark.lua | 32 -- nvim/lua/plugins/completion/copilot.lua | 40 -- nvim/lua/plugins/completion/dein_lazy.toml | 70 ---- nvim/lua/plugins/completion/nvim-cmp.lua | 359 ------------------ nvim/lua/plugins/completion/vim-vsnip.lua | 10 - nvim/lua/plugins/copilot.lua | 42 ++ nvim/lua/plugins/core/dein.toml | 5 - nvim/lua/plugins/core/dein_lazy.toml | 46 --- nvim/lua/plugins/core/fterm.lua | 13 - nvim/lua/plugins/core/oil.lua | 183 --------- nvim/lua/plugins/core/quick-scope.lua | 16 - nvim/lua/plugins/ddu/cmdline.lua | 9 - nvim/lua/plugins/ddu/ddu.lua | 140 ------- nvim/lua/plugins/ddu/dein_lazy.toml | 71 ---- nvim/lua/plugins/denops.lua | 7 + nvim/lua/plugins/dpp/config.lua | 49 --- nvim/lua/plugins/etc.lua | 39 ++ nvim/lua/plugins/fterm.lua | 14 + nvim/lua/plugins/git/dein_lazy.toml | 15 - nvim/lua/plugins/git/gitsigns.lua | 43 --- nvim/lua/plugins/gitsigns.lua | 49 +++ nvim/lua/plugins/go.lua | 25 ++ nvim/lua/plugins/hlchunk.lua | 21 + nvim/lua/plugins/languages/dein_lazy.toml | 22 -- nvim/lua/plugins/lsp/aerial.lua | 33 -- nvim/lua/plugins/lsp/dein_lazy.toml | 19 - nvim/lua/plugins/lsp/mason.lua | 11 - nvim/lua/plugins/lsp/nvim-lspconfig.lua | 71 ---- nvim/lua/plugins/lspconfig.lua | 103 +++++ nvim/lua/plugins/lualine.lua | 213 +++++++++++ nvim/lua/plugins/mason.lua | 45 +++ nvim/lua/plugins/nvim-hlslens.lua | 35 ++ nvim/lua/plugins/oil.lua | 185 +++++++++ nvim/lua/plugins/quick-scope.lua | 18 + nvim/lua/plugins/telescope.lua | 16 + nvim/lua/plugins/treesitter.lua | 100 +++++ nvim/lua/plugins/treesitter/dein_lazy.toml | 17 - .../treesitter/nvim-treesitter-context.lua | 38 -- .../plugins/treesitter/nvim-treesitter.lua | 26 -- nvim/lua/plugins/ui/dein_lazy.toml | 20 - nvim/lua/plugins/ui/hlchunk.lua | 13 - nvim/lua/plugins/ui/nvim-hlslens.lua | 31 -- nvim/lua/scripts/list_loaded_plugins.lua | 26 -- nvim/lua/settings/usercmd.lua | 2 - nvim/setup.sh | 16 - nvim/snippets/global.json | 32 -- nvim/snippets/go.json | 131 ------- 60 files changed, 1123 insertions(+), 1767 deletions(-) delete mode 100644 nvim/dpp.ts create mode 100644 nvim/lazy-lock.json create mode 100644 nvim/lua/config/lazy.lua rename nvim/lua/{settings => core}/autocmd.lua (100%) rename nvim/lua/{settings => core}/disable.lua (100%) rename nvim/lua/{settings => core}/keymap.lua (76%) rename nvim/lua/{settings/opts.lua => core/options.lua} (86%) rename nvim/lua/{scripts/go_test.lua => core/scripts.lua} (97%) create mode 100644 nvim/lua/plugins/cmp.lua create mode 100644 nvim/lua/plugins/colorscheme.lua delete mode 100644 nvim/lua/plugins/colorscheme/dein_lazy.toml delete mode 100644 nvim/lua/plugins/colorscheme/onedark.lua delete mode 100644 nvim/lua/plugins/completion/copilot.lua delete mode 100644 nvim/lua/plugins/completion/dein_lazy.toml delete mode 100644 nvim/lua/plugins/completion/nvim-cmp.lua delete mode 100644 nvim/lua/plugins/completion/vim-vsnip.lua create mode 100644 nvim/lua/plugins/copilot.lua delete mode 100644 nvim/lua/plugins/core/dein.toml delete mode 100644 nvim/lua/plugins/core/dein_lazy.toml delete mode 100644 nvim/lua/plugins/core/fterm.lua delete mode 100644 nvim/lua/plugins/core/oil.lua delete mode 100644 nvim/lua/plugins/core/quick-scope.lua delete mode 100644 nvim/lua/plugins/ddu/cmdline.lua delete mode 100644 nvim/lua/plugins/ddu/ddu.lua delete mode 100644 nvim/lua/plugins/ddu/dein_lazy.toml create mode 100644 nvim/lua/plugins/denops.lua delete mode 100644 nvim/lua/plugins/dpp/config.lua create mode 100644 nvim/lua/plugins/etc.lua create mode 100644 nvim/lua/plugins/fterm.lua delete mode 100644 nvim/lua/plugins/git/dein_lazy.toml delete mode 100644 nvim/lua/plugins/git/gitsigns.lua create mode 100644 nvim/lua/plugins/gitsigns.lua create mode 100644 nvim/lua/plugins/go.lua create mode 100644 nvim/lua/plugins/hlchunk.lua delete mode 100644 nvim/lua/plugins/languages/dein_lazy.toml delete mode 100644 nvim/lua/plugins/lsp/aerial.lua delete mode 100644 nvim/lua/plugins/lsp/dein_lazy.toml delete mode 100644 nvim/lua/plugins/lsp/mason.lua delete mode 100644 nvim/lua/plugins/lsp/nvim-lspconfig.lua create mode 100644 nvim/lua/plugins/lspconfig.lua create mode 100644 nvim/lua/plugins/lualine.lua create mode 100644 nvim/lua/plugins/mason.lua create mode 100644 nvim/lua/plugins/nvim-hlslens.lua create mode 100644 nvim/lua/plugins/oil.lua create mode 100644 nvim/lua/plugins/quick-scope.lua create mode 100644 nvim/lua/plugins/telescope.lua create mode 100644 nvim/lua/plugins/treesitter.lua delete mode 100644 nvim/lua/plugins/treesitter/dein_lazy.toml delete mode 100644 nvim/lua/plugins/treesitter/nvim-treesitter-context.lua delete mode 100644 nvim/lua/plugins/treesitter/nvim-treesitter.lua delete mode 100644 nvim/lua/plugins/ui/dein_lazy.toml delete mode 100644 nvim/lua/plugins/ui/hlchunk.lua delete mode 100644 nvim/lua/plugins/ui/nvim-hlslens.lua delete mode 100644 nvim/lua/scripts/list_loaded_plugins.lua delete mode 100644 nvim/lua/settings/usercmd.lua delete mode 100644 nvim/setup.sh delete mode 100644 nvim/snippets/global.json delete mode 100644 nvim/snippets/go.json diff --git a/mise/config.toml b/mise/config.toml index 048b550..39f010a 100644 --- a/mise/config.toml +++ b/mise/config.toml @@ -3,4 +3,4 @@ go = ['latest'] nodejs = ['latest'] rust = ['latest'] terraform = ['latest'] -neovim = ['v0.10.0'] +neovim = ['v0.10.2'] diff --git a/nvim/dpp.ts b/nvim/dpp.ts deleted file mode 100644 index f003ae3..0000000 --- a/nvim/dpp.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { - BaseConfig, - ContextBuilder, - Dpp, - Plugin, -} from "https://deno.land/x/dpp_vim@v0.2.0/types.ts"; -import { Denops, fn } from "https://deno.land/x/dpp_vim@v0.2.0/deps.ts"; - -export class Config extends BaseConfig { - override async config(args: { - denops: Denops; - contextBuilder: ContextBuilder; - basePath: string; - dpp: Dpp; - }): Promise<{ - plugins: Plugin[]; - stateLines: string[]; - }> { - args.contextBuilder.setGlobal({ - protocols: ["git"], - }); - - type Toml = { - hooks_file?: string; - ftplugins?: Record; - plugins?: Plugin[]; - }; - - type LazyMakeStateResult = { - plugins: Plugin[]; - stateLines: string[]; - }; - - const [context, options] = await args.contextBuilder.get(args.denops); - const dotfilesDir = "~/.config/nvim/"; - const lazyTomlPaths: string[] = [ - "lua/plugins/core/dein_lazy.toml", - "lua/plugins/ddu/dein_lazy.toml", - "lua/plugins/treesitter/dein_lazy.toml", - "lua/plugins/languages/dein_lazy.toml", - "lua/plugins/colorscheme/dein_lazy.toml", - "lua/plugins/ui/dein_lazy.toml", - "lua/plugins/completion/dein_lazy.toml", - "lua/plugins/lsp/dein_lazy.toml", - "lua/plugins/git/dein_lazy.toml" - ]; - const tomlPaths: string[] = [ - "lua/plugins/core/dein.toml", - ] - - const tomls: Toml[] = []; - for (const tomlPath of tomlPaths) { - tomls.push( - await args.dpp.extAction( - args.denops, - context, - options, - "toml", - "load", - { - path: await fn.expand(args.denops, dotfilesDir + tomlPath), - options: { - lazy: false, - }, - }, - ) as Toml, - ); - } - for (const tomlPath of lazyTomlPaths) { - tomls.push( - await args.dpp.extAction( - args.denops, - context, - options, - "toml", - "load", - { - path: await fn.expand(args.denops, dotfilesDir + tomlPath), - options: { - lazy: true, - }, - }, - ) as Toml, - ); - } - - const recordPlugins: Record = {}; - const ftplugins: Record = {}; - const hooksFiles: string[] = []; - - tomls.forEach((toml) => { - for (const plugin of toml.plugins) { - recordPlugins[plugin.name] = plugin; - } - - if (toml.ftplugins) { - for (const filetype of Object.keys(toml.ftplugins)) { - if (ftplugins[filetype]) { - ftplugins[filetype] += `\n${toml.ftplugins[filetype]}`; - } else { - ftplugins[filetype] = toml.ftplugins[filetype]; - } - } - } - - if (toml.hooks_file) { - hooksFiles.push(toml.hooks_file); - } - }); - - const lazyResult = await args.dpp.extAction( - args.denops, - context, - options, - "lazy", - "makeState", - { - plugins: Object.values(recordPlugins), - }, - ) as LazyMakeStateResult; - - return { - hooksFiles, - plugins: lazyResult.plugins, - stateLines: lazyResult.stateLines, - }; - } -} diff --git a/nvim/init.lua b/nvim/init.lua index 33da3ff..fd1c588 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,15 +1,6 @@ -vim.loader.enable() - -require("settings/opts") -require("settings/disable") -require("settings/autocmd") --- require("settings/usercmd") -require("settings/keymap") -require("plugins/dpp/config") - -require("scripts/go_test") -require("scripts/list_loaded_plugins") - -vim.cmd [[ - filetype plugin on -]] +require("config.lazy") +require("core.disable") +require("core.autocmd") +require("core.options") +require("core.scripts") +require("core.keymap") diff --git a/nvim/lazy-lock.json b/nvim/lazy-lock.json new file mode 100644 index 0000000..eca5a81 --- /dev/null +++ b/nvim/lazy-lock.json @@ -0,0 +1,47 @@ +{ + "FTerm.nvim": { "branch": "master", "commit": "d1320892cc2ebab472935242d9d992a2c9570180" }, + "LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" }, + "cmp-nvim-lsp-document-symbol": { "branch": "main", "commit": "f94f7ba948e32cd302caba1c2ca3f7c697fb4fcf" }, + "cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "031e6ba70b0ad5eee49fd2120ff7a2e325b17fa7" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "context_filetype.vim": { "branch": "master", "commit": "7ff5b43fc8d5b274aa19ade5af11e9fa57577ed6" }, + "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "denops.vim": { "branch": "main", "commit": "ce5d290493b29968fd3afa4c1190ea27a876861d" }, + "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" }, + "gitlinker.nvim": { "branch": "master", "commit": "a221c13fc3c7f5b8799933f4966ee8e618287292" }, + "gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" }, + "guise.vim": { "branch": "main", "commit": "1759cc936583490af76c36e0a25546329b2b9921" }, + "hlargs.nvim": { "branch": "main", "commit": "53ec5d8ca6ed012de5545ba83ea1eb3d636b09fb" }, + "hlchunk.nvim": { "branch": "main", "commit": "ba6e2347177fec8ec6af4ae26d11a468c9e0ca72" }, + "lazy.nvim": { "branch": "main", "commit": "1159bdccd8910a0fd0914b24d6c3d186689023d9" }, + "lexima.vim": { "branch": "master", "commit": "5513d686801993b40c55baa65602f79cd3cf3c77" }, + "lspkind.nvim": { "branch": "master", "commit": "59c3f419af48a2ffb2320cea85e44e5a95f71664" }, + "lualine.nvim": { "branch": "master", "commit": "b431d228b7bbcdaea818bdc3e25b8cdbe861f056" }, + "mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" }, + "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, + "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, + "neodev.nvim": { "branch": "main", "commit": "46aa467dca16cf3dfe27098042402066d2ae242d" }, + "nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" }, + "nvim-hlslens": { "branch": "main", "commit": "07afd4dd14405ad14b142a501a3abea6ae44b21b" }, + "nvim-lspconfig": { "branch": "master", "commit": "d3f169f436e1b44538bfe7e13b4721eec48dbc59" }, + "nvim-treesitter": { "branch": "master", "commit": "9d2acd49976e2a9da72949008df03436f781fd23" }, + "nvim-treesitter-context": { "branch": "master", "commit": "78a81c7494e7d1a08dd1200b556933e513fd9f29" }, + "nvim-ts-autotag": { "branch": "main", "commit": "e239a560f338be31337e7abc3ee42515daf23f5e" }, + "nvim-web-devicons": { "branch": "master", "commit": "56f17def81478e406e3a8ec4aa727558e79786f3" }, + "oil.nvim": { "branch": "master", "commit": "ccab9d5e09e2d0042fbbe5b6bd05e82426247067" }, + "onedark.nvim": { "branch": "master", "commit": "fae34f7c635797f4bf62fb00e7d0516efa8abe37" }, + "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" }, + "quick-scope": { "branch": "master", "commit": "4d35d3b2bc6794666353dcc241b2680bd560416f" }, + "spelunker.vim": { "branch": "master", "commit": "a0bc530f62798bbe053905555a4aa9ed713485eb" }, + "telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }, + "traces.vim": { "branch": "master", "commit": "9663fcf84de5776bee71b6c816c25ccb6ea11d1a" }, + "vim-go-coverage": { "branch": "master", "commit": "d9b0c9f89fa5424db997c81e501fa2fd62628acd" }, + "vim-goaddtags": { "branch": "master", "commit": "18cfa47cbcd9a8da9d022f0cd2f9f4075a1a7ae0" }, + "vim-goimpl": { "branch": "master", "commit": "a18ec88cf5e8c4bd3177206416bc6fbd3c126a45" }, + "vim-goimports": { "branch": "master", "commit": "e50dae830c3cc405003bbc79e90c2dfb5c8da7f5" }, + "vim-gomod": { "branch": "main", "commit": "d6e736037290f08cf99296cb0407f22456022f48" }, + "vim-smartword": { "branch": "master", "commit": "608d4883bb1eff4131f44857a21119220e55886d" }, + "winresizer": { "branch": "master", "commit": "9bd559a03ccec98a458e60c705547119eb5350f3" } +} diff --git a/nvim/lua/config/lazy.lua b/nvim/lua/config/lazy.lua new file mode 100644 index 0000000..f5ee74c --- /dev/null +++ b/nvim/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/nvim/lua/settings/autocmd.lua b/nvim/lua/core/autocmd.lua similarity index 100% rename from nvim/lua/settings/autocmd.lua rename to nvim/lua/core/autocmd.lua diff --git a/nvim/lua/settings/disable.lua b/nvim/lua/core/disable.lua similarity index 100% rename from nvim/lua/settings/disable.lua rename to nvim/lua/core/disable.lua diff --git a/nvim/lua/settings/keymap.lua b/nvim/lua/core/keymap.lua similarity index 76% rename from nvim/lua/settings/keymap.lua rename to nvim/lua/core/keymap.lua index 18692ad..09df56b 100644 --- a/nvim/lua/settings/keymap.lua +++ b/nvim/lua/core/keymap.lua @@ -1,4 +1,3 @@ --- vim.keymap.set("n", "", ":q!") -- buffer @@ -24,5 +23,6 @@ vim.keymap.set("t", "", "") -- custom script vim.keymap.set("n", "got", ":lua go_test()") --- vim-smartword -vim.keymap.set("n", "w", "(smartword-w)") +-- user command +vim.api.nvim_create_user_command("Sterm", function() vim.cmd(":split | resize 20 | term ") end, {}) +vim.api.nvim_create_user_command("Vterm", function() vim.cmd [[ :vsplit | term ]] end, {}) diff --git a/nvim/lua/settings/opts.lua b/nvim/lua/core/options.lua similarity index 86% rename from nvim/lua/settings/opts.lua rename to nvim/lua/core/options.lua index ab9df22..7e902d6 100644 --- a/nvim/lua/settings/opts.lua +++ b/nvim/lua/core/options.lua @@ -3,6 +3,7 @@ local options = { encoding = "utf-8", fileencodings = "utf-8,iso-2022-jp,cp932,sjis,euc-jpset", fencs = "utf-8,iso-2022-jp,enc-jp,cp932", + -- etc confirm = true, hidden = true, @@ -16,6 +17,7 @@ local options = { mouse = "a", -- pastetoggle = "", helplang = "ja", + -- theme spell = false, -- spelunker.vim を使うためfalseにする title = false, @@ -35,7 +37,7 @@ local options = { cmdheight = 0, laststatus = 2, showtabline = 2, - statusline = '%f %y%m %r%h%w%=[%{&fileencoding!=""?&fileencoding:&encoding},%{&ff}] [Pos %02l,%02c] [%p%%/%L]', + -- statusline = '%f %y%m %r%h%w%=[%{&fileencoding!=""?&fileencoding:&encoding},%{&ff}] [Pos %02l,%02c] [%p%%/%L]', -- pumblend = 30, winblend = 5, -- syntax @@ -58,7 +60,7 @@ for k, v in pairs(options) do end -- cmdline.vim でこれを入れていないと statusline の下のコマンドでも cursor が動き回る -vim.cmd [[ - set guicursor=n-v-c-sm:block-Cursor - set guicursor+=i:ver25-CursorInsert -]] +-- vim.cmd [[ +-- set guicursor=n-v-c-sm:block-Cursor +-- set guicursor+=i:ver25-CursorInsert +-- ]] diff --git a/nvim/lua/scripts/go_test.lua b/nvim/lua/core/scripts.lua similarity index 97% rename from nvim/lua/scripts/go_test.lua rename to nvim/lua/core/scripts.lua index 25b7b04..a4d18cf 100644 --- a/nvim/lua/scripts/go_test.lua +++ b/nvim/lua/core/scripts.lua @@ -1,5 +1,3 @@ -vim.keymap.set("n", "got", ":lua go_test()") - local function get_split_window_type() local id = vim.fn.win_getid() local width = vim.fn.winwidth(id) diff --git a/nvim/lua/plugins/cmp.lua b/nvim/lua/plugins/cmp.lua new file mode 100644 index 0000000..b11f4b7 --- /dev/null +++ b/nvim/lua/plugins/cmp.lua @@ -0,0 +1,81 @@ +return { + "hrsh7th/nvim-cmp", + event = "InsertEnter", + dependencies = { + "hrsh7th/cmp-buffer", -- source for text in buffer + "hrsh7th/cmp-path", -- source for file system paths + { + "L3MON4D3/LuaSnip", + version = "v2.*", + -- install jsregexp (optional!). + build = "make install_jsregexp", + }, + "hrsh7th/cmp-nvim-lsp-document-symbol", + "hrsh7th/cmp-nvim-lsp-signature-help", + "rafamadriz/friendly-snippets", + "onsails/lspkind.nvim", -- vs-code like pictograms + }, + config = function() + local cmp = require("cmp") + local lspkind = require("lspkind") + local luasnip = require("luasnip") + + local has_words_before = function() + unpack = unpack or table.unpack + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + end + local feedkey = function(key, mode) + vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) + end + + require("luasnip.loaders.from_vscode").lazy_load() + + cmp.setup({ + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.scroll_docs(-4), + [""] = cmp.mapping.confirm { select = true }, + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif has_words_before() then + cmp.complete() + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + end + end, { "i", "s" }), + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, { "i", "s" }), + }), + experimental = { + ghost_text = true, + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }), + }) + + vim.cmd([[ + set completeopt=menuone,noinsert,noselect + highlight! default link CmpItemKind CmpItemMenuDefault + ]]) + end, +} diff --git a/nvim/lua/plugins/colorscheme.lua b/nvim/lua/plugins/colorscheme.lua new file mode 100644 index 0000000..db155cc --- /dev/null +++ b/nvim/lua/plugins/colorscheme.lua @@ -0,0 +1,31 @@ +return { + "navarasu/onedark.nvim", + lazy = false, + priority = 1000, + config = function() + require("onedark").setup { + style = "darker", + transparent = true, -- Show/hide background + term_colors = true, -- Change terminal color as per the selected theme style + ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden + cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu + code_style = { + comments = 'italic', + keywords = 'none', + functions = 'none', + strings = 'none', + variables = 'bold' + }, + -- Custom Highlights -- + colors = {}, -- Override default colors + highlights = {}, -- Override highlight groups + -- Plugins Config -- + diagnostics = { + darker = true, -- darker colors for diagnostic + undercurl = true, -- use undercurl instead of underline for diagnostics + background = true, -- use background color for virtual text + }, + } + require("onedark").load() + end, +} diff --git a/nvim/lua/plugins/colorscheme/dein_lazy.toml b/nvim/lua/plugins/colorscheme/dein_lazy.toml deleted file mode 100644 index b769b3b..0000000 --- a/nvim/lua/plugins/colorscheme/dein_lazy.toml +++ /dev/null @@ -1,4 +0,0 @@ -[[plugins]] -repo = 'navarasu/onedark.nvim' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/colorscheme/onedark.lua' diff --git a/nvim/lua/plugins/colorscheme/onedark.lua b/nvim/lua/plugins/colorscheme/onedark.lua deleted file mode 100644 index 8ec63b2..0000000 --- a/nvim/lua/plugins/colorscheme/onedark.lua +++ /dev/null @@ -1,32 +0,0 @@ --- lua_source {{{ -require("onedark").setup { - style = "darker", - transparent = true, -- Show/hide background - term_colors = true, -- Change terminal color as per the selected theme style - ending_tildes = false, -- Show the end-of-buffer tildes. By default they are hidden - cmp_itemkind_reverse = false, -- reverse item kind highlights in cmp menu - - code_style = { - comments = 'italic', - keywords = 'none', - functions = 'none', - strings = 'none', - variables = 'bold' - }, - - -- Custom Highlights -- - colors = {}, -- Override default colors - highlights = {}, -- Override highlight groups - - -- Plugins Config -- - diagnostics = { - darker = true, -- darker colors for diagnostic - undercurl = true, -- use undercurl instead of underline for diagnostics - background = true, -- use background color for virtual text - }, -} ---- }}} - --- lua_post_source {{{ -require("onedark").load() ---- }}} diff --git a/nvim/lua/plugins/completion/copilot.lua b/nvim/lua/plugins/completion/copilot.lua deleted file mode 100644 index 055c184..0000000 --- a/nvim/lua/plugins/completion/copilot.lua +++ /dev/null @@ -1,40 +0,0 @@ ---- lua_source {{{ -vim.g.copilot_filetypes = { - gitcommit = true, - markdown = true, - mdx = true, - yaml = true, - text = true, -} -vim.g.copilot_no_tab_map = true -vim.keymap.set( - "i", - "", - 'copilot#Accept()', - { silent = true, expr = true, script = true, replace_keycodes = false } -) -vim.keymap.set( - "i", - "", - '(copilot-dismiss)' -) ---- }}} - ---- lua_post_source {{{ -local function append_diff() - -- Get the Git repository root directory - local git_dir = vim.fn.FugitiveGitDir() - local git_root = vim.fn.fnamemodify(git_dir, ':h') - -- Get the diff of the staged changes relative to the Git repository root - local diff = vim.fn.system('git -C ' .. git_root .. ' diff --cached') - -- Add a comment character to each line of the diff - local comment_diff = table.concat(vim.tbl_map(function(line) - return '# ' .. line - end, vim.split(diff, '\n')), "\n") - -- Append the diff to the commit message - vim.api.nvim_buf_set_lines(0, -1, -1, false, vim.split(comment_diff, '\n')) -end -vim.cmd [[ - autocmd BufReadPost COMMIT_EDITMSG call lua append_diff() -]] ---- }}} diff --git a/nvim/lua/plugins/completion/dein_lazy.toml b/nvim/lua/plugins/completion/dein_lazy.toml deleted file mode 100644 index 10dc940..0000000 --- a/nvim/lua/plugins/completion/dein_lazy.toml +++ /dev/null @@ -1,70 +0,0 @@ -[[plugins]] -repo = 'cohama/lexima.vim' -on_event = 'InsertEnter' - -[[plugins]] -repo = 'hrsh7th/nvim-cmp' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/completion/nvim-cmp.lua' - -[[plugins]] -repo = 'hrsh7th/cmp-nvim-lsp' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'hrsh7th/cmp-buffer' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'hrsh7th/cmp-path' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'hrsh7th/cmp-cmdline' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'hrsh7th/cmp-nvim-lsp-signature-help' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'hrsh7th/cmp-nvim-lsp-document-symbol' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'onsails/lspkind.nvim' -on_event = 'VimEnter' -on_source = 'cmp' - -[[plugins]] -repo = 'hrsh7th/vim-vsnip' -on_event = 'VimEnter' -on_source = 'cmp' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/completion/vim-vsnip.lua' - -[[plugins]] -repo = 'hrsh7th/cmp-vsnip' -on_source = 'cmp' -on_event = 'VimEnter' - -[[plugins]] -repo = 'github/copilot.vim' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/completion/copilot.lua' - -[[plugins]] -repo = 'mattn/vim-sonictemplate' -on_cmd = 'Template' -lua_post_source = ''' - vim.g.sonictemplate_vim_template_dir = { "$HOME/.vim/template" } -''' - -[[plugins]] -repo = 'tpope/vim-surround' -on_event = 'VimEnter' diff --git a/nvim/lua/plugins/completion/nvim-cmp.lua b/nvim/lua/plugins/completion/nvim-cmp.lua deleted file mode 100644 index 63953b6..0000000 --- a/nvim/lua/plugins/completion/nvim-cmp.lua +++ /dev/null @@ -1,359 +0,0 @@ ---- lua_source {{{ -local has_words_before = function() - unpack = unpack or table.unpack - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - -local feedkey = function(key, mode) - vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true) -end - -vim.g.use_nerd_icons = false -function icons() - if vim.fn.has "mac" == 1 or vim.g.use_nerd_icons then - return { - kind = { - -- Text = "", - Text = "✏︎", - Method = "m", - Function = "λ", - Constructor = "", - -- Method = "", - -- Function = "", - -- Constructor = "", - Field = "", - -- Variable = "", - Variable = "", - -- Class = "", - Class = "c", - Interface = "", - Module = "", - -- Module = "", - Property = "", - Unit = "", - -- Value = "", - Value = "v", - Enum = "", - -- Keyword = "", - Keyword = "", - Snippet = "", - -- Snippet = "", - Color = "", - File = "", - Reference = "", - Folder = "", - EnumMember = "", - Constant = "", - Struct = "", - Event = "", - Operator = "", - TypeParameter = "", - }, - type = { - -- Array = "", - Array = "🗃", - Number = "", - -- String = "", - String = "📖", - Boolean = "蘒", - -- Object = "", - Object = "🗂", - }, - documents = { - File = "", - Files = "", - Folder = "", - OpenFolder = "", - }, - git = { - Add = "", - Mod = "", - Remove = "", - Ignore = "", - Rename = "", - Diff = "", - Repo = "", - Octoface = "", - }, - ui = { - ArrowClosed = "", - ArrowOpen = "", - Lock = "", - Circle = "", - BigCircle = "", - BigUnfilledCircle = "", - Close = "", - NewFile = "", - Search = "", - Lightbulb = "", - Project = "", - Dashboard = "", - History = "", - Comment = "", - Bug = "", - Code = "", - Telescope = "", - Gear = "", - Package = "", - List = "", - SignIn = "", - SignOut = "", - Check = "", - Fire = "", - Note = "", - BookMark = "", - Pencil = "", - -- ChevronRight = "", - ChevronRight = ">", - Table = "", - Calendar = "", - CloudDownload = "", - }, - diagnostics = { - Error = "", - Warning = "", - Information = "", - Question = "", - Hint = "", - }, - misc = { - Robot = "ﮧ", - Squirrel = "", - Tag = "", - Watch = "", - Smiley = "ﲃ", - Package = "", - CircuitBoard = "", - }, - } - else - return { - kind = { - Text = " ", - Method = " ", - Function = " ", - Constructor = " ", - Field = " ", - Variable = " ", - Class = " ", - Interface = " ", - Module = " ", - Property = " ", - Unit = " ", - Value = " ", - Enum = " ", - Keyword = " ", - Snippet = " ", - Color = " ", - File = " ", - Reference = " ", - Folder = " ", - EnumMember = " ", - Constant = " ", - Struct = " ", - Event = " ", - Operator = " ", - TypeParameter = " ", - Misc = " ", - }, - type = { - Array = " ", - Number = " ", - String = " ", - Boolean = " ", - Object = " ", - }, - documents = { - File = " ", - Files = " ", - Folder = " ", - OpenFolder = " ", - }, - git = { - Add = " ", - Mod = " ", - Remove = " ", - Ignore = " ", - Rename = " ", - Diff = " ", - Repo = " ", - Octoface = " ", - }, - ui = { - ArrowClosed = "", - ArrowOpen = "", - Lock = " ", - Circle = " ", - BigCircle = " ", - BigUnfilledCircle = " ", - Close = " ", - NewFile = " ", - Search = " ", - Lightbulb = " ", - Project = " ", - Dashboard = " ", - History = " ", - Comment = " ", - Bug = " ", - Code = " ", - Telescope = " ", - Gear = " ", - Package = " ", - List = " ", - SignIn = " ", - SignOut = " ", - NoteBook = " ", - Check = " ", - Fire = " ", - Note = " ", - BookMark = " ", - Pencil = " ", - ChevronRight = "", - Table = " ", - Calendar = " ", - CloudDownload = " ", - }, - diagnostics = { - Error = " ", - Warning = " ", - Information = " ", - Question = " ", - Hint = " ", - }, - misc = { - Robot = " ", - Squirrel = " ", - Tag = " ", - Watch = " ", - Smiley = " ", - Package = " ", - CircuitBoard = " ", - }, - } - end -end - -local icn = icons() -local kind_icons = icn.kind - -local cmp = require("cmp") -cmp.setup({ - snippet = { - expand = function(args) - vim.fn["vsnip#anonymous"](args.body) - end, - }, - formatting = { - fields = { "kind", "abbr", "menu" }, - format = function(entry, vim_item) - -- Kind icons - vim_item.kind = kind_icons[vim_item.kind] - - if entry.source.name == "copilot" then - vim_item.kind = icn.git.Octoface - vim_item.kind_hl_group = "CmpItemKindCopilot" - end - - if entry.source.name == "emoji" then - vim_item.kind = icn.misc.Smiley - vim_item.kind_hl_group = "CmpItemKindEmoji" - end - - if entry.source.name == "crates" then - vim_item.kind = icn.misc.Package - vim_item.kind_hl_group = "CmpItemKindCrate" - end - - if entry.source.name == "lab.quick_data" then - vim_item.kind = icn.misc.CircuitBoard - vim_item.kind_hl_group = "CmpItemKindConstant" - end - - -- NOTE: order matters - vim_item.menu = ({ - nvim_lsp = "", - nvim_lua = "", - luasnip = "", - buffer = "", - path = "", - emoji = "", - })[entry.source.name] - return vim_item - end, - }, - window = { - completion = cmp.config.window.bordered({ - border = 'double' - }), - documentation = cmp.config.window.bordered({ - border = 'double' - }), - }, - sources = { - { name = "nvim_lsp", priority = 10 }, - { name = 'vsnip', priority = 9 }, - { name = "path", priority = 8 }, - { name = "buffer", priority = 7 }, - { name = "nvim_lsp_signature_help", priority = 6 }, - { name = "emoji", priority = 1 }, - }, - mapping = cmp.mapping.preset.insert({ - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.scroll_docs(-4), - [""] = cmp.mapping.confirm { select = true }, - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif vim.fn["vsnip#available"](1) == 1 then - feedkey("(vsnip-expand-or-jump)", "") - elseif has_words_before() then - cmp.complete() - else - fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. - end - end, { "i", "s" }), - [""] = cmp.mapping(function() - if cmp.visible() then - cmp.select_prev_item() - elseif vim.fn["vsnip#jumpable"](-1) == 1 then - feedkey("(vsnip-jump-prev)", "") - end - end, { "i", "s" }), - }), - experimental = { - ghost_text = true, - }, -}) - --- Set configuration for specific filetype. -cmp.setup.filetype('gitcommit', { - sources = cmp.config.sources({ - { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it. - }, { - { name = 'buffer' }, - }) -}) - --- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline({ '/', '?' }, { - mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' } - } -}) - --- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) -}) ---- }}} diff --git a/nvim/lua/plugins/completion/vim-vsnip.lua b/nvim/lua/plugins/completion/vim-vsnip.lua deleted file mode 100644 index 81cf7b7..0000000 --- a/nvim/lua/plugins/completion/vim-vsnip.lua +++ /dev/null @@ -1,10 +0,0 @@ ---- lua_source {{{ -vim.g.vsnip_snippet_dir = "$XDG_CONFIG_HOME/nvim/snippets" ---- }}} - ---- lua_post_source {{{ -vim.cmd [[ - autocmd User PumCompleteDone call vsnip_integ#on_complete_done(g:pum#completed_item) - autocmd BufWritePre lua vim.lsp.buf.format({}, 10000) -]] ---- }}} diff --git a/nvim/lua/plugins/copilot.lua b/nvim/lua/plugins/copilot.lua new file mode 100644 index 0000000..a4c3a5d --- /dev/null +++ b/nvim/lua/plugins/copilot.lua @@ -0,0 +1,42 @@ +return { + "github/copilot.vim", + config = function() + vim.g.copilot_filetypes = { + gitcommit = true, + markdown = true, + mdx = true, + yaml = true, + text = true, + } + vim.g.copilot_no_tab_map = true + vim.keymap.set( + "i", + "", + 'copilot#Accept()', + { silent = true, expr = true, script = true, replace_keycodes = false } + ) + vim.keymap.set( + "i", + "", + '(copilot-dismiss)' + ) + + local function append_diff() + -- Get the Git repository root directory + local git_dir = vim.fn.FugitiveGitDir() + local git_root = vim.fn.fnamemodify(git_dir, ':h') + -- Get the diff of the staged changes relative to the Git repository root + local diff = vim.fn.system('git -C ' .. git_root .. ' diff --cached') + -- Add a comment character to each line of the diff + local comment_diff = table.concat(vim.tbl_map(function(line) + return '# ' .. line + end, vim.split(diff, '\n')), "\n") + -- Append the diff to the commit message + vim.api.nvim_buf_set_lines(0, -1, -1, false, vim.split(comment_diff, '\n')) + end + vim.cmd [[ + autocmd BufReadPost COMMIT_EDITMSG call lua append_diff() + ]] + end, +} + diff --git a/nvim/lua/plugins/core/dein.toml b/nvim/lua/plugins/core/dein.toml deleted file mode 100644 index 0524e1d..0000000 --- a/nvim/lua/plugins/core/dein.toml +++ /dev/null @@ -1,5 +0,0 @@ -[[plugins]] -repo = 'Shougo/context_filetype.vim' - -[[plugins]] -repo = 'vim-denops/denops.vim' diff --git a/nvim/lua/plugins/core/dein_lazy.toml b/nvim/lua/plugins/core/dein_lazy.toml deleted file mode 100644 index 624d7f3..0000000 --- a/nvim/lua/plugins/core/dein_lazy.toml +++ /dev/null @@ -1,46 +0,0 @@ -[[plugins]] -repo = 'simeji/winresizer' -on_event = 'BufEnter' - -[[plugins]] -repo = 'kana/vim-smartword' -on_event = 'BufEnter' - -[[plugins]] -repo = 'markonm/traces.vim' -on_event = 'BufEnter' - -[[plugins]] -repo = 'yuki-yano/fuzzy-motion.vim' -on_event = 'BufEnter' -lua_source = ''' - vim.keymap.set("n", "s", ":FuzzyMotion") -''' - -[[plugins]] -repo = 'lambdalisue/guise.vim' -on_event = 'BufEnter' - -[[plugins]] -repo = 'unblevable/quick-scope' -on_event = 'BufEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/core/quick-scope.lua' - -[[plugins]] -repo = 'numToStr/FTerm.nvim' -on_event = 'BufEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/core/fterm.lua' - -[[plugins]] -repo = 'kamykn/spelunker.vim' -on_event = 'BufEnter' -lua_add = ''' - vim.g.enable_spelunker_vim = 1 - vim.g.spelunker_check_type = 2 -''' - -[[plugins]] -repo = 'stevearc/oil.nvim' -on_event = 'VimEnter' -on_cmd = 'Oil' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/core/oil.lua' diff --git a/nvim/lua/plugins/core/fterm.lua b/nvim/lua/plugins/core/fterm.lua deleted file mode 100644 index 31a4ed8..0000000 --- a/nvim/lua/plugins/core/fterm.lua +++ /dev/null @@ -1,13 +0,0 @@ ---- lua_add {{{ -vim.keymap.set("n", "T", 'lua require("FTerm").toggle()') ---- }}} - ---- lua_post_source {{{ -require 'FTerm'.setup({ - border = 'double', - dimensions = { - height = 0.9, - width = 0.9, - }, -}) ---- }}} diff --git a/nvim/lua/plugins/core/oil.lua b/nvim/lua/plugins/core/oil.lua deleted file mode 100644 index 387a1da..0000000 --- a/nvim/lua/plugins/core/oil.lua +++ /dev/null @@ -1,183 +0,0 @@ ---- lua_post_source {{{ -require("oil").setup({ - -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) - -- Set to false if you still want to use netrw. - default_file_explorer = true, - -- Id is automatically added at the beginning, and name at the end - -- See :help oil-columns - columns = { - "icon", - -- "permissions", - -- "size", - -- "mtime", - }, - -- Buffer-local options to use for oil buffers - buf_options = { - buflisted = false, - bufhidden = "hide", - }, - -- Window-local options to use for oil buffers - win_options = { - wrap = false, - signcolumn = "no", - cursorcolumn = false, - foldcolumn = "0", - spell = false, - list = false, - conceallevel = 3, - concealcursor = "nvic", - }, - -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) - delete_to_trash = false, - -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) - skip_confirm_for_simple_edits = false, - -- Selecting a new/moved/renamed file or directory will prompt you to save changes first - -- (:help prompt_save_on_select_new_entry) - prompt_save_on_select_new_entry = true, - -- Oil will automatically delete hidden buffers after this delay - -- You can set the delay to false to disable cleanup entirely - -- Note that the cleanup process only starts when none of the oil buffers are currently displayed - cleanup_delay_ms = 2000, - lsp_file_methods = { - -- Time to wait for LSP file operations to complete before skipping - timeout_ms = 1000, - -- Set to true to autosave buffers that are updated with LSP willRenameFiles - -- Set to "unmodified" to only save unmodified buffers - autosave_changes = false, - }, - -- Constrain the cursor to the editable parts of the oil buffer - -- Set to `false` to disable, or "name" to keep it on the file names - constrain_cursor = "editable", - -- Set to true to watch the filesystem for changes and reload oil - experimental_watch_for_changes = false, - -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap - -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) - -- Additionally, if it is a string that matches "actions.", - -- it will use the mapping at require("oil.actions"). - -- Set to `false` to remove a keymap - -- See :help oil-actions for a list of all available actions - keymaps = { - ["g?"] = "actions.show_help", - [""] = "actions.select", - [""] = "actions.select_vsplit", - [""] = "actions.select_split", - [""] = "actions.select_tab", - [""] = "actions.preview", - [""] = "actions.close", - [""] = "actions.refresh", - ["-"] = "actions.parent", - ["_"] = "actions.open_cwd", - ["`"] = "actions.cd", - ["~"] = "actions.tcd", - ["gs"] = "actions.change_sort", - ["gx"] = "actions.open_external", - ["g."] = "actions.toggle_hidden", - ["g\\"] = "actions.toggle_trash", - }, - -- Set to false to disable all of the above keymaps - use_default_keymaps = true, - view_options = { - -- Show files and directories that start with "." - show_hidden = false, - -- This function defines what is considered a "hidden" file - is_hidden_file = function(name, bufnr) - return vim.startswith(name, ".") - end, - -- This function defines what will never be shown, even when `show_hidden` is set - is_always_hidden = function(name, bufnr) - return false - end, - -- Sort file names in a more intuitive order for humans. Is less performant, - -- so you may want to set to false if you work with large directories. - natural_order = true, - sort = { - -- sort order can be "asc" or "desc" - -- see :help oil-columns to see which columns are sortable - { "type", "asc" }, - { "name", "asc" }, - }, - }, - -- Extra arguments to pass to SCP when moving/copying files over SSH - extra_scp_args = {}, - -- EXPERIMENTAL support for performing file operations with git - git = { - -- Return true to automatically git add/mv/rm files - add = function(path) - return false - end, - mv = function(src_path, dest_path) - return false - end, - rm = function(path) - return false - end, - }, - -- Configuration for the floating window in oil.open_float - float = { - -- Padding around the floating window - padding = 2, - max_width = 0, - max_height = 0, - border = "rounded", - win_options = { - winblend = 0, - }, - -- This is the config that will be passed to nvim_open_win. - -- Change values here to customize the layout - override = function(conf) - return conf - end, - }, - -- Configuration for the actions floating preview window - preview = { - -- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_width and max_width can be a single value or a list of mixed integer/float types. - -- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total" - max_width = 0.9, - -- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total" - min_width = { 40, 0.4 }, - -- optionally define an integer/float for the exact width of the preview window - width = nil, - -- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_height and max_height can be a single value or a list of mixed integer/float types. - -- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total" - max_height = 0.9, - -- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total" - min_height = { 5, 0.1 }, - -- optionally define an integer/float for the exact height of the preview window - height = nil, - border = "rounded", - win_options = { - winblend = 0, - }, - -- Whether the preview window is automatically updated when the cursor is moved - update_on_cursor_moved = true, - }, - -- Configuration for the floating progress window - progress = { - max_width = 0.9, - min_width = { 40, 0.4 }, - width = nil, - max_height = { 10, 0.9 }, - min_height = { 5, 0.1 }, - height = nil, - border = "rounded", - minimized_border = "none", - win_options = { - winblend = 0, - }, - }, - -- Configuration for the floating SSH window - ssh = { - border = "rounded", - }, - -- Configuration for the floating keymaps help window - keymaps_help = { - border = "rounded", - }, -}) ---- }}} - ---- lua_source {{{ -vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) ---- }}} diff --git a/nvim/lua/plugins/core/quick-scope.lua b/nvim/lua/plugins/core/quick-scope.lua deleted file mode 100644 index 3e67aaf..0000000 --- a/nvim/lua/plugins/core/quick-scope.lua +++ /dev/null @@ -1,16 +0,0 @@ ---- lua_add {{{ -vim.cmd [[ - augroup qs_colors - autocmd! - autocmd ColorScheme * highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline - autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline - augroup END -]] ---- }}} - ---- lua_post_source {{{ -vim.g.qs_hi_priority = 2 -vim.g.qs_max_chars = 80 -vim.g.qs_lazy_highlight = 0 -vim.g.qs_buftype_blacklist = { "terminal", "nofile" } ---- }}} diff --git a/nvim/lua/plugins/ddu/cmdline.lua b/nvim/lua/plugins/ddu/cmdline.lua deleted file mode 100644 index c06499c..0000000 --- a/nvim/lua/plugins/ddu/cmdline.lua +++ /dev/null @@ -1,9 +0,0 @@ ---- lua_source {{{ -vim.fn['cmdline#set_option']({ - blend = 0, - border = "double", - highlight_window = "NormalFloat", - highlight_cursor = "TermCursor", - highlight_prompt = "Normal", -}) ---- }}} diff --git a/nvim/lua/plugins/ddu/ddu.lua b/nvim/lua/plugins/ddu/ddu.lua deleted file mode 100644 index c535630..0000000 --- a/nvim/lua/plugins/ddu/ddu.lua +++ /dev/null @@ -1,140 +0,0 @@ ---- lua_add {{{ -local winCol = vim.api.nvim_win_get_width(0) -local winRow = vim.api.nvim_win_get_height(0) -local winWidth = math.floor(winCol * 0.95) -local winHeight = math.floor(winRow * 0.8) - -vim.fn["ddu#custom#patch_global"]({ - ui = "ff", - uiParams = { - ff = { - autoAction = { name = "preview" }, - startAutoAction = true, - - previewFloating = true, - previewFloatingBorder = "rounded", - previewFloatingTitle = "Preview", - previewSplit = "vertical", - previewWidth = math.floor(winWidth / 2), - previewHeight = math.floor(winHeight / 1.5), - - prompt = "> ", - split = "floating", - floatingBorder = "rounded", - floatingTitle = "Data", - winWidth = math.floor(winWidth / 2), - winHeight = math.floor(winHeight / 1.5), - winRow = 3, - winCol = 5, - } - }, - sourceOptions = { - _ = { - matchers = { "matcher_fzf" }, - sorters = { "sorter_fzf" }, - converters = { "converter_devicon" }, - ignoreCase = true, - }, - }, - kindOptions = { - action = { - defaultAction = "do", - }, - }, -}) -vim.fn["ddu#custom#patch_local"]("file_recursive", { - sources = { - { - name = { "file_rec" }, - options = { - converters = { - "converter_devicon", - }, - }, - params = { - ignoredDirectories = { "node_modules", ".git", ".vscode", "dist", "build" }, - }, - }, - }, - kindOptions = { - file = { - defaultAction = "open", - }, - }, -}) -vim.fn["ddu#custom#patch_local"]("buffer", { - sources = { - { - name = { "buffer" }, - options = { - }, - }, - }, - kindOptions = { - buffer = { - defaultAction = "open", - }, - }, -}) -vim.fn["ddu#custom#patch_local"]("grep", { - sources = { - { - name = { "rg" }, - }, - }, - sourceParams = { - rg = { - args = { "--column", "--no-heading", "--color", "never" }, - }, - }, - kindOptions = { - file = { - defaultAction = "open", - }, - }, -}) -vim.api.nvim_create_autocmd("FileType", { - pattern = "ddu-ff", - callback = function() - local opts = { noremap = true, silent = true, buffer = true } - vim.keymap.set({ "n" }, "q", [[call ddu#ui#do_action("quit")]], opts) - vim.keymap.set({ "n" }, "a", [[call ddu#ui#do_action("chooseAction")]], opts) - vim.keymap.set({ "n" }, "", [[call ddu#ui#do_action("itemAction")]], opts) - vim.keymap.set({ "n" }, "", [[call ddu#ui#do_action("itemAction", {'params': {'command': 'vsplit'}})]], - opts) - vim.keymap.set({ "n" }, "", [[call ddu#ui#do_action("itemAction", {'params': {'command': 'split'}})]], - opts) - vim.keymap.set({ "n" }, "i", [[call ddu#ui#do_action("openFilterWindow")]], opts) - vim.keymap.set({ "n" }, "P", [[call ddu#ui#do_action("togglePreview")]], opts) - end, -}) -vim.api.nvim_create_autocmd("FileType", { - pattern = "ddu-ff-filter", - callback = function() - local opts = { noremap = true, silent = true, buffer = true } - vim.keymap.set({ "n", "i" }, "", [[close]], opts) - end, -}) -vim.fn["ddu#custom#patch_local"]("colorscheme", { - sources = { - { - name = { "colorscheme" }, - }, - }, - kindOptions = { - colorscheme = { - defaultAction = "set", - } - } -}) - -vim.keymap.set("n", "ff", "call ddu#start(#{name:'file_recursive'})") -vim.keymap.set("n", "b", "call ddu#start(#{name:'buffer'})") -vim.keymap.set("n", "gg", "call ddu#start(#{name:'grep'})") -vim.keymap.set("n", "g", - "call ddu#start(#{name:'grep', sources: [#{ name: 'grep', params: #{ input: expand('') } }]})") - -vim.cmd [[ -autocmd User Ddu:ui:ff:openFilterWindow call cmdline#enable() -]] ---- }}} diff --git a/nvim/lua/plugins/ddu/dein_lazy.toml b/nvim/lua/plugins/ddu/dein_lazy.toml deleted file mode 100644 index 98d50b8..0000000 --- a/nvim/lua/plugins/ddu/dein_lazy.toml +++ /dev/null @@ -1,71 +0,0 @@ -[[plugins]] -repo = 'Shougo/ddu.vim' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/ddu/ddu.lua' - -### DDU SOURCE ### - -[[plugins]] -repo = 'Shougo/ddu-source-file' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'Shougo/ddu-source-file_rec' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'Shougo/ddu-source-action' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'matsui54/ddu-source-file_external' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'shun/ddu-source-rg' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'shun/ddu-source-buffer' -on_source = 'ddu.vim' - -[[plugins]] -repo = '4513ECHO/ddu-source-colorscheme' -on_source = 'ddu.vim' - -### DDU KIND ### - -[[plugins]] -repo = 'Shougo/ddu-kind-file' -on_source = 'ddu.vim' - -### DDU UI ### - -[[plugins]] -repo = 'Shougo/ddu-ui-ff' -on_source = 'ddu.vim' - -### DDU FILTER ### - -[[plugins]] -repo = 'Shougo/ddu-filter-matcher_substring' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'uga-rosa/ddu-filter-converter_devicon' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'yuki-yano/ddu-filter-fzf' -on_source = 'ddu.vim' - -### ETC ### - -[[plugins]] -repo = 'Shougo/ddu-commands.vim' -on_source = 'ddu.vim' - -[[plugins]] -repo = 'Shougo/cmdline.vim' -on_source = 'ddu.vim' -hooks_file = "$XDG_CONFIG_HOME/nvim/lua/plugins/ddu/cmdline.lua" diff --git a/nvim/lua/plugins/denops.lua b/nvim/lua/plugins/denops.lua new file mode 100644 index 0000000..01e9914 --- /dev/null +++ b/nvim/lua/plugins/denops.lua @@ -0,0 +1,7 @@ +return { + 'vim-denops/denops.vim', + event = 'VimEnter', + dependencies = { + 'lambdalisue/guise.vim', + }, +} diff --git a/nvim/lua/plugins/dpp/config.lua b/nvim/lua/plugins/dpp/config.lua deleted file mode 100644 index 66601b4..0000000 --- a/nvim/lua/plugins/dpp/config.lua +++ /dev/null @@ -1,49 +0,0 @@ -local dpp_base = "$XDG_CACHE_HOME/dpp/" -local dpp_repo = dpp_base .. "repos/" -local dpp_src = dpp_repo .. "github.com/Shougo/dpp.vim" -vim.opt.runtimepath:prepend(dpp_src) - -local dpp = require("dpp") - -local dpp_exts = { - "github.com/Shougo/dpp-ext-toml", - "github.com/Shougo/dpp-ext-lazy", - "github.com/Shougo/dpp-ext-installer", - "github.com/Shougo/dpp-protocol-git", -} - -for _, ext in ipairs(dpp_exts) do - vim.opt.runtimepath:append(dpp_repo .. ext) -end - --- vim.g["denops#debug"] = 1 -- note: cmdheight=0 のときはEnterで進めないといけない - -if dpp.load_state(dpp_base) then - local denops_src = dpp_repo .. "github.com/vim-denops/denops.vim" - vim.opt.runtimepath:prepend(denops_src) - - local dpp_config = "$XDG_CONFIG_HOME/nvim/dpp.ts" - vim.api.nvim_create_autocmd("User", { - pattern = "DenopsReady", - callback = function() - vim.notify("failed to load_state") - dpp.make_state(dpp_base, dpp_config) - end - }) -end - -local function install() - vim.fn["dpp#async_ext_action"]('installer', 'install') -end - -local function update() - vim.fn["dpp#async_ext_action"]('installer', 'update') -end - -vim.cmd [[ -autocmd BufWritePost *.lua,*.vim,*.toml,*.ts,vimrc,.vimrc - \ call dpp#check_files() -]] - -vim.api.nvim_create_user_command('DppInstall', install, {}) -vim.api.nvim_create_user_command('DppUpdate', update, {}) diff --git a/nvim/lua/plugins/etc.lua b/nvim/lua/plugins/etc.lua new file mode 100644 index 0000000..41b733d --- /dev/null +++ b/nvim/lua/plugins/etc.lua @@ -0,0 +1,39 @@ +return { + { + 'cohama/lexima.vim', + event = 'InsertEnter', + }, + { + 'Shougo/context_filetype.vim', + }, + { + 'simeji/winresizer', + event = 'VimEnter', + }, + { + 'kana/vim-smartword', + event = 'VimEnter', + config = function() + vim.keymap.set("n", "w", "(smartword-w)") + end, + }, + { + 'markonm/traces.vim', + event = 'VimEnter', + }, + { + 'kamykn/spelunker.vim', + event = 'VimEnter', + config = function() + vim.g.enable_spelunker_vim = 1 + vim.g.spelunker_check_type = 2 + end, + }, + { + 'linrongbin16/gitlinker.nvim', + cmd = 'GitLink', + config = function() + require('gitlinker').setup() + end, + } +} diff --git a/nvim/lua/plugins/fterm.lua b/nvim/lua/plugins/fterm.lua new file mode 100644 index 0000000..6631de1 --- /dev/null +++ b/nvim/lua/plugins/fterm.lua @@ -0,0 +1,14 @@ +return { + 'numToStr/FTerm.nvim', + event = 'BufWinEnter', + config = function() + vim.keymap.set("n", "T", 'lua require("FTerm").toggle()') + require 'FTerm'.setup({ + border = 'double', + dimensions = { + height = 0.9, + width = 0.9, + }, + }) + end +} diff --git a/nvim/lua/plugins/git/dein_lazy.toml b/nvim/lua/plugins/git/dein_lazy.toml deleted file mode 100644 index 525af00..0000000 --- a/nvim/lua/plugins/git/dein_lazy.toml +++ /dev/null @@ -1,15 +0,0 @@ -[[plugins]] -repo = 'lewis6991/gitsigns.nvim' -on_event = ["FocusLost", "CursorHold", "VimEnter"] -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/git/gitsigns.lua' - -[[plugins]] -repo = 'linrongbin16/gitlinker.nvim' -on_cmd = 'GitLink' -lua_post_source = ''' - require('gitlinker').setup() -''' - -[[plugins]] -repo = 'tpope/vim-fugitive' -on_event = 'InsertEnter' diff --git a/nvim/lua/plugins/git/gitsigns.lua b/nvim/lua/plugins/git/gitsigns.lua deleted file mode 100644 index 18b0acf..0000000 --- a/nvim/lua/plugins/git/gitsigns.lua +++ /dev/null @@ -1,43 +0,0 @@ ---- lua_post_source {{{ -require('gitsigns').setup { - signs = { - add = { text = '│' }, - change = { text = '│' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┆' }, - }, - signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` - numhl = false, -- Toggle with `:Gitsigns toggle_numhl` - linehl = false, -- Toggle with `:Gitsigns toggle_linehl` - word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` - watch_gitdir = { - follow_files = true - }, - attach_to_untracked = true, - current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` - current_line_blame_opts = { - virt_text = true, - virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align' - delay = 1000, - ignore_whitespace = false, - }, - current_line_blame_formatter = ', - ', - sign_priority = 6, - update_debounce = 100, - status_formatter = nil, -- Use default - max_file_length = 40000, -- Disable if file is longer than this (in lines) - preview_config = { - -- Options passed to nvim_open_win - border = 'double', - style = 'minimal', - relative = 'cursor', - row = 0, - col = 1 - }, - --yadm = { - -- enable = false - --}, -} ---- }}} diff --git a/nvim/lua/plugins/gitsigns.lua b/nvim/lua/plugins/gitsigns.lua new file mode 100644 index 0000000..8ea7b07 --- /dev/null +++ b/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,49 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + local gitsigns = require("gitsigns") + gitsigns.setup({ + signs = { + add = { text = "│" }, + change = { text = "│" }, + delete = { text = "_" }, + topdelete = { text = "‾" }, + changedelete = { text = "~" }, + untracked = { text = "┆" }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + numhl = false, -- Toggle with `:Gitsigns toggle_numhl` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + watch_gitdir = { + interval = 1000, + follow_files = true, + }, + attach_to_untracked = true, + current_line_blame = false, -- Toggle with `:Gitsigns toggle_current_line_blame` + current_line_blame_opts = { + virt_text = true, + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' + delay = 1000, + ignore_whitespace = false, + }, + current_line_blame_formatter = ", - ", + sign_priority = 6, + update_debounce = 100, + status_formatter = nil, -- Use default + max_file_length = 40000, -- Disable if file is longer than this (in lines) + preview_config = { + -- Options passed to nvim_open_win + border = "single", + style = "minimal", + relative = "cursor", + row = 0, + col = 1, + }, + yadm = { + enable = false, + }, + }) + end, +} + diff --git a/nvim/lua/plugins/go.lua b/nvim/lua/plugins/go.lua new file mode 100644 index 0000000..8926892 --- /dev/null +++ b/nvim/lua/plugins/go.lua @@ -0,0 +1,25 @@ +return { + { + 'kyoh86/vim-go-coverage', + ft = {'go'}, + }, + { + 'mattn/vim-goaddtags', + ft = {'go'}, + }, + { + 'mattn/vim-goimpl', + ft = {'go'}, + }, + { + 'mattn/vim-gomod', + ft = {'go'}, + }, + { + 'mattn/vim-goimports', + ft = {'go'}, + config = function() + vim.g.goimports = 1 + end, + }, +} diff --git a/nvim/lua/plugins/hlchunk.lua b/nvim/lua/plugins/hlchunk.lua new file mode 100644 index 0000000..5257fa9 --- /dev/null +++ b/nvim/lua/plugins/hlchunk.lua @@ -0,0 +1,21 @@ +return { + "shellRaining/hlchunk.nvim", + event = { "BufReadPre", "BufNewFile" }, + config = function() + require("hlchunk").setup({ + chunk = { + enable = false, + }, + indent = { + enable = true, + }, + line_num = { + enable = false, + }, + blank = { + enable = false, + }, + }) + end, +} + diff --git a/nvim/lua/plugins/languages/dein_lazy.toml b/nvim/lua/plugins/languages/dein_lazy.toml deleted file mode 100644 index 21a2d9a..0000000 --- a/nvim/lua/plugins/languages/dein_lazy.toml +++ /dev/null @@ -1,22 +0,0 @@ -[[plugins]] -repo = 'kyoh86/vim-go-coverage' -on_ft = ['go'] - -[[plugins]] -repo = 'mattn/vim-goaddtags' -on_ft = ['go'] - -[[plugins]] -repo = 'mattn/vim-goimpl' -on_ft = ['go'] - -[[plugins]] -repo = 'mattn/vim-gomod' -on_ft = ['go'] - -[[plugins]] -repo = 'mattn/vim-goimports' -on_ft = ['go'] -lua_source = ''' - vim.g.goimports = 1 -''' diff --git a/nvim/lua/plugins/lsp/aerial.lua b/nvim/lua/plugins/lsp/aerial.lua deleted file mode 100644 index e5e6f6a..0000000 --- a/nvim/lua/plugins/lsp/aerial.lua +++ /dev/null @@ -1,33 +0,0 @@ ---- lua_post_source {{{ -require("aerial").setup({ - layout = { - -- These control the width of the aerial window. - -- They can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) - -- min_width and max_width can be a list of mixed types. - -- max_width = {40, 0.2} means "the lesser of 40 columns or 20% of total" - max_width = { 50, 0.2 }, - width = nil, - min_width = 30, - - -- key-value pairs of window-local options for aerial window (e.g. winhl) - win_opts = {}, - - -- Determines the default direction to open the aerial window. The 'prefer' - -- options will open the window in the other direction *if* there is a - -- different buffer in the way of the preferred direction - -- Enum: prefer_right, prefer_left, right, left, float - default_direction = "prefer_right", - - -- Determines where the aerial window will be opened - -- edge - open aerial at the far right/left of the editor - -- window - open aerial to the right/left of the current window - placement = "window", - - -- When the symbols change, resize the aerial window (within min/max constraints) to fit - resize_to_content = true, - - -- Preserve window size equality with (:help CTRL-W_=) - preserve_equality = false, - } -}) ---- }}} diff --git a/nvim/lua/plugins/lsp/dein_lazy.toml b/nvim/lua/plugins/lsp/dein_lazy.toml deleted file mode 100644 index 76e39a1..0000000 --- a/nvim/lua/plugins/lsp/dein_lazy.toml +++ /dev/null @@ -1,19 +0,0 @@ -[[plugins]] -repo = 'williamboman/mason-lspconfig.nvim' -on_event = 'VimEnter' - -[[plugins]] -repo = 'williamboman/mason.nvim' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/lsp/mason.lua' - -[[plugins]] -repo = 'neovim/nvim-lspconfig' -on_event = 'VimEnter' -depends = ['mason-lspconfig.nvim', 'cmp-nvim-lsp'] -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/lsp/nvim-lspconfig.lua' - -[[plugins]] -repo = 'stevearc/aerial.nvim' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/lsp/aerial.lua' diff --git a/nvim/lua/plugins/lsp/mason.lua b/nvim/lua/plugins/lsp/mason.lua deleted file mode 100644 index 0917c92..0000000 --- a/nvim/lua/plugins/lsp/mason.lua +++ /dev/null @@ -1,11 +0,0 @@ ---- lua_post_source {{{ -require("mason").setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - } - } -}) ---- }}} diff --git a/nvim/lua/plugins/lsp/nvim-lspconfig.lua b/nvim/lua/plugins/lsp/nvim-lspconfig.lua deleted file mode 100644 index 8f73479..0000000 --- a/nvim/lua/plugins/lsp/nvim-lspconfig.lua +++ /dev/null @@ -1,71 +0,0 @@ ---- lua_post_source {{{ -local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - - local opts = { noremap = true, silent = true } - buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) - buf_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) - buf_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) - buf_set_keymap("n", "gvd", ":vsplua vim.lsp.buf.definition()", opts) - buf_set_keymap("n", "gsd", ":splua vim.lsp.buf.definition()", opts) - buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) - buf_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) - buf_set_keymap('n', 'gt', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap("n", "gn", "lua vim.lsp.buf.rename()", opts) - buf_set_keymap("n", "gf", "lua vim.lsp.buf.format { async = true }", opts) - buf_set_keymap('n', 'ge', 'lua vim.diagnostic.open_float()', opts) - buf_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) - buf_set_keymap("n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) - buf_set_keymap("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) - buf_set_keymap("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) - buf_set_keymap("n", "D", "lua vim.lsp.buf.type_definition()", opts) - buf_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", opts) - buf_set_keymap("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) - buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) - buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) - buf_set_keymap("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) -end - -local capabilities = require('cmp_nvim_lsp').default_capabilities() -capabilities.textDocument.completion.completionItem.snippetSupport = true - -vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( - vim.lsp.diagnostic.on_publish_diagnostics, { - underline = true, - virtual_text = true, - signs = true, - update_in_insert = false, - } -) --- diagnostic sign setting -local signs = { Error = "🙅", Warn = "⚠️", Hint = "💡", Info = "🙋" } -for type, icon in pairs(signs) do - local hl = "DiagnosticSign" .. type - vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) -end - -local nvim_lsp = require("lspconfig") --- require("mason-lspconfig").setup() -require("mason-lspconfig").setup_handlers { - function(server_name) - local opt = { - on_attach = on_attach, - capabilities = capabilities, - } - if server_name == "gopls" then - opt.settings = { - gopls = { - env = { GOFLAGS = "-tags=integration,!integration,wireinject" }, - gofumpt = true, - }, - } - elseif server_name == "tsserver" then - -- package.json と deno.json があるディレクトリ場合は tsserver を使う - opt.root_dir = nvim_lsp.util.root_pattern("package.json") - elseif server_name == "denols" then - opt.root_dir = nvim_lsp.util.root_pattern("deno.json") - end - nvim_lsp[server_name].setup(opt) - end -} ---- }}} diff --git a/nvim/lua/plugins/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..f01ccc2 --- /dev/null +++ b/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,103 @@ +return { + "neovim/nvim-lspconfig", + event = { "BufReadPre", "BufNewFile" }, + dependencies = { + "hrsh7th/cmp-nvim-lsp", + { "folke/neodev.nvim", opts = {} }, + }, + config = function() + local nvim_lsp = require("lspconfig") + local mason_lspconfig = require("mason-lspconfig") + + local protocol = require("vim.lsp.protocol") + + local on_attach = function(client, bufnr) + -- keybindings + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + + local opts = { noremap = true, silent = true } + buf_set_keymap("n", "K", "lua vim.lsp.buf.hover()", opts) + buf_set_keymap("n", "gD", "lua vim.lsp.buf.declaration()", opts) + buf_set_keymap("n", "gd", "lua vim.lsp.buf.definition()", opts) + buf_set_keymap("n", "gvd", ":vsplua vim.lsp.buf.definition()", opts) + buf_set_keymap("n", "gsd", ":splua vim.lsp.buf.definition()", opts) + buf_set_keymap("n", "gi", "lua vim.lsp.buf.implementation()", opts) + buf_set_keymap("n", "gr", "lua vim.lsp.buf.references()", opts) + buf_set_keymap('n', 'gt', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap("n", "gn", "lua vim.lsp.buf.rename()", opts) + buf_set_keymap("n", "gf", "lua vim.lsp.buf.format { async = true }", opts) + buf_set_keymap('n', 'ge', 'lua vim.diagnostic.open_float()', opts) + buf_set_keymap("n", "", "lua vim.lsp.buf.signature_help()", opts) + buf_set_keymap("n", "wa", "lua vim.lsp.buf.add_workspace_folder()", opts) + buf_set_keymap("n", "wr", "lua vim.lsp.buf.remove_workspace_folder()", opts) + buf_set_keymap("n", "wl", "lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))", opts) + buf_set_keymap("n", "D", "lua vim.lsp.buf.type_definition()", opts) + buf_set_keymap("n", "ca", "lua vim.lsp.buf.code_action()", opts) + buf_set_keymap("n", "e", "lua vim.lsp.diagnostic.show_line_diagnostics()", opts) + buf_set_keymap("n", "[d", "lua vim.lsp.diagnostic.goto_prev()", opts) + buf_set_keymap("n", "]d", "lua vim.lsp.diagnostic.goto_next()", opts) + buf_set_keymap("n", "q", "lua vim.lsp.diagnostic.set_loclist()", opts) + -- format on save + if client.server_capabilities.documentFormattingProvider then + vim.api.nvim_create_autocmd("BufWritePre", { + group = vim.api.nvim_create_augroup("Format", { clear = true }), + buffer = bufnr, + callback = function() + vim.lsp.buf.format() + end, + }) + end + end + + local signs = { Error = "🙅", Warn = "⚠️", Hint = "💡", Info = "🙋" } + for type, icon in pairs(signs) do + local hl = "DiagnosticSign" .. type + vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl }) + end + + local capabilities = require("cmp_nvim_lsp").default_capabilities() + mason_lspconfig.setup_handlers({ + function(server) + nvim_lsp[server].setup({ + capabilities = capabilities, + }) + end, + ["cssls"] = function() + nvim_lsp["cssls"].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + ["tailwindcss"] = function() + nvim_lsp["tailwindcss"].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + ["html"] = function() + nvim_lsp["html"].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + ["jsonls"] = function() + nvim_lsp["jsonls"].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + ["eslint"] = function() + nvim_lsp["eslint"].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + ["pyright"] = function() + nvim_lsp["pyright"].setup({ + on_attach = on_attach, + capabilities = capabilities, + }) + end, + }) + end, +} diff --git a/nvim/lua/plugins/lualine.lua b/nvim/lua/plugins/lualine.lua new file mode 100644 index 0000000..0e51811 --- /dev/null +++ b/nvim/lua/plugins/lualine.lua @@ -0,0 +1,213 @@ +return { + "nvim-lualine/lualine.nvim", + dependencies = { "nvim-tree/nvim-web-devicons" }, + config = function() + + local lualine = require('lualine') + -- Color table for highlights + -- stylua: ignore + local colors = { + bg = '#202328', + fg = '#bbc2cf', + yellow = '#ECBE7B', + cyan = '#008080', + darkblue = '#081633', + green = '#98be65', + orange = '#FF8800', + violet = '#a9a1e1', + magenta = '#c678dd', + blue = '#51afef', + red = '#ec5f67', + } + local conditions = { + buffer_not_empty = function() + return vim.fn.empty(vim.fn.expand('%:t')) ~= 1 + end, + hide_in_width = function() + return vim.fn.winwidth(0) > 80 + end, + check_git_workspace = function() + local filepath = vim.fn.expand('%:p:h') + local gitdir = vim.fn.finddir('.git', filepath .. ';') + return gitdir and #gitdir > 0 and #gitdir < #filepath + end, + } + + -- Config + local config = { + options = { + -- Disable sections and component separators + component_separators = '', + section_separators = '', + theme = { + -- We are going to use lualine_c an lualine_x as left and + -- right section. Both are highlighted by c theme . So we + -- are just setting default looks o statusline + normal = { c = { fg = colors.fg, bg = colors.bg } }, + inactive = { c = { fg = colors.fg, bg = colors.bg } }, + }, + }, + sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + -- These will be filled later + lualine_c = {}, + lualine_x = {}, + }, + inactive_sections = { + -- these are to remove the defaults + lualine_a = {}, + lualine_b = {}, + lualine_y = {}, + lualine_z = {}, + lualine_c = {}, + lualine_x = {}, + }, + } + + -- Inserts a component in lualine_c at left section + local function ins_left(component) + table.insert(config.sections.lualine_c, component) + end + + -- Inserts a component in lualine_x at right section + local function ins_right(component) + table.insert(config.sections.lualine_x, component) + end + + ins_left { + function() + return '▊' + end, + color = { fg = colors.blue }, -- Sets highlighting of component + padding = { left = 0, right = 1 }, -- We don't need space before this + } + + ins_left { + -- mode component + function() + return '' + end, + color = function() + -- auto change color according to neovims mode + local mode_color = { + n = colors.red, + i = colors.green, + v = colors.blue, + [''] = colors.blue, + V = colors.blue, + c = colors.magenta, + no = colors.red, + s = colors.orange, + S = colors.orange, + [''] = colors.orange, + ic = colors.yellow, + R = colors.violet, + Rv = colors.violet, + cv = colors.red, + ce = colors.red, + r = colors.cyan, + rm = colors.cyan, + ['r?'] = colors.cyan, + ['!'] = colors.red, + t = colors.red, + } + return { fg = mode_color[vim.fn.mode()] } + end, + padding = { right = 1 }, + } + ins_left { + -- filesize component + 'filesize', + cond = conditions.buffer_not_empty, + } + ins_left { + 'filename', + cond = conditions.buffer_not_empty, + color = { fg = colors.magenta, gui = 'bold' }, + } + ins_left { 'location' } + ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } } + ins_left { + 'diagnostics', + sources = { 'nvim_diagnostic' }, + symbols = { error = ' ', warn = ' ', info = ' ' }, + diagnostics_color = { + error = { fg = colors.red }, + warn = { fg = colors.yellow }, + info = { fg = colors.cyan }, + }, + } + -- Insert mid section. You can make any number of sections in neovim :) + -- for lualine it's any number greater then 2 + ins_left { + function() + return '%=' + end, + } + ins_left { + -- Lsp server name . + function() + local msg = 'No Active Lsp' + local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + local clients = vim.lsp.get_active_clients() + if next(clients) == nil then + return msg + end + for _, client in ipairs(clients) do + local filetypes = client.config.filetypes + if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + return client.name + end + end + return msg + end, + icon = ' LSP:', + color = { fg = '#ffffff', gui = 'bold' }, + } + + -- Add components to right sections + ins_right { + 'o:encoding', -- option component same as &encoding in viml + fmt = string.upper, -- I'm not sure why it's upper case either ;) + cond = conditions.hide_in_width, + color = { fg = colors.green, gui = 'bold' }, + } + ins_right { + 'fileformat', + fmt = string.upper, + icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh + color = { fg = colors.green, gui = 'bold' }, + } + ins_right { + 'branch', + icon = '', + color = { fg = colors.violet, gui = 'bold' }, + } + ins_right { + 'diff', + -- Is it me or the symbol for modified us really weird + symbols = { added = ' ', modified = '󰝤 ', removed = ' ' }, + diff_color = { + added = { fg = colors.green }, + modified = { fg = colors.orange }, + removed = { fg = colors.red }, + }, + cond = conditions.hide_in_width, + } + ins_right { + function() + return '▊' + end, + color = { fg = colors.blue }, + padding = { left = 1 }, + } + + -- Now don't forget to initialize lualine + lualine.setup(config) + + end, +} diff --git a/nvim/lua/plugins/mason.lua b/nvim/lua/plugins/mason.lua new file mode 100644 index 0000000..2fc2bb1 --- /dev/null +++ b/nvim/lua/plugins/mason.lua @@ -0,0 +1,45 @@ +return { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "WhoIsSethDaniel/mason-tool-installer.nvim", + }, + config = function() + require("mason").setup() + + require("mason-lspconfig").setup({ + automatic_installation = true, + ensure_installed = { + "cssls", + "eslint", + "html", + "jsonls", + -- "tsserver", + "pyright", + "tailwindcss", + }, + }) + + require("mason-tool-installer").setup({ + ensure_installed = { + "stylua", -- lua formatter + "black", -- python formatter + 'lua-language-server', + 'vim-language-server', + 'gopls', + 'gofumpt', + 'golines', + 'gomodifytags', + 'gotests', + 'impl', + 'json-to-struct', + 'shellcheck', + }, + integrations = { + ['mason-lspconfig'] = true, + ['mason-null-ls'] = false, + ['mason-nvim-dap'] = false, + }, + }) + end, +} diff --git a/nvim/lua/plugins/nvim-hlslens.lua b/nvim/lua/plugins/nvim-hlslens.lua new file mode 100644 index 0000000..1dcc85a --- /dev/null +++ b/nvim/lua/plugins/nvim-hlslens.lua @@ -0,0 +1,35 @@ +return { + "kevinhwang91/nvim-hlslens", + config = function() + require('hlslens').setup({ + override_lens = function(render, posList, nearest, idx, relIdx) + local sfw = vim.v.searchforward == 1 + local indicator, text, chunks + local absRelIdx = math.abs(relIdx) + if absRelIdx > 1 then + indicator = ('%d%s'):format(absRelIdx, sfw ~= (relIdx > 1) and '▲' or '▼') + elseif absRelIdx == 1 then + indicator = sfw ~= (relIdx == 1) and '▲' or '▼' + else + indicator = '' + end + + local lnum, col = unpack(posList[idx]) + if nearest then + local cnt = #posList + if indicator ~= '' then + text = ('[%s %d/%d]'):format(indicator, idx, cnt) + else + text = ('[%d/%d]'):format(idx, cnt) + end + chunks = {{' '}, {text, 'HlSearchLensNear'}} + else + text = ('[%s %d]'):format(indicator, idx) + chunks = {{' '}, {text, 'HlSearchLens'}} + end + render.setVirt(0, lnum - 1, col - 1, chunks, nearest) + end + }) + end, +} + diff --git a/nvim/lua/plugins/oil.lua b/nvim/lua/plugins/oil.lua new file mode 100644 index 0000000..bd61f0e --- /dev/null +++ b/nvim/lua/plugins/oil.lua @@ -0,0 +1,185 @@ +return { + 'stevearc/oil.nvim', + event = 'VimEnter', + setup = function() + require("oil").setup({ + -- Oil will take over directory buffers (e.g. `vim .` or `:e src/`) + -- Set to false if you still want to use netrw. + default_file_explorer = true, + -- Id is automatically added at the beginning, and name at the end + -- See :help oil-columns + columns = { + "icon", + -- "permissions", + -- "size", + -- "mtime", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + lsp_file_methods = { + -- Time to wait for LSP file operations to complete before skipping + timeout_ms = 1000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + autosave_changes = false, + }, + -- Constrain the cursor to the editable parts of the oil buffer + -- Set to `false` to disable, or "name" to keep it on the file names + constrain_cursor = "editable", + -- Set to true to watch the filesystem for changes and reload oil + experimental_watch_for_changes = false, + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("oil.actions"). + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = "actions.select_vsplit", + [""] = "actions.select_split", + [""] = "actions.select_tab", + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = "actions.tcd", + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + ["g\\"] = "actions.toggle_trash", + }, + -- Set to false to disable all of the above keymaps + use_default_keymaps = true, + view_options = { + -- Show files and directories that start with "." + show_hidden = false, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + -- Sort file names in a more intuitive order for humans. Is less performant, + -- so you may want to set to false if you work with large directories. + natural_order = true, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + }, + -- Extra arguments to pass to SCP when moving/copying files over SSH + extra_scp_args = {}, + -- EXPERIMENTAL support for performing file operations with git + git = { + -- Return true to automatically git add/mv/rm files + add = function(path) + return false + end, + mv = function(src_path, dest_path) + return false + end, + rm = function(path) + return false + end, + }, + -- Configuration for the floating window in oil.open_float + float = { + -- Padding around the floating window + padding = 2, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { + winblend = 0, + }, + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + override = function(conf) + return conf + end, + }, + -- Configuration for the actions floating preview window + preview = { + -- Width dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_width and max_width can be a single value or a list of mixed integer/float types. + -- max_width = {100, 0.8} means "the lesser of 100 columns or 80% of total" + max_width = 0.9, + -- min_width = {40, 0.4} means "the greater of 40 columns or 40% of total" + min_width = { 40, 0.4 }, + -- optionally define an integer/float for the exact width of the preview window + width = nil, + -- Height dimensions can be integers or a float between 0 and 1 (e.g. 0.4 for 40%) + -- min_height and max_height can be a single value or a list of mixed integer/float types. + -- max_height = {80, 0.9} means "the lesser of 80 columns or 90% of total" + max_height = 0.9, + -- min_height = {5, 0.1} means "the greater of 5 columns or 10% of total" + min_height = { 5, 0.1 }, + -- optionally define an integer/float for the exact height of the preview window + height = nil, + border = "rounded", + win_options = { + winblend = 0, + }, + -- Whether the preview window is automatically updated when the cursor is moved + update_on_cursor_moved = true, + }, + -- Configuration for the floating progress window + progress = { + max_width = 0.9, + min_width = { 40, 0.4 }, + width = nil, + max_height = { 10, 0.9 }, + min_height = { 5, 0.1 }, + height = nil, + border = "rounded", + minimized_border = "none", + win_options = { + winblend = 0, + }, + }, + -- Configuration for the floating SSH window + ssh = { + border = "rounded", + }, + -- Configuration for the floating keymaps help window + keymaps_help = { + border = "rounded", + }, + }) + + vim.keymap.set("n", "-", "Oil", { desc = "Open parent directory" }) + end +} diff --git a/nvim/lua/plugins/quick-scope.lua b/nvim/lua/plugins/quick-scope.lua new file mode 100644 index 0000000..20c305c --- /dev/null +++ b/nvim/lua/plugins/quick-scope.lua @@ -0,0 +1,18 @@ +return { + 'unblevable/quick-scope', + event = 'VimEnter', + setup = function() + vim.cmd [[ + augroup qs_colors + autocmd! + autocmd ColorScheme * highlight QuickScopePrimary guifg='#afff5f' gui=underline ctermfg=155 cterm=underline + autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline + augroup END + ]] + + vim.g.qs_hi_priority = 2 + vim.g.qs_max_chars = 80 + vim.g.qs_lazy_highlight = 0 + vim.g.qs_buftype_blacklist = { "terminal", "nofile" } + end, +} diff --git a/nvim/lua/plugins/telescope.lua b/nvim/lua/plugins/telescope.lua new file mode 100644 index 0000000..facfa2b --- /dev/null +++ b/nvim/lua/plugins/telescope.lua @@ -0,0 +1,16 @@ +return { + "nvim-telescope/telescope.nvim", + tag = "0.1.8", + dependencies = { "nvim-lua/plenary.nvim" }, + config = function() + require("telescope").setup({}) + + local keymap = vim.keymap + + keymap.set("n", "ff", "Telescope find_files", { desc = "Fuzzy find files in cwd" }) + keymap.set("n", "g", "Telescope live_grep", { desc = "Fuzzy find recent files" }) + keymap.set("n", "b", "Telescope buffers", { desc = "Find string in cwd" }) + keymap.set("n", "gs", "Telescope git_status", { desc = "Find string under cursor in cwd" }) + keymap.set("n", "gc", "Telescope git commits", { desc = "Find todos" }) + end, +} diff --git a/nvim/lua/plugins/treesitter.lua b/nvim/lua/plugins/treesitter.lua new file mode 100644 index 0000000..54b8070 --- /dev/null +++ b/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,100 @@ +return { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + dependencies = { + "windwp/nvim-ts-autotag", + "m-demare/hlargs.nvim", + "nvim-treesitter/nvim-treesitter-context", + }, + config = function() + local treesitter = require("nvim-treesitter.configs") + + treesitter.setup({ + highlight = { + enable = true, + additional_vim_regex_highlighting = false, + }, + indent = { enable = true }, + autotag = { + enable = true, + }, + ensure_installed = { + "json", + "javascript", + "typescript", + "tsx", + "yaml", + "html", + "css", + "markdown", + "markdown_inline", + "bash", + "lua", + "vim", + "dockerfile", + "gitignore", + "c", + "rust", + "go", + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "", + node_incremental = "", + scope_incremental = false, + node_decremental = "", + }, + }, + rainbow = { + enable = true, + disable = { "html" }, + extended_mode = false, + max_file_lines = nil, + }, + context_commentstring = { + enable = true, + enable_autocmd = false, + }, + }) + + require('hlargs').setup() + + vim.cmd("hi TreesitterContextBottom gui=underline guisp=Grey") + require('treesitter-context').setup { + patterns = { + default = { + 'class', + 'function', + 'method', + 'interface', + 'struct', + }, + haskell = { + 'adt' + }, + rust = { + 'impl_item', + }, + terraform = { + 'block', + 'object_elem', + 'attribute', + }, + markdown = { + 'section', + }, + json = { + 'pair', + }, + typescript = { + 'export_statement', + }, + yaml = { + 'block_mapping_pair', + }, + }, + } + end, +} diff --git a/nvim/lua/plugins/treesitter/dein_lazy.toml b/nvim/lua/plugins/treesitter/dein_lazy.toml deleted file mode 100644 index 8c86d10..0000000 --- a/nvim/lua/plugins/treesitter/dein_lazy.toml +++ /dev/null @@ -1,17 +0,0 @@ -[[plugins]] -repo = 'nvim-treesitter/nvim-treesitter' -on_event = 'BufEnter' -# hook_post_update = 'TSUpdate' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/treesitter/nvim-treesitter.lua' - -[[plugins]] -repo = 'm-demare/hlargs.nvim' -depends = ['nvim-treesitter'] -lua_post_source = ''' - require('hlargs').setup() -''' - -[[plugins]] -repo = 'nvim-treesitter/nvim-treesitter-context' -depends = ['nvim-treesitter'] -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/treesitter/nvim-treesitter-context.lua' diff --git a/nvim/lua/plugins/treesitter/nvim-treesitter-context.lua b/nvim/lua/plugins/treesitter/nvim-treesitter-context.lua deleted file mode 100644 index 76e80e0..0000000 --- a/nvim/lua/plugins/treesitter/nvim-treesitter-context.lua +++ /dev/null @@ -1,38 +0,0 @@ ---- lua_source {{{ -vim.cmd("hi TreesitterContextBottom gui=underline guisp=Grey") -require 'treesitter-context'.setup { - patterns = { - default = { - 'class', - 'function', - 'method', - 'interface', - 'struct', - }, - haskell = { - 'adt' - }, - rust = { - 'impl_item', - - }, - terraform = { - 'block', - 'object_elem', - 'attribute', - }, - markdown = { - 'section', - }, - json = { - 'pair', - }, - typescript = { - 'export_statement', - }, - yaml = { - 'block_mapping_pair', - }, - }, -} ---- }}} diff --git a/nvim/lua/plugins/treesitter/nvim-treesitter.lua b/nvim/lua/plugins/treesitter/nvim-treesitter.lua deleted file mode 100644 index 9705c3c..0000000 --- a/nvim/lua/plugins/treesitter/nvim-treesitter.lua +++ /dev/null @@ -1,26 +0,0 @@ ---- lua_source {{{ -local pasers_path = vim.fn.expand("$XDG_CACHE_HOME/nvim/treesitter/parsers") -vim.opt.runtimepath:append(pasers_path) - -require 'nvim-treesitter.configs'.setup { - parser_install_dir = pasers_path, - ensure_installed = { "lua", "go", "python", "bash", "typescript", "yaml", "json", "vim", "hcl", "rust", "toml", "proto" }, - sync_install = false, - auto_install = true, - highlight = { - enable = true, - -- filesize で現状そんなに問題がないので一旦コメントアウトして様子を見る。問題なかったら完全に消す。 - -- disable = function(_, buf) - -- local max_filesize = 100 * 1024 -- 100 KB - -- local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) - -- if ok and stats and stats.size > max_filesize then - -- return true - -- end - -- end, - additional_vim_regex_highlighting = false, - }, - indent = { - enable = true, - } -} ---- }}} diff --git a/nvim/lua/plugins/ui/dein_lazy.toml b/nvim/lua/plugins/ui/dein_lazy.toml deleted file mode 100644 index 55c535b..0000000 --- a/nvim/lua/plugins/ui/dein_lazy.toml +++ /dev/null @@ -1,20 +0,0 @@ -[[plugins]] -repo = 'shellRaining/hlchunk.nvim' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/ui/hlchunk.lua' - -[[plugins]] -repo = 'ntpeters/vim-better-whitespace' -on_event = 'VimEnter' - -[[plugins]] -repo = 'kevinhwang91/nvim-hlslens' -on_event = 'VimEnter' -hooks_file = '$XDG_CONFIG_HOME/nvim/lua/plugins/ui/nvim-hlslens.lua' - -[[plugins]] -repo = 'delphinus/auto-cursorline.nvim' -on_event = 'VimEnter' -lua_post_source = ''' - require("auto-cursorline").setup {} -''' diff --git a/nvim/lua/plugins/ui/hlchunk.lua b/nvim/lua/plugins/ui/hlchunk.lua deleted file mode 100644 index c2242af..0000000 --- a/nvim/lua/plugins/ui/hlchunk.lua +++ /dev/null @@ -1,13 +0,0 @@ ---- lua_post_source {{{ -require("hlchunk").setup({ - indent = { - enable = false, - }, - line_num = { - enable = false, - }, - blank = { - enable = false, - }, -}) ---- }}} diff --git a/nvim/lua/plugins/ui/nvim-hlslens.lua b/nvim/lua/plugins/ui/nvim-hlslens.lua deleted file mode 100644 index c2ec1a9..0000000 --- a/nvim/lua/plugins/ui/nvim-hlslens.lua +++ /dev/null @@ -1,31 +0,0 @@ ---- lua_post_source {{{ -require('hlslens').setup({ - override_lens = function(render, posList, nearest, idx, relIdx) - local sfw = vim.v.searchforward == 1 - local indicator, text, chunks - local absRelIdx = math.abs(relIdx) - if absRelIdx > 1 then - indicator = ('%d%s'):format(absRelIdx, sfw ~= (relIdx > 1) and '▲' or '▼') - elseif absRelIdx == 1 then - indicator = sfw ~= (relIdx == 1) and '▲' or '▼' - else - indicator = '' - end - - local lnum, col = unpack(posList[idx]) - if nearest then - local cnt = #posList - if indicator ~= '' then - text = ('[%s %d/%d]'):format(indicator, idx, cnt) - else - text = ('[%d/%d]'):format(idx, cnt) - end - chunks = {{' '}, {text, 'HlSearchLensNear'}} - else - text = ('[%s %d]'):format(indicator, idx) - chunks = {{' '}, {text, 'HlSearchLens'}} - end - render.setVirt(0, lnum - 1, col - 1, chunks, nearest) - end -}) ----}}} diff --git a/nvim/lua/scripts/list_loaded_plugins.lua b/nvim/lua/scripts/list_loaded_plugins.lua deleted file mode 100644 index 3fe9648..0000000 --- a/nvim/lua/scripts/list_loaded_plugins.lua +++ /dev/null @@ -1,26 +0,0 @@ -local function list_github_plugins() - local scriptnames = vim.fn.execute(':scriptnames') - local lines = vim.split(scriptnames, '\n') - - local github_repos = {} - local seen = {} - - for _, line in ipairs(lines) do - local match = line:match("github%.com/[^/]+/[^/]+") - if match and not seen[match] then - seen[match] = true - table.insert(github_repos, match) - end - end - - if #github_repos > 0 then - print("Loaded plugins from github.com (" .. #github_repos .. "):") - for index, repo in ipairs(github_repos) do - print(index .. ". " .. repo) - end - else - print("No plugins from github.com are loaded.") - end -end - -vim.api.nvim_create_user_command('ListGitHubPlugins', list_github_plugins, {}) diff --git a/nvim/lua/settings/usercmd.lua b/nvim/lua/settings/usercmd.lua deleted file mode 100644 index 5385fb6..0000000 --- a/nvim/lua/settings/usercmd.lua +++ /dev/null @@ -1,2 +0,0 @@ -vim.api.nvim_create_user_command("Sterm", function() vim.cmd(":split | resize 20 | term ") end, {}) -vim.api.nvim_create_user_command("Vterm", function() vim.cmd [[ :vsplit | term ]] end, {}) diff --git a/nvim/setup.sh b/nvim/setup.sh deleted file mode 100644 index 855912f..0000000 --- a/nvim/setup.sh +++ /dev/null @@ -1,16 +0,0 @@ -mkdir -p ~/.cache/dpp/repos/github.com/ -cd ~/.cache/dpp/repos/github.com/ - -mkdir Shougo -mkdir vim-denops - -cd ./Shougo -git clone https://github.com/Shougo/dpp.vim - -git clone https://github.com/Shougo/dpp-ext-installer -git clone https://github.com/Shougo/dpp-protocol-git -git clone https://github.com/Shougo/dpp-ext-lazy -git clone https://github.com/Shougo/dpp-ext-toml - -cd ../vim-denops -git clone https://github.com/vim-denops/denops.vim diff --git a/nvim/snippets/global.json b/nvim/snippets/global.json deleted file mode 100644 index 72ab21d..0000000 --- a/nvim/snippets/global.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "uuid": { - "prefix": "uuid", - "body": [ - "${VIM:system('python3 -c \"import uuid, sys;sys.stdout.write(str(uuid.uuid4()))\"')}" - ] - }, - "unixtime": { - "prefix": "unixtime", - "body": [ - "${VIM:strftime('%s')}" - ] - }, - "datetime": { - "prefix": "datetime", - "body": [ - "${VIM:strftime('%Y-%m-%d %H:%M:%S')}" - ] - }, - "date": { - "prefix": "date", - "body": [ - "${VIM:strftime('%Y-%m-%d')}" - ] - }, - "pwd": { - "prefix": "pwd", - "body": [ - "${VIM:expand('%:p:h')}" - ] - } -} diff --git a/nvim/snippets/go.json b/nvim/snippets/go.json deleted file mode 100644 index ef13d5c..0000000 --- a/nvim/snippets/go.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "iferr": { - "prefix": "iferr", - "description": "Expansion `if err != nil ...`", - "body": [ - "if err != nil {", - "\t$1", - "}" - ] - }, - "multiple imports": { - "prefix": "ims", - "body": "import (\n\t\"${1:package}\"\n)", - "description": "Snippet for a import block" - }, - "multiple constants": { - "prefix": "cos", - "body": "const (\n\t${1:name} = ${2:value}\n)", - "description": "Snippet for a constant block" - }, - "variables declaration": { - "prefix": "vars", - "body": "var (\n\t${1:name} ${2:type} = ${3:value}\n)", - "description": "Snippet for a variable" - }, - "error return": { - "prefix": "rerr", - "description": "if err != nil { return err }", - "body": [ - "if err != nil {", - "\treturn err", - "}" - ] - }, - "error panic": { - "prefix": "perr", - "description": "if err != nil { return panic(err) }", - "body": [ - "if err != nil {", - "\tpanic(err)", - "}" - ] - }, - "tdd func": { - "prefix": "ftdd", - "description": "table driven test", - "body": [ - "func Test$1(t *testing.T) {", - "\tt.Parallel()", - "", - "\tpatterns := []struct {", - "\t\tname string", - "\t}{", - "\t\t{", - "\t\t\tname: \"success\",", - "\t\t},", - "\t}", - "", - "\tfor _, tt := range patterns {", - "\t\ttt := tt", - "\t\tt.Run(tt.name, func(t *testing.T) {", - "\t\t\tt.Parallel()", - "", - "\t\t\t$3", - "\t\t})", - "\t}", - "}" - ] - }, - "empty func": { - "prefix": "func", - "description": "empty func", - "body": [ - "func $1() {", - "\t$2", - "}" - ] - }, - "goroutine anonymous function": { - "prefix": "go", - "body": "go func($1) {\n\t$0\n}($2)", - "description": "Snippet for anonymous goroutine declaration" - }, - "graceful shutdown": { - "prefix": "shutdown", - "description": "graceful shutdown", - "body": [ - "ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT)", - "defer cancel()", - "<-ctx.Done()", - "log.Info(\"root context canceled, shutdown\")" - ] - }, - "check interface": { - "prefix": "ifcheck", - "description": "inteface check", - "body": [ - "var _ ${1:interface} = (*${2:struct})(nil)" - ] - }, - "type function declaration": { - "prefix": "tyf", - "body": "type ${1:name} func($3) $4", - "description": "Snippet for a type function declaration" - }, - "type interface declaration": { - "prefix": "tyi", - "body": "type ${1:name} interface {\n\t$0\n}", - "description": "Snippet for a type interface" - }, - "type struct declaration": { - "prefix": "tys", - "body": "type ${1:name} struct {\n\t$0\n}", - "description": "Snippet for a struct declaration" - }, - "switch statement": { - "prefix": "switch", - "body": "switch ${1:expression} {\ncase ${2:condition}:\n\t$0\n}", - "description": "Snippet for switch statement" - }, - "make(...)": { - "prefix": "make", - "body": "make(${1:type}, ${2:0})", - "description": "Snippet for make statement" - }, - "new(...)": { - "prefix": "new", - "body": "new(${1:type})", - "description": "Snippet for new statement" - } -}