2023-08-17 14:14:00 +09:00
|
|
|
|
----GENERAL SETTINGS
|
|
|
|
|
local opt = vim.opt
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.g.mapleader = " "
|
|
|
|
|
opt.helplang = "ja", "en"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.tabstop = 2
|
|
|
|
|
opt.shiftwidth = 2
|
|
|
|
|
opt.expandtab = true
|
|
|
|
|
opt.list = true
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.listchars = { tab = "»-", trail = "-", eol = "↲", extends = "»", precedes = "«", nbsp = "%" }
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.wrap = true
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.signcolumn = "yes"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.smartcase = true
|
|
|
|
|
opt.ignorecase = true
|
|
|
|
|
opt.wrapscan = true
|
|
|
|
|
opt.hidden = true
|
|
|
|
|
opt.startofline = false
|
|
|
|
|
opt.showmatch = true
|
|
|
|
|
opt.matchtime = 1
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.guicursor = ""
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.cursorline = true
|
|
|
|
|
opt.wildmenu = true
|
|
|
|
|
opt.number = true
|
|
|
|
|
opt.showcmd = true
|
|
|
|
|
opt.autoread = true
|
|
|
|
|
opt.hlsearch = true
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.backspace:append({ "indent", "eol", "start" })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.showtabline = 1
|
|
|
|
|
opt.laststatus = 3
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.ambiwidth = "single"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.confirm = true
|
2023-12-30 08:06:09 +09:00
|
|
|
|
opt.pumblend = 0
|
|
|
|
|
opt.winblend = 0
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.mouse = "a"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.cmdheight = 2
|
|
|
|
|
opt.timeout = true
|
|
|
|
|
opt.ttimeout = true
|
|
|
|
|
opt.ttimeoutlen = 10
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.clipboard:append({ "unnamedplus" })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.termguicolors = true
|
|
|
|
|
opt.showmode = false
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.completeopt:append({ "menuone", "noinsert" })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
opt.backup = false
|
|
|
|
|
opt.swapfile = false
|
2023-11-23 10:06:38 +09:00
|
|
|
|
opt.encoding = "utf-8"
|
|
|
|
|
opt.fileencodings = { "utf-8", "iso-2022-jp", "cp932", "euc-jp", "sjis" }
|
|
|
|
|
vim.opt.shortmess:append("I")
|
|
|
|
|
vim.cmd("set completeopt-=preview")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
----ADVANCED SETTINGS
|
|
|
|
|
|
|
|
|
|
--KEEP CURSOR
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.api.nvim_create_autocmd({ "BufReadPost" }, {
|
|
|
|
|
pattern = { "*" },
|
|
|
|
|
callback = function()
|
|
|
|
|
vim.api.nvim_exec('silent! normal! g`"zv', false)
|
|
|
|
|
end,
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
----KEY MAPPING
|
|
|
|
|
|
|
|
|
|
--EDIT
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "ew", ":<C-u>w<CR>")
|
|
|
|
|
vim.keymap.set("n", "eq", ":<C-u>wq<CR>")
|
|
|
|
|
vim.keymap.set("n", "Q", ":<C-u>quit!<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>q", ":<C-u>bd<CR>")
|
|
|
|
|
vim.keymap.set("n", "<C-s>", ":<C-u>%s///cg<Left><Left><Left><Left>")
|
|
|
|
|
vim.keymap.set("n", "<C-c>", ":<C-u>echo wordcount()['chars']<CR>")
|
2024-09-27 10:00:13 +09:00
|
|
|
|
vim.keymap.set("v", "i<leader>", "iW")
|
|
|
|
|
vim.keymap.set("o", "i<leader>", "iW")
|
2024-09-20 13:21:07 +09:00
|
|
|
|
vim.keymap.set("n", "U", "<c-r>")
|
2024-09-27 10:00:13 +09:00
|
|
|
|
vim.keymap.set("i", "<C-g><C-u>", "<esc>gUiwgi")
|
|
|
|
|
vim.keymap.set("i", "<C-g><C-l>", "<esc>guiwgi")
|
|
|
|
|
vim.keymap.set("i", "<C-g><C-k>", "<esc>bgUlgi")
|
|
|
|
|
vim.keymap.set("n", "i", function()
|
|
|
|
|
return vim.fn.empty(vim.fn.getline(".")) == 1 and '"_cc' or "i"
|
|
|
|
|
end, { expr = true, noremap = true })
|
|
|
|
|
vim.keymap.set("n", "A", function()
|
|
|
|
|
return vim.fn.empty(vim.fn.getline(".")) == 1 and '"_cc' or "A"
|
|
|
|
|
end, { expr = true, noremap = true })
|
|
|
|
|
vim.keymap.set("n", "<C-k>", function()
|
2024-10-22 11:47:03 +09:00
|
|
|
|
return string.format("<cmd>move-1-%d<CR>=l", vim.v.count1)
|
2024-09-27 10:00:13 +09:00
|
|
|
|
end, { expr = true, noremap = true })
|
|
|
|
|
vim.keymap.set("n", "<C-j>", function()
|
2024-10-22 11:47:03 +09:00
|
|
|
|
return string.format("<cmd>move+%d<CR>=l", vim.v.count1)
|
2024-09-27 10:00:13 +09:00
|
|
|
|
end, { expr = true, noremap = true })
|
|
|
|
|
vim.keymap.set("v", "<C-k>", ":move'<-2<CR>gv=gv")
|
|
|
|
|
vim.keymap.set("v", "<C-j>", ":move'>+1<CR>gv=gv")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--TAB
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "<leader><TAB>", ":bprev<CR>", { silent = true })
|
|
|
|
|
vim.keymap.set("n", "<leader>t", ":tabclose<CR>", { silent = true })
|
|
|
|
|
vim.keymap.set("n", "]b", ":bnext<CR>", { silent = true })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--SPLIT
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "sv", ":<C-u>vsplit<CR>", { silent = true })
|
|
|
|
|
vim.keymap.set("n", "sp", ":<C-u>split<CR>", { silent = true })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--NOP
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "<MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "<2-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "<3-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "<4-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("i", "<1-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("i", "<2-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("i", "<3-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("i", "<4-MiddleMouse>", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "qq", "<Nop>")
|
|
|
|
|
vim.keymap.set("v", "qq", "<Nop")
|
|
|
|
|
vim.keymap.set("n", "gg", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "ZZ", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "ZQ", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "<C-z>", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "<F1>", "<Nop>")
|
|
|
|
|
vim.keymap.set("n", "x", '"_x')
|
|
|
|
|
vim.keymap.set("v", "x", '"_x')
|
2024-09-20 13:21:07 +09:00
|
|
|
|
vim.keymap.set("n", "X", '"_D')
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "s", '"_s')
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--MOVE
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "k", "gk")
|
|
|
|
|
vim.keymap.set("n", "j", "gj")
|
|
|
|
|
vim.keymap.set("n", "<UP>", "gk")
|
|
|
|
|
vim.keymap.set("n", "<DOWN>", "gj")
|
|
|
|
|
vim.keymap.set("n", "O", ":<C-u>call append(expand('.'), '')<CR>j")
|
|
|
|
|
vim.keymap.set("n", "sh", "<C-w>h")
|
|
|
|
|
vim.keymap.set("n", "sj", "<C-w>j")
|
|
|
|
|
vim.keymap.set("n", "sk", "<C-w>k")
|
|
|
|
|
vim.keymap.set("n", "sl", "<C-w>l")
|
|
|
|
|
vim.keymap.set("n", "sH", "<C-w>H")
|
|
|
|
|
vim.keymap.set("n", "sJ", "<C-w>J")
|
|
|
|
|
vim.keymap.set("n", "sK", "<C-w>K")
|
|
|
|
|
vim.keymap.set("n", "sL", "<C-w>L")
|
2024-09-29 09:23:31 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>m", "<plug>(matchup-%)")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--COPY
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "p", "]p")
|
|
|
|
|
vim.keymap.set("n", "P", "]P")
|
2024-09-20 13:21:07 +09:00
|
|
|
|
vim.keymap.set("v", "p", "P")
|
2024-09-27 10:00:13 +09:00
|
|
|
|
vim.keymap.set("v", "y", "mzy`z")
|
2024-10-22 11:47:03 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>o", "<cmd>copy.<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>O", "<cmd>copy-1<CR>")
|
2024-09-27 10:00:13 +09:00
|
|
|
|
vim.keymap.set("v", "<leader>o", ":copy'<-1<CR>gv")
|
|
|
|
|
vim.keymap.set("v", "<leader>O", ":copy'>+0<CR>gv")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
----PLUGINS
|
|
|
|
|
|
|
|
|
|
--MANAGER
|
2023-11-23 10:06:38 +09:00
|
|
|
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
2023-08-17 14:14:00 +09:00
|
|
|
|
if not vim.loop.fs_stat(lazypath) then
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.fn.system({
|
|
|
|
|
"git",
|
|
|
|
|
"clone",
|
|
|
|
|
"--filter=blob:none",
|
|
|
|
|
"https://github.com/folke/lazy.nvim.git",
|
|
|
|
|
"--branch=stable",
|
|
|
|
|
lazypath,
|
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
end
|
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("lazy").setup({
|
|
|
|
|
defaults = { lazy = true },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "nvim-lualine/lualine.nvim", event = "UIEnter" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "nvim-telescope/telescope.nvim", cmd = "Telescope" },
|
2023-11-29 10:13:21 +09:00
|
|
|
|
{
|
|
|
|
|
"nvim-telescope/telescope-fzf-native.nvim",
|
|
|
|
|
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build",
|
|
|
|
|
cmd = "Telescope",
|
|
|
|
|
},
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "nvim-telescope/telescope-file-browser.nvim", cmd = "Telescope file_browser" },
|
|
|
|
|
{ "lewis6991/gitsigns.nvim", config = true, event = "BufReadPre" },
|
|
|
|
|
{ "ryanoasis/vim-devicons", event = "UIEnter" },
|
|
|
|
|
{ "nvim-tree/nvim-web-devicons", event = "UIEnter" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "williamboman/mason.nvim", event = "BufRead", cmd = { "Mason", "MasonInstall" } },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "williamboman/mason-lspconfig.nvim", event = "BufReadPre" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "jay-babu/mason-null-ls.nvim", event = "LspAttach" },
|
2023-11-29 10:13:21 +09:00
|
|
|
|
{ "jay-babu/mason-nvim-dap.nvim", event = "LspAttach" },
|
2023-12-16 21:42:28 +09:00
|
|
|
|
{ "neovim/nvim-lspconfig", event = "BufReadPre" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "nvimtools/none-ls.nvim", event = "LspAttach" },
|
|
|
|
|
{ "mfussenegger/nvim-dap", event = "LspAttach" },
|
|
|
|
|
{ "rcarriga/nvim-dap-ui", event = "LspAttach" },
|
2024-05-16 14:09:56 +09:00
|
|
|
|
{ "nvim-neotest/nvim-nio", event = "LspAttach" },
|
2023-11-29 20:41:05 +09:00
|
|
|
|
{ "theHamsta/nvim-dap-virtual-text", config = true, event = "LspAttach" },
|
2023-11-29 14:50:50 +09:00
|
|
|
|
{ "suketa/nvim-dap-ruby", config = true, ft = "ruby" },
|
2023-12-03 10:06:01 +09:00
|
|
|
|
{ "leoluz/nvim-dap-go", ft = "go" },
|
2023-11-29 20:41:05 +09:00
|
|
|
|
{ "mxsdev/nvim-dap-vscode-js", ft = "javascript" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "nvimdev/lspsaga.nvim", event = "LspAttach" },
|
2024-08-15 07:42:16 +09:00
|
|
|
|
{ "Wansmer/treesj", event = "LspAttach" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "is0n/jaq-nvim", event = "LspAttach" },
|
|
|
|
|
{ "j-hui/fidget.nvim", config = true, event = "LspAttach" },
|
|
|
|
|
{ "sainnhe/edge", event = "VeryLazy" },
|
2024-10-22 08:29:56 +09:00
|
|
|
|
{
|
|
|
|
|
"sainnhe/everforest",
|
|
|
|
|
event = "VeryLazy",
|
|
|
|
|
config = function()
|
2024-10-22 11:47:03 +09:00
|
|
|
|
vim.g.everforest_background = "hard"
|
2024-10-22 08:29:56 +09:00
|
|
|
|
end,
|
|
|
|
|
},
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "nvim-lua/plenary.nvim", event = "VeryLazy" },
|
|
|
|
|
{ "stevearc/dressing.nvim", event = "VeryLazy" },
|
|
|
|
|
{ "hrsh7th/nvim-cmp", event = "VeryLazy" },
|
2023-12-03 10:06:01 +09:00
|
|
|
|
{ "hrsh7th/cmp-nvim-lsp", event = "LspAttach" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "hrsh7th/cmp-buffer", event = "InsertEnter" },
|
|
|
|
|
{ "hrsh7th/cmp-path", event = "InsertEnter" },
|
|
|
|
|
{ "hrsh7th/cmp-vsnip", event = "InsertEnter" },
|
|
|
|
|
{ "hrsh7th/cmp-cmdline", event = "ModeChanged" },
|
2023-12-05 20:23:48 +09:00
|
|
|
|
{ "hrsh7th/cmp-nvim-lsp-signature-help", event = "LspAttach" },
|
2023-12-03 10:06:01 +09:00
|
|
|
|
{ "hrsh7th/cmp-nvim-lsp-document-symbol", event = "LspAttach" },
|
|
|
|
|
{ "onsails/lspkind.nvim", event = "LspAttach" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "hrsh7th/vim-vsnip", event = "InsertEnter" },
|
|
|
|
|
{ "hrsh7th/vim-vsnip-integ", event = "InsertEnter" },
|
|
|
|
|
{ "rafamadriz/friendly-snippets", event = "InsertEnter" },
|
2024-09-28 16:08:00 +09:00
|
|
|
|
{ "zbirenbaum/copilot-cmp", config = true, event = "InsertEnter" },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "nvim-treesitter/nvim-treesitter", event = { "BufReadPost", "BufNewFile" } },
|
|
|
|
|
{ "nvim-treesitter/nvim-treesitter-refactor", event = "BufRead" },
|
|
|
|
|
{ "yioneko/nvim-yati", event = "BufRead" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "windwp/nvim-autopairs", config = true, event = "InsertEnter" },
|
2023-11-25 09:41:26 +09:00
|
|
|
|
{ "windwp/nvim-ts-autotag", config = true, event = "InsertEnter" },
|
2023-12-04 08:31:42 +09:00
|
|
|
|
{ "HiPhish/rainbow-delimiters.nvim", event = "VeryLazy" },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "andymass/vim-matchup", event = "BufRead" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "lambdalisue/suda.vim", cmd = { "SudaWrite", "SudaRead" } },
|
2023-11-25 09:41:26 +09:00
|
|
|
|
{ "jghauser/mkdir.nvim", event = "ModeChanged" },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "shellRaining/hlchunk.nvim", config = true, event = "BufReadPost" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "kevinhwang91/nvim-hlslens", event = "VeryLazy" },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "akinsho/git-conflict.nvim", version = "*", config = true, cmd = "GitConflictListQf" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "numToStr/Comment.nvim", config = true, event = "VeryLazy" },
|
2024-09-27 14:52:32 +09:00
|
|
|
|
{ "rhysd/clever-f.vim", keys = { "f", "F", "t", "T" } },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "echasnovski/mini.surround", event = "ModeChanged" },
|
|
|
|
|
{ "echasnovski/mini.ai", event = "ModeChanged" },
|
|
|
|
|
{ "mvllow/modes.nvim", event = "VeryLazy" },
|
|
|
|
|
{ "monaqa/dial.nvim", event = "VeryLazy" },
|
|
|
|
|
{ "tpope/vim-repeat", event = "VeryLazy" },
|
|
|
|
|
{ "nvim-zh/colorful-winsep.nvim", config = true, event = "WinNew" },
|
2024-09-28 11:36:39 +09:00
|
|
|
|
{ "kevinhwang91/nvim-bqf", ft = "qf" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ "vim-jp/vimdoc-ja", ft = "help" },
|
2024-09-28 16:08:00 +09:00
|
|
|
|
{ "zbirenbaum/copilot.lua", cmd = "Copilot" },
|
|
|
|
|
{ "CopilotC-Nvim/CopilotChat.nvim", build = "make tiktoken" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
|
|
|
|
|
--non-lazy
|
|
|
|
|
{ "vim-denops/denops.vim", lazy = false },
|
|
|
|
|
{ "yuki-yano/fuzzy-motion.vim", lazy = false },
|
|
|
|
|
{ "lambdalisue/gin.vim", lazy = false },
|
|
|
|
|
{ "rbtnn/vim-ambiwidth", lazy = false },
|
|
|
|
|
{ "lambdalisue/kensaku-search.vim", lazy = false },
|
|
|
|
|
{ "lambdalisue/kensaku.vim", lazy = false },
|
2023-12-02 14:53:15 +09:00
|
|
|
|
{ "brenoprata10/nvim-highlight-colors", lazy = false },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
|
|
|
|
|
--disable default plugins
|
|
|
|
|
performance = {
|
|
|
|
|
rtp = {
|
|
|
|
|
disable_plugins = {
|
|
|
|
|
"netrw",
|
|
|
|
|
"netrwPlugin",
|
|
|
|
|
"netrwSettings",
|
|
|
|
|
"netrwFileHandlers",
|
|
|
|
|
"gzip",
|
|
|
|
|
"zip",
|
|
|
|
|
"zipPlugin",
|
|
|
|
|
"tar",
|
|
|
|
|
"tarPlugin",
|
|
|
|
|
"getscript",
|
|
|
|
|
"getscriptPlugin",
|
|
|
|
|
"vimball",
|
|
|
|
|
"vimballPlugin",
|
|
|
|
|
"2html_plugin",
|
|
|
|
|
"logipat",
|
|
|
|
|
"rrhelper",
|
|
|
|
|
"spellfile_plugin",
|
|
|
|
|
"sql_completion",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
--lualine
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("lualine").setup({
|
|
|
|
|
options = {
|
|
|
|
|
icons_enabled = true,
|
|
|
|
|
component_separators = { left = "", right = "" },
|
|
|
|
|
section_separators = { left = "", right = "" },
|
|
|
|
|
disabled_filetypes = { "TelescopePrompt" },
|
|
|
|
|
always_divide_middle = true,
|
|
|
|
|
colored = false,
|
|
|
|
|
globalstatus = true,
|
|
|
|
|
},
|
|
|
|
|
sections = {
|
|
|
|
|
lualine_a = { "" },
|
|
|
|
|
lualine_b = { "branch", "diff" },
|
|
|
|
|
lualine_c = {
|
|
|
|
|
{
|
|
|
|
|
"filename",
|
|
|
|
|
path = 1,
|
|
|
|
|
file_status = true,
|
|
|
|
|
shorting_target = 40,
|
|
|
|
|
symbols = {
|
|
|
|
|
modified = "[+]",
|
|
|
|
|
readonly = "[RO]",
|
|
|
|
|
unnamed = "Untitled",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
lualine_x = { "filetype" },
|
|
|
|
|
lualine_y = {
|
|
|
|
|
{
|
|
|
|
|
"diagnostics",
|
|
|
|
|
source = { "nvim-lsp" },
|
|
|
|
|
},
|
|
|
|
|
{ "progress" },
|
|
|
|
|
{ "location" },
|
|
|
|
|
},
|
|
|
|
|
lualine_z = { "" },
|
|
|
|
|
},
|
|
|
|
|
inactive_sections = {
|
|
|
|
|
lualine_a = {},
|
|
|
|
|
lualine_b = {},
|
|
|
|
|
lualine_c = { "filename" },
|
|
|
|
|
lualine_x = { "location" },
|
|
|
|
|
lualine_y = {},
|
|
|
|
|
lualine_z = {},
|
|
|
|
|
},
|
|
|
|
|
tabline = {},
|
|
|
|
|
extensions = {},
|
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--telescope
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("telescope").setup({
|
|
|
|
|
defaults = {
|
2024-10-04 23:13:22 +09:00
|
|
|
|
preview = {
|
|
|
|
|
treesitter = false,
|
|
|
|
|
},
|
2023-11-23 10:06:38 +09:00
|
|
|
|
borderchars = { "─", "│", "─", "│", "┌", "┐", "┘", "└" },
|
|
|
|
|
color_devicons = true,
|
2023-11-26 15:54:11 +09:00
|
|
|
|
file_ignore_patterns = { "node_modules", ".git", ".cache", ".svg", ".npm", "go" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
mappings = {
|
|
|
|
|
i = {
|
|
|
|
|
["<esc>"] = require("telescope.actions").close,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-11-26 15:54:11 +09:00
|
|
|
|
|
|
|
|
|
vimgrep_arguments = {
|
|
|
|
|
"rg",
|
|
|
|
|
"--color=never",
|
|
|
|
|
"--no-heading",
|
|
|
|
|
"--smart-case",
|
|
|
|
|
"-uu",
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
extensions = {
|
|
|
|
|
fzf = {
|
|
|
|
|
fuzzy = true,
|
|
|
|
|
override_generic_sorter = true,
|
|
|
|
|
override_file_sorter = true,
|
|
|
|
|
case_mode = "smart_case",
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>.", "<cmd>Telescope find_files hidden=true<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>,", "<cmd>Telescope oldfiles<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>l", "<cmd>Telescope live_grep grep_open_files=true<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>k", "<cmd>Telescope live_grep<CR>")
|
2023-11-26 21:06:57 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>b", "<cmd>Telescope buffers<CR>")
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>h", "<cmd>Telescope help_tags<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>y", "<cmd>Telescope registers<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>n", "<cmd>Telescope lsp_references<CR>")
|
2024-08-15 07:42:16 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>j", "<cmd>Telescope diagnostics<CR>")
|
|
|
|
|
vim.keymap.set("n", "<leader>s", "<cmd>Telescope lsp_document_symbols<CR>")
|
2023-11-27 22:02:13 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>f", "<cmd>Telescope file_browser<CR>")
|
2023-11-23 10:06:38 +09:00
|
|
|
|
|
|
|
|
|
local fb_actions = require("telescope").extensions.file_browser.actions
|
|
|
|
|
local previewers = require("telescope.previewers")
|
|
|
|
|
local Job = require("plenary.job")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
local new_maker = function(filepath, bufnr, opts)
|
2023-11-23 10:06:38 +09:00
|
|
|
|
filepath = vim.fn.expand(filepath)
|
|
|
|
|
Job:new({
|
|
|
|
|
command = "file",
|
|
|
|
|
args = { "--mime-type", "-b", filepath },
|
|
|
|
|
on_exit = function(j)
|
|
|
|
|
local mime_type = vim.split(j:result()[1], "/")[1]
|
|
|
|
|
if mime_type == "text" then
|
|
|
|
|
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
|
|
|
|
else
|
|
|
|
|
vim.schedule(function()
|
|
|
|
|
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { "BINARY" })
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end,
|
|
|
|
|
}):sync()
|
2023-08-17 14:14:00 +09:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--LSP
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("lspsaga").setup({
|
2023-11-24 20:27:10 +09:00
|
|
|
|
symbol_in_winbar = {
|
2024-08-05 10:55:37 +09:00
|
|
|
|
enable = true,
|
2023-11-24 20:27:10 +09:00
|
|
|
|
},
|
2023-11-23 10:06:38 +09:00
|
|
|
|
ui = {
|
|
|
|
|
border = "single",
|
|
|
|
|
title = false,
|
|
|
|
|
},
|
|
|
|
|
lightbulb = {
|
|
|
|
|
enable = false,
|
|
|
|
|
},
|
2024-03-09 10:39:17 +09:00
|
|
|
|
diagnostic = {
|
2024-08-09 22:46:22 +09:00
|
|
|
|
diagnostic_only_current = false,
|
2024-03-09 10:39:17 +09:00
|
|
|
|
},
|
2023-11-03 12:30:10 +09:00
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
local on_attach = function(client, bufnr)
|
|
|
|
|
client.server_capabilities.documentFormattingProvider = false
|
|
|
|
|
local set = vim.keymap.set
|
|
|
|
|
set("n", "K", "<cmd>Lspsaga hover_doc<CR>")
|
2024-08-09 22:46:22 +09:00
|
|
|
|
set("n", "<leader>r", "<cmd>Lspsaga rename<CR>")
|
|
|
|
|
set("n", "<leader>c", "<cmd>Lspsaga code_action<CR>")
|
|
|
|
|
set("n", "<leader>e", "<cmd>Lspsaga show_line_diagnostics<CR>")
|
2023-11-23 10:06:38 +09:00
|
|
|
|
set("n", "<leader>[", "<cmd>Lspsaga diagnostic_jump_prev<CR>")
|
|
|
|
|
set("n", "<leaaer>]", "<cmd>Lspsaga diagnostic_jump_next<CR>")
|
|
|
|
|
end
|
2023-12-05 20:23:48 +09:00
|
|
|
|
vim.diagnostic.config({ virtual_text = false })
|
2023-12-06 19:44:12 +09:00
|
|
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
|
|
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
2023-12-03 10:06:01 +09:00
|
|
|
|
require("mason").setup()
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("mason-null-ls").setup({
|
2024-09-20 13:21:07 +09:00
|
|
|
|
ensure_installed = { "prettierd", "rubocop", "stylua", "shfmt" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
handlers = {},
|
|
|
|
|
})
|
2023-11-29 10:13:21 +09:00
|
|
|
|
require("mason-nvim-dap").setup({
|
|
|
|
|
ensure_installed = {},
|
2023-11-29 14:50:50 +09:00
|
|
|
|
handlers = {},
|
2023-11-29 10:13:21 +09:00
|
|
|
|
})
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("mason-lspconfig").setup()
|
|
|
|
|
require("mason-lspconfig").setup_handlers({
|
|
|
|
|
function(server_name)
|
|
|
|
|
require("lspconfig")[server_name].setup({
|
|
|
|
|
on_attach = on_attach,
|
|
|
|
|
capabilities = capabilities,
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-11-03 12:30:10 +09:00
|
|
|
|
--none-ls
|
2023-11-23 10:06:38 +09:00
|
|
|
|
local status, null_ls = pcall(require, "null-ls")
|
|
|
|
|
if not status then
|
|
|
|
|
return
|
|
|
|
|
end
|
2024-08-09 22:46:22 +09:00
|
|
|
|
null_ls.setup()
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>p", function()
|
|
|
|
|
vim.lsp.buf.format({ async = true })
|
|
|
|
|
end)
|
2023-11-03 12:30:10 +09:00
|
|
|
|
|
2023-08-17 14:14:00 +09:00
|
|
|
|
--DAP
|
|
|
|
|
local function map(mode, lhs, rhs, opts)
|
2023-11-23 10:06:38 +09:00
|
|
|
|
local options = { noremap = true }
|
|
|
|
|
if opts then
|
|
|
|
|
options = vim.tbl_extend("force", options, opts)
|
|
|
|
|
end
|
|
|
|
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
2023-08-17 14:14:00 +09:00
|
|
|
|
end
|
|
|
|
|
|
2024-09-28 16:08:00 +09:00
|
|
|
|
map("n", "<leader>1", ":lua require'dap'.continue()<CR>", { silent = true })
|
|
|
|
|
map("n", "<leader>2", ":lua require'dap'.step_over()<CR>", { silent = true })
|
|
|
|
|
map("n", "<leader>3", ":lua require'dap'.step_into()<CR>", { silent = true })
|
|
|
|
|
map("n", "<leader>4", ":lua require'dap'.step_out()<CR>", { silent = true })
|
2023-11-27 22:02:13 +09:00
|
|
|
|
map("n", "<leader>;", ":lua require'dap'.toggle_breakpoint()<CR>", { silent = true })
|
2023-11-29 10:13:21 +09:00
|
|
|
|
map("n", "<leader>'", ":lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>", { silent = true })
|
2023-11-23 10:06:38 +09:00
|
|
|
|
map(
|
|
|
|
|
"n",
|
|
|
|
|
"<leader>i",
|
|
|
|
|
":lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>",
|
|
|
|
|
{ silent = true }
|
|
|
|
|
)
|
|
|
|
|
map("n", "<leader>d", ":lua require'dapui'.toggle()<CR>", { silent = true })
|
|
|
|
|
map("n", "<leader><leader>d", ":lua require'dapui'.eval()<CR>", { silent = true })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
---DAP-UI
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("dapui").setup({
|
|
|
|
|
icons = { expanded = "▾", collapsed = "▸", current_frame = "▸" },
|
2023-08-17 14:14:00 +09:00
|
|
|
|
mappings = {
|
2023-11-23 10:06:38 +09:00
|
|
|
|
expand = { "<CR>", "<2-LeftMouse>" },
|
|
|
|
|
open = "o",
|
|
|
|
|
remove = "d",
|
|
|
|
|
edit = "e",
|
|
|
|
|
repl = "r",
|
|
|
|
|
toggle = "t",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
2023-11-23 10:06:38 +09:00
|
|
|
|
expand_lines = vim.fn.has("nvim-0.7") == 1,
|
2023-08-17 14:14:00 +09:00
|
|
|
|
layouts = {
|
|
|
|
|
{
|
|
|
|
|
elements = {
|
2023-11-23 10:06:38 +09:00
|
|
|
|
{ id = "scopes", size = 0.25 },
|
|
|
|
|
"breakpoints",
|
|
|
|
|
"stacks",
|
|
|
|
|
"watches",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
2023-08-30 15:19:20 +09:00
|
|
|
|
size = 40,
|
2023-11-23 10:06:38 +09:00
|
|
|
|
position = "left",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
elements = {
|
2023-11-23 10:06:38 +09:00
|
|
|
|
"repl",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
2023-08-30 15:19:20 +09:00
|
|
|
|
size = 0.25,
|
2023-11-23 10:06:38 +09:00
|
|
|
|
position = "bottom",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
controls = {
|
|
|
|
|
enabled = true,
|
2023-11-23 10:06:38 +09:00
|
|
|
|
element = "repl",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
icons = {
|
2023-11-23 10:06:38 +09:00
|
|
|
|
pause = "",
|
|
|
|
|
play = "",
|
|
|
|
|
step_into = "",
|
|
|
|
|
step_over = "",
|
|
|
|
|
step_out = "",
|
|
|
|
|
step_back = "",
|
|
|
|
|
run_last = "↻",
|
|
|
|
|
terminate = "□",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
floating = {
|
2023-08-30 15:19:20 +09:00
|
|
|
|
max_height = nil,
|
|
|
|
|
max_width = nil,
|
2023-11-23 10:06:38 +09:00
|
|
|
|
border = "single",
|
2023-08-17 14:14:00 +09:00
|
|
|
|
mappings = {
|
2023-11-23 10:06:38 +09:00
|
|
|
|
close = { "q", "<Esc>" },
|
2023-08-17 14:14:00 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
windows = { indent = 1 },
|
|
|
|
|
render = {
|
2023-08-30 15:19:20 +09:00
|
|
|
|
max_type_length = nil,
|
|
|
|
|
max_value_lines = 100,
|
2023-11-23 10:06:38 +09:00
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
2023-08-28 14:07:30 +09:00
|
|
|
|
---jaq-nvim
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("jaq-nvim").setup({
|
|
|
|
|
cmds = {
|
|
|
|
|
internal = {
|
|
|
|
|
lua = "luafile %",
|
|
|
|
|
vim = "source %",
|
|
|
|
|
},
|
|
|
|
|
external = {
|
|
|
|
|
sh = "sh %",
|
|
|
|
|
ruby = "ruby %",
|
2024-08-15 07:42:16 +09:00
|
|
|
|
go = "go run %",
|
|
|
|
|
javascript = "node %",
|
2023-11-23 10:06:38 +09:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
behavior = {
|
|
|
|
|
default = "float",
|
|
|
|
|
startinsert = false,
|
|
|
|
|
wincmd = false,
|
|
|
|
|
autosave = false,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
ui = {
|
|
|
|
|
float = {
|
|
|
|
|
border = "none",
|
|
|
|
|
winhl = "Normal",
|
|
|
|
|
borderhl = "FloatBorder",
|
|
|
|
|
winblend = 0,
|
|
|
|
|
height = 0.8,
|
|
|
|
|
width = 0.8,
|
|
|
|
|
x = 0.5,
|
|
|
|
|
y = 0.5,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
terminal = {
|
|
|
|
|
position = "bot",
|
|
|
|
|
size = 10,
|
|
|
|
|
line_no = false,
|
|
|
|
|
},
|
|
|
|
|
quickfix = {
|
|
|
|
|
position = "bot",
|
|
|
|
|
size = 10,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
2023-08-28 14:07:30 +09:00
|
|
|
|
|
2024-08-15 07:42:16 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>x", ":<C-u>Jaq<CR>", { silent = true })
|
2023-08-28 14:07:30 +09:00
|
|
|
|
|
2023-08-17 14:14:00 +09:00
|
|
|
|
--nvim-cmp
|
2023-11-23 10:06:38 +09:00
|
|
|
|
local cmp = require("cmp")
|
|
|
|
|
local lspkind = require("lspkind")
|
|
|
|
|
|
|
|
|
|
cmp.setup({
|
|
|
|
|
snippet = {
|
|
|
|
|
expand = function(args)
|
|
|
|
|
vim.fn["vsnip#anonymous"](args.body)
|
|
|
|
|
end,
|
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
window = {
|
|
|
|
|
completion = cmp.config.window.bordered({
|
2023-12-30 08:06:09 +09:00
|
|
|
|
border = "none",
|
2023-11-23 10:06:38 +09:00
|
|
|
|
}),
|
|
|
|
|
documentation = cmp.config.window.bordered({
|
2023-12-30 08:06:09 +09:00
|
|
|
|
border = "none",
|
2023-11-23 10:06:38 +09:00
|
|
|
|
}),
|
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
mapping = cmp.mapping.preset.insert({
|
2024-08-10 12:41:53 +09:00
|
|
|
|
["<Tab>"] = cmp.mapping.select_next_item(),
|
2024-05-16 14:09:56 +09:00
|
|
|
|
["<C-p>"] = cmp.mapping.select_prev_item(),
|
2023-11-23 10:06:38 +09:00
|
|
|
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
|
|
|
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
|
|
|
|
["<C-Space>"] = cmp.mapping.complete(),
|
|
|
|
|
["<C-e>"] = cmp.mapping.abort(),
|
2023-12-04 08:22:31 +09:00
|
|
|
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
2023-11-23 10:06:38 +09:00
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
formatting = {
|
|
|
|
|
format = lspkind.cmp_format({
|
|
|
|
|
mode = "symbol",
|
|
|
|
|
maxwidth = 50,
|
|
|
|
|
ellipsis_char = "...",
|
2024-09-28 16:08:00 +09:00
|
|
|
|
symbol_map = { Copilot = "" },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
sources = cmp.config.sources({
|
2023-12-14 21:42:30 +09:00
|
|
|
|
{ name = "nvim_lsp", max_item_count = 15, keyword_length = 2 },
|
|
|
|
|
{ name = "vsnip", max_item_count = 15, keyword_length = 2 },
|
2024-09-28 16:08:00 +09:00
|
|
|
|
{ name = "copilot", max_item_count = 15, keyword_length = 2 },
|
2023-12-30 08:06:09 +09:00
|
|
|
|
{ name = "nvim_lsp_signature_help" },
|
2023-12-14 21:42:30 +09:00
|
|
|
|
{ name = "buffer", max_item_count = 15, keyword_length = 2 },
|
2023-11-23 10:06:38 +09:00
|
|
|
|
}),
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
cmp.setup.cmdline({ "/", "?" }, {
|
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
|
{ name = "nvim_lsp_document_symbol" },
|
|
|
|
|
}, {
|
|
|
|
|
{ name = "buffer" },
|
|
|
|
|
}),
|
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
cmp.setup.cmdline(":", {
|
|
|
|
|
mapping = cmp.mapping.preset.cmdline(),
|
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
|
{ name = "path" },
|
|
|
|
|
}, {
|
|
|
|
|
{ name = "cmdline", keyword_length = 2 },
|
|
|
|
|
}),
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
|
|
|
|
vim.cmd("let g:vsnip_filetypes = {}")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2024-09-28 16:08:00 +09:00
|
|
|
|
local has_words_before = function()
|
|
|
|
|
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
|
|
|
|
return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil
|
|
|
|
|
end
|
|
|
|
|
cmp.setup({
|
|
|
|
|
mapping = {
|
|
|
|
|
["<Tab>"] = vim.schedule_wrap(function(fallback)
|
|
|
|
|
if cmp.visible() and has_words_before() then
|
|
|
|
|
cmp.select_next_item({ behavior = cmp.SelectBehavior.Select })
|
|
|
|
|
else
|
|
|
|
|
fallback()
|
|
|
|
|
end
|
|
|
|
|
end),
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
--nvim-treesitter
|
|
|
|
|
require("nvim-treesitter.configs").setup({
|
|
|
|
|
highlight = {
|
|
|
|
|
enable = true,
|
|
|
|
|
disable = { "help", "markdown", "toml" },
|
|
|
|
|
},
|
|
|
|
|
refactor = {
|
|
|
|
|
highlight_defintions = {
|
|
|
|
|
enable = true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-07-14 18:02:35 +09:00
|
|
|
|
indent = {
|
2023-11-23 10:06:38 +09:00
|
|
|
|
enable = true,
|
|
|
|
|
},
|
2024-07-14 18:02:35 +09:00
|
|
|
|
yati = {
|
|
|
|
|
enable = false,
|
|
|
|
|
},
|
2023-11-23 10:06:38 +09:00
|
|
|
|
matchup = {
|
|
|
|
|
enable = true,
|
|
|
|
|
enable_quotes = true,
|
|
|
|
|
},
|
|
|
|
|
ensure_installed = "all",
|
2023-09-15 18:32:08 +09:00
|
|
|
|
})
|
|
|
|
|
|
2024-06-13 19:43:50 +09:00
|
|
|
|
--nvim-ts-autotag
|
|
|
|
|
require("nvim-ts-autotag").setup()
|
2024-02-25 09:27:42 +09:00
|
|
|
|
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
|
|
|
|
underline = true,
|
|
|
|
|
update_in_insert = true,
|
|
|
|
|
})
|
|
|
|
|
|
2024-09-28 11:36:39 +09:00
|
|
|
|
--treesj
|
2024-08-15 07:42:16 +09:00
|
|
|
|
local tsj = require("treesj")
|
|
|
|
|
tsj.setup({
|
|
|
|
|
use_default_keymaps = false,
|
|
|
|
|
})
|
2024-09-29 09:23:31 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>z", require("treesj").toggle)
|
2024-08-15 07:42:16 +09:00
|
|
|
|
|
2023-12-04 08:31:42 +09:00
|
|
|
|
--rainbow-delimiters
|
|
|
|
|
require("rainbow-delimiters.setup").setup()
|
|
|
|
|
|
2024-09-28 11:36:39 +09:00
|
|
|
|
--hlchunk
|
2024-08-07 15:36:48 +09:00
|
|
|
|
require("hlchunk").setup({
|
|
|
|
|
chunk = {
|
|
|
|
|
enable = true,
|
|
|
|
|
},
|
|
|
|
|
indent = {
|
|
|
|
|
enable = true,
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2024-09-28 11:36:39 +09:00
|
|
|
|
--nvim-bqf
|
|
|
|
|
require("bqf").setup({
|
|
|
|
|
preview = {
|
|
|
|
|
border = "single",
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
2024-09-29 09:23:31 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>5", [[:vimgrep /\w\+/j % | copen<CR>]], { noremap = true, silent = true })
|
2024-09-28 11:36:39 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
--dressing
|
|
|
|
|
require("dressing").setup({
|
|
|
|
|
input = {
|
|
|
|
|
border = "single",
|
|
|
|
|
},
|
|
|
|
|
builtin = {
|
|
|
|
|
border = "single",
|
|
|
|
|
},
|
|
|
|
|
})
|
2023-09-15 18:32:08 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
--modes
|
|
|
|
|
require("modes").setup({
|
|
|
|
|
colors = {
|
|
|
|
|
copy = "#FFEE55",
|
|
|
|
|
delete = "#DC669B",
|
|
|
|
|
insert = "#55AAEE",
|
|
|
|
|
visual = "#DD5522",
|
|
|
|
|
},
|
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
--colorful-winsep
|
|
|
|
|
require("colorful-winsep").setup({
|
|
|
|
|
highlight = {
|
|
|
|
|
bg = "",
|
|
|
|
|
fg = "#E8AEAA",
|
|
|
|
|
},
|
|
|
|
|
})
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2023-12-02 14:53:15 +09:00
|
|
|
|
--nvim-highlight-colors
|
|
|
|
|
require("nvim-highlight-colors").setup({
|
|
|
|
|
render = "background",
|
2023-12-30 08:06:09 +09:00
|
|
|
|
enable_named_colors = false,
|
2023-12-02 14:53:15 +09:00
|
|
|
|
enable_tailwind = true,
|
|
|
|
|
})
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
--nvim-hlslens
|
|
|
|
|
require("hlslens").setup()
|
|
|
|
|
local kopts = { noremap = true, silent = true }
|
|
|
|
|
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"n",
|
2024-10-22 11:47:03 +09:00
|
|
|
|
[[<cmd>execute('normal! ' . v:count1 . 'n')<CR><cmd>lua require('hlslens').start()<CR>]],
|
2023-11-23 10:06:38 +09:00
|
|
|
|
kopts
|
|
|
|
|
)
|
|
|
|
|
vim.keymap.set(
|
|
|
|
|
"n",
|
|
|
|
|
"N",
|
2024-10-22 11:47:03 +09:00
|
|
|
|
[[<cmd>execute('normal! ' . v:count1 . 'N')<CR><cmd>lua require('hlslens').start()<CR>]],
|
2023-11-23 10:06:38 +09:00
|
|
|
|
kopts
|
|
|
|
|
)
|
|
|
|
|
vim.keymap.set("n", "*", [[*<cmd>lua require('hlslens').start()<CR>]], kopts)
|
|
|
|
|
vim.keymap.set("n", "#", [[#<cmd>lua require('hlslens').start()<CR>]], kopts)
|
|
|
|
|
vim.keymap.set("n", "g*", [[g*<cmd>lua require('hlslens').start()<CR>]], kopts)
|
|
|
|
|
vim.keymap.set("n", "g#", [[g#<cmd>lua require('hlslens').start()<CR>]], kopts)
|
|
|
|
|
vim.keymap.set("n", "<ESC>", ":nohl<CR><ESC>", kopts)
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--fuzzy-motion
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "S", "<cmd>FuzzyMotion<CR>")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
vim.cmd("let g:fuzzy_motion_matchers = ['kensaku', 'fzf']")
|
|
|
|
|
|
|
|
|
|
--kensaku-search
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("c", "<CR>", "<Plug>(kensaku-search-replace)<CR>")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--clever-f
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.cmd("let g:clever_f_across_no_line = 1")
|
|
|
|
|
vim.cmd("let g:clever_f_ignore_case = 1")
|
|
|
|
|
vim.cmd("let g:clever_f_smart_case = 1")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
vim.cmd("let g:clever_f_chars_match_any_signs = ';'")
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.cmd("let g:clever_f_use_migemo = 1")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--mini.surround
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("mini.surround").setup({
|
|
|
|
|
mappings = {
|
|
|
|
|
highlight = "sx",
|
|
|
|
|
},
|
|
|
|
|
custom_surroundings = {
|
|
|
|
|
["{"] = {
|
|
|
|
|
input = { "%b{}", "^.().*().$" },
|
|
|
|
|
output = { left = "{", right = "}" },
|
|
|
|
|
},
|
|
|
|
|
["}"] = {
|
|
|
|
|
input = { "%b{}", "^.%{().*()%}.$" },
|
|
|
|
|
output = { left = "{{", right = "}}" },
|
|
|
|
|
},
|
|
|
|
|
["("] = {
|
|
|
|
|
input = { "%b()", "^.().*().$" },
|
|
|
|
|
output = { left = "(", right = ")" },
|
|
|
|
|
},
|
|
|
|
|
[")"] = {
|
|
|
|
|
input = { "%b()", "^.%(().*()%).$" },
|
|
|
|
|
output = { left = "((", right = "))" },
|
|
|
|
|
},
|
|
|
|
|
["["] = {
|
|
|
|
|
input = { "%b[]", "^.().*().$" },
|
|
|
|
|
output = { left = "[", right = "]" },
|
|
|
|
|
},
|
|
|
|
|
["]"] = {
|
|
|
|
|
input = { "%b[]", "^.%[().*()%].$" },
|
|
|
|
|
output = { left = "[[", right = "]]" },
|
|
|
|
|
},
|
|
|
|
|
["<"] = {
|
|
|
|
|
input = { "%b<>", "^.().*().$" },
|
|
|
|
|
output = { left = "<", right = ">" },
|
|
|
|
|
},
|
|
|
|
|
[">"] = {
|
|
|
|
|
input = { "%b[]", "^.<().*()>.$" },
|
|
|
|
|
output = { left = "<<", right = ">>" },
|
|
|
|
|
},
|
|
|
|
|
["j"] = {
|
|
|
|
|
input = function()
|
|
|
|
|
local ok, val = pcall(vim.fn.getchar)
|
|
|
|
|
if not ok then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local char = vim.fn.nr2char(val)
|
|
|
|
|
|
|
|
|
|
local dict = {
|
|
|
|
|
["("] = { "(().-())" },
|
|
|
|
|
["{"] = { "{().-()}" },
|
|
|
|
|
["["] = { "「().-()」" },
|
|
|
|
|
["]"] = { "『().-()』" },
|
|
|
|
|
["<"] = { "<().-()>" },
|
|
|
|
|
['"'] = { "”().-()”" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if char == "b" then
|
|
|
|
|
local ret = {}
|
|
|
|
|
for _, v in pairs(dict) do
|
|
|
|
|
table.insert(ret, v)
|
|
|
|
|
end
|
|
|
|
|
return { ret }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if dict[char] then
|
|
|
|
|
return dict[char]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
error("%s is unsupported surroundings in Japanese")
|
|
|
|
|
end,
|
|
|
|
|
output = function()
|
|
|
|
|
local ok, val = pcall(vim.fn.getchar)
|
|
|
|
|
if not ok then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local char = vim.fn.nr2char(val)
|
|
|
|
|
|
|
|
|
|
local dict = {
|
|
|
|
|
["("] = { left = "(", right = ")" },
|
|
|
|
|
["{"] = { left = "{", right = "}" },
|
|
|
|
|
["["] = { left = "「", right = "」" },
|
|
|
|
|
["]"] = { left = "『", right = "』" },
|
|
|
|
|
["<"] = { left = "<", right = ">" },
|
|
|
|
|
['"'] = { left = "”", right = "”" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if not dict[char] then
|
|
|
|
|
error("%s is unsupported surroundings in Japanese")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return dict[char]
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
--mini.ai
|
2023-11-23 10:06:38 +09:00
|
|
|
|
require("mini.ai").setup({
|
|
|
|
|
custom_textobjects = {
|
|
|
|
|
["{"] = { "%b{}", "^.().*().$" },
|
|
|
|
|
["}"] = { "%b{}", "^.%{().*()%}.$" },
|
|
|
|
|
["("] = { "%b()", "^.().*().$" },
|
|
|
|
|
[")"] = { "%b()", "^.%(().*()%).$" },
|
|
|
|
|
["["] = { "%b[]", "^.().*().$" },
|
|
|
|
|
["]"] = { "%b[]", "^.%[().*()%].$" },
|
|
|
|
|
[""] = { "%b<", "^.().*().$" },
|
|
|
|
|
[">"] = { "%b", "^.().*().$" },
|
|
|
|
|
["j"] = function()
|
|
|
|
|
local ok, val = pcall(vim.fn.getchar)
|
|
|
|
|
if not ok then
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
local char = vim.fn.nr2char(val)
|
|
|
|
|
|
|
|
|
|
local dict = {
|
|
|
|
|
["("] = { "(().-())" },
|
|
|
|
|
["{"] = { "{().-()}" },
|
|
|
|
|
["["] = { "「().-()」" },
|
|
|
|
|
["]"] = { "『().-()』" },
|
|
|
|
|
["<"] = { "<().-()>" },
|
|
|
|
|
['"'] = { "”().-()”" },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if char == "b" then
|
|
|
|
|
local ret = {}
|
|
|
|
|
for _, v in pairs(dict) do
|
|
|
|
|
table.insert(ret, v)
|
|
|
|
|
end
|
|
|
|
|
return { ret }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if dict[char] then
|
|
|
|
|
return dict[char]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
error("%s is unsupported textobjects in Japanese")
|
|
|
|
|
end,
|
|
|
|
|
},
|
2023-08-17 14:14:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
--dial
|
|
|
|
|
vim.keymap.set("n", "<C-a>", require("dial.map").inc_normal(), { noremap = true })
|
|
|
|
|
vim.keymap.set("n", "<C-x>", require("dial.map").dec_normal(), { noremap = true })
|
|
|
|
|
vim.keymap.set("v", "<C-a>", require("dial.map").inc_visual(), { noremap = true })
|
|
|
|
|
vim.keymap.set("v", "<C-x>", require("dial.map").dec_visual(), { noremap = true })
|
|
|
|
|
vim.keymap.set("v", "g<C-a>", require("dial.map").inc_gvisual(), { noremap = true })
|
|
|
|
|
vim.keymap.set("v", "g<C-x>", require("dial.map").dec_gvisual(), { noremap = true })
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
|
|
|
|
--gin
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>gs", ":<C-u>GitStatus<CR>", { silent = true })
|
|
|
|
|
vim.keymap.set("n", "<leader>ga", ":<C-u>Gin add .<CR>", { silent = true })
|
|
|
|
|
vim.keymap.set("n", "<leader>gc", ":<C-u>Gin commit -m ")
|
|
|
|
|
vim.keymap.set("n", "<leader>gp", ":<C-u>Gin push<CR>")
|
2023-08-17 14:14:00 +09:00
|
|
|
|
|
2024-09-28 16:08:00 +09:00
|
|
|
|
--copilot
|
|
|
|
|
local select = require("CopilotChat.select")
|
|
|
|
|
|
|
|
|
|
require("copilot").setup({
|
|
|
|
|
suggestion = { enabled = false },
|
|
|
|
|
panel = { enabled = false },
|
2024-10-04 23:13:22 +09:00
|
|
|
|
filetypes = {
|
|
|
|
|
markdown = false,
|
|
|
|
|
text = false,
|
|
|
|
|
},
|
2024-09-28 16:08:00 +09:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
require("CopilotChat").setup({
|
|
|
|
|
debug = true,
|
|
|
|
|
|
|
|
|
|
window = {
|
|
|
|
|
layout = "float",
|
|
|
|
|
relative = "editor",
|
|
|
|
|
},
|
|
|
|
|
prompts = {
|
|
|
|
|
Explain = {
|
|
|
|
|
prompt = "/COPILOT_EXPLAIN 選択されたコードの説明を段落をつけて書いてください。",
|
|
|
|
|
},
|
|
|
|
|
Review = {
|
|
|
|
|
prompt = "/COPILOT_REVIEW 選択されたコードをレビューしてください。",
|
|
|
|
|
callback = function(response, source) end,
|
|
|
|
|
},
|
|
|
|
|
Fix = {
|
|
|
|
|
prompt = "/COPILOT_FIX このコードには問題があります。バグを修正したコードに書き直してください。",
|
|
|
|
|
},
|
|
|
|
|
Optimize = {
|
|
|
|
|
prompt = "/COPILOT_REFACTOR 選択されたコードを最適化してパフォーマンスと可読性を向上させてください。",
|
|
|
|
|
},
|
|
|
|
|
Docs = {
|
|
|
|
|
prompt = "/COPILOT_DOCS 選択されたコードに対してドキュメンテーションコメントを追加してください。",
|
|
|
|
|
},
|
|
|
|
|
Tests = {
|
|
|
|
|
prompt = "/COPILOT_TESTS 選択されたコードの詳細な単体テスト関数を書いてください。",
|
|
|
|
|
},
|
|
|
|
|
FixDiagnostic = {
|
|
|
|
|
prompt = "ファイル内の次のような診断上の問題を解決してください:",
|
|
|
|
|
selection = select.diagnostics,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function CopilotChatBuffer()
|
|
|
|
|
local input = vim.fn.input("Quick Chat: ")
|
|
|
|
|
if input ~= "" then
|
|
|
|
|
require("CopilotChat").ask(input, { selection = require("CopilotChat.select").buffer })
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2024-10-22 11:47:03 +09:00
|
|
|
|
vim.api.nvim_set_keymap("n", "<leader>9", "<cmd>lua CopilotChatBuffer()<CR>", { noremap = true, silent = true })
|
2024-09-28 16:08:00 +09:00
|
|
|
|
|
|
|
|
|
function ShowCopilotChatActionPrompt()
|
|
|
|
|
local actions = require("CopilotChat.actions")
|
|
|
|
|
require("CopilotChat.integrations.telescope").pick(actions.prompt_actions())
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_set_keymap(
|
|
|
|
|
"n",
|
|
|
|
|
"<leader>0",
|
2024-10-22 11:47:03 +09:00
|
|
|
|
"<cmd>lua ShowCopilotChatActionPrompt()<CR>",
|
2024-09-28 16:08:00 +09:00
|
|
|
|
{ noremap = true, silent = true }
|
|
|
|
|
)
|
|
|
|
|
|
2023-08-17 14:14:00 +09:00
|
|
|
|
--OTHER SETTINGS
|
2024-10-22 11:47:03 +09:00
|
|
|
|
vim.keymap.set("n", "<leader>7", "<cmd>colorscheme edge<CR>", { noremap = true, silent = true })
|
|
|
|
|
vim.keymap.set("n", "<leader>8", "<cmd>colorscheme everforest<CR>", { noremap = true, silent = true })
|
|
|
|
|
|
2023-11-23 10:06:38 +09:00
|
|
|
|
vim.cmd("colorscheme edge")
|