neovim: Update for 0.12
This commit is contained in:
parent
b393e0ae57
commit
539fdfaaad
10 changed files with 657 additions and 963 deletions
2
install
2
install
|
|
@ -38,7 +38,7 @@ else
|
|||
profiles=()
|
||||
fi
|
||||
|
||||
for conf in default "${OS_NAME}" "${profiles[@]}" postinstall; do
|
||||
for conf in default "${OS_NAME}" "${profiles[@]}"; do
|
||||
echo "Applying config: ${conf}"
|
||||
load_config "${conf}${CONFIG_SUFFIX}"
|
||||
done
|
||||
|
|
|
|||
1
neovim/.gitignore
vendored
1
neovim/.gitignore
vendored
|
|
@ -1,3 +1,2 @@
|
|||
.netrwhist
|
||||
spell/
|
||||
os-plugins.vim
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../../vim/colors/jdkaplan.vim
|
||||
632
neovim/init.lua
632
neovim/init.lua
|
|
@ -1,20 +1,9 @@
|
|||
vim.o.shell = "/bin/sh"
|
||||
vim.g.python3_host_prog = vim.fn.expand("~/.virtualenvs/neovim3/bin/python")
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath })
|
||||
vim.fn.system({ "git", "-C", lazypath, "checkout", "tags/stable" })
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Load from ./lua/plugins/*.lua
|
||||
require("lazy").setup("plugins", {
|
||||
change_detection = {
|
||||
-- Disable automatic reloading of config files.
|
||||
enabled = false,
|
||||
},
|
||||
})
|
||||
vim.g.loaded_node_provider = false
|
||||
vim.g.loaded_perl_provider = false
|
||||
vim.g.loaded_python_provider = false
|
||||
vim.g.loaded_ruby_provider = false
|
||||
|
||||
vim.o.number = true
|
||||
vim.o.hidden = true
|
||||
|
|
@ -68,49 +57,36 @@ vim.opt.completeopt = "menu,menuone,noselect"
|
|||
|
||||
vim.o.secure = true
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "markdown", "text" },
|
||||
callback = function()
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
vim.opt.spellcapcheck = ""
|
||||
|
||||
vim.diagnostic.config({
|
||||
jump = {
|
||||
on_jump = function(diagnostic, bufnr)
|
||||
if not diagnostic then
|
||||
return
|
||||
end
|
||||
|
||||
vim.diagnostic.show(diagnostic.namespace, bufnr, { diagnostic }, { float = true })
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("", "<Space>w", "<C-w>", { remap = true })
|
||||
|
||||
vim.keymap.set("", "<Leader>w", ":w<CR>")
|
||||
vim.keymap.set("", "<Leader><Leader>", ":w<CR>")
|
||||
vim.keymap.set("", "<Space>s", ":w<CR>")
|
||||
vim.keymap.set("", ";", ":nohlsearch<cr>")
|
||||
vim.keymap.set("", ",", ":nohlsearch<cr>")
|
||||
|
||||
vim.keymap.set("n", "<C-w>]", function()
|
||||
if vim.api.nvim_win_get_width(0) > 2 * 80 then
|
||||
vim.cmd("vertical wincmd ]")
|
||||
else
|
||||
vim.cmd("horizontal wincmd ]")
|
||||
end
|
||||
end)
|
||||
-------------------------------------------------------------------------------
|
||||
-- Theme
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.keymap.set("", "<Space><Space>", ":nohlsearch<CR>")
|
||||
|
||||
vim.keymap.set("n", "<Space>cc", ':let @+=expand("%")<CR>')
|
||||
vim.keymap.set("n", "<Space>cl", ':let @+=join([expand("%"), line(".")], ":")<CR>')
|
||||
vim.keymap.set("n", "<Space>cp", ':let @+=expand("%:p")<CR>')
|
||||
|
||||
-- TODO: Delete these ; fake-leader bindings
|
||||
vim.keymap.set("n", ";cc", ':let @+=expand("%")<CR>')
|
||||
vim.keymap.set("n", ";cl", ':let @+=join([expand("%"), line(".")], ":")<CR>')
|
||||
vim.keymap.set("n", ";cp", ':let @+=expand("%:p")<CR>')
|
||||
|
||||
-- Open/close quickfix list
|
||||
vim.keymap.set("n", "<Space>q", ":cclose<CR>")
|
||||
vim.keymap.set("n", "<Space>Q", ":botright copen<CR>")
|
||||
|
||||
-- Enable/disable diff mode
|
||||
vim.keymap.set("n", "<Space>dt", ":diffthis<CR>")
|
||||
vim.keymap.set("n", "<Space>do", ":diffoff<CR>")
|
||||
|
||||
vim.cmd([[
|
||||
command Crosshair :set virtualedit=all cursorcolumn
|
||||
command NoCrosshair :set virtualedit= nocursorcolumn
|
||||
]])
|
||||
|
||||
vim.cmd([[
|
||||
autocmd FileType markdown setlocal spell
|
||||
autocmd FileType text setlocal spell
|
||||
]])
|
||||
vim.opt.spellcapcheck = ""
|
||||
vim.pack.add({ "https://github.com/rktjmp/lush.nvim" })
|
||||
|
||||
theme = "jdkaplan-temp"
|
||||
vim.cmd.colorscheme(theme)
|
||||
|
|
@ -122,37 +98,527 @@ vim.keymap.set("n", "<C-l>", function()
|
|||
vim.cmd.redraw()
|
||||
end)
|
||||
|
||||
vim.diagnostic.config({ jump = { float = true } })
|
||||
-------------------------------------------------------------------------------
|
||||
-- tpope extended universe
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
function auto_correct(mode, old, new, scale, limit, cmd)
|
||||
delay = scale
|
||||
vim.pack.add({
|
||||
"https://github.com/tpope/vim-abolish",
|
||||
"https://github.com/tpope/vim-commentary",
|
||||
"https://github.com/tpope/vim-repeat",
|
||||
"https://github.com/tpope/vim-fugitive",
|
||||
})
|
||||
|
||||
vim.keymap.set(mode, old, function()
|
||||
vim.print("You should use " .. new)
|
||||
vim.cmd.sleep(delay .. "m")
|
||||
cmd()
|
||||
delay = math.min(delay + scale, limit)
|
||||
end)
|
||||
end
|
||||
vim.pack.add({ "https://github.com/kylechui/nvim-surround" })
|
||||
require("nvim-surround").setup()
|
||||
|
||||
-- TODO: Delete these ; fake-leader bindings
|
||||
vim.keymap.set("", ";;", ";")
|
||||
-------------------------------------------------------------------------------
|
||||
-- Editing
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
auto_correct("n", ';"', "<C-w>s", 100, 1000, vim.cmd.split)
|
||||
auto_correct("n", ";%", "<C-w>v", 100, 1000, vim.cmd.vsplit)
|
||||
auto_correct("n", ";0", "<C-w>c", 100, 1000, vim.cmd.close)
|
||||
auto_correct("n", ";h", "<C-w>h", 10, 500, function()
|
||||
vim.cmd.wincmd("h")
|
||||
end)
|
||||
auto_correct("n", ";j", "<C-w>j", 10, 500, function()
|
||||
vim.cmd.wincmd("j")
|
||||
end)
|
||||
auto_correct("n", ";k", "<C-w>k", 10, 500, function()
|
||||
vim.cmd.wincmd("k")
|
||||
end)
|
||||
auto_correct("n", ";l", "<C-w>l", 10, 500, function()
|
||||
vim.cmd.wincmd("l")
|
||||
end)
|
||||
vim.pack.add({ "https://github.com/windwp/nvim-autopairs" })
|
||||
require("nvim-autopairs").setup({
|
||||
opts = {
|
||||
map_cr = true,
|
||||
enable_moveright = true,
|
||||
enable_check_bracket_line = false,
|
||||
check_ts = true,
|
||||
},
|
||||
})
|
||||
|
||||
auto_correct("n", ";w", "<Space>s", 100, 1000, vim.cmd.write)
|
||||
auto_correct("n", ";<Space>", "<Space><Space>", 100, 1000, vim.cmd.nohlsearch)
|
||||
-------------------------------------------------------------------------------
|
||||
-- IDE
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({ "https://github.com/preservim/nerdtree" })
|
||||
vim.keymap.set("n", "<Space>tt", ":NERDTreeToggle<cr>")
|
||||
vim.keymap.set("n", "<Space>tf", ":NERDTreeFind<cr>")
|
||||
|
||||
vim.pack.add({ "https://github.com/lewis6991/gitsigns.nvim" })
|
||||
require("gitsigns").setup({
|
||||
signcolumn = false,
|
||||
current_line_blame = false,
|
||||
current_line_blame_formatter = " <author> <author_time:%Y-%m-%d> <summary>",
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol",
|
||||
delay = 0,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
});
|
||||
(function()
|
||||
local gitsigns = require("gitsigns")
|
||||
local toggle = function(value)
|
||||
-- BUG: (?) If the blame delay is not zero, the setting can
|
||||
-- enter a race with cursor movement and leave a ghost blame in
|
||||
-- the buffer.
|
||||
|
||||
show = not show
|
||||
gitsigns.toggle_current_line_blame(show)
|
||||
gitsigns.toggle_deleted(show)
|
||||
gitsigns.toggle_signs(show)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>gg", toggle)
|
||||
vim.keymap.set("n", "[h", gitsigns.prev_hunk)
|
||||
vim.keymap.set("n", "]h", gitsigns.next_hunk)
|
||||
end)()
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Treesitter
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({
|
||||
{
|
||||
src = "https://github.com/nvim-treesitter/nvim-treesitter",
|
||||
version = "4916d6592ede8c07973490d9322f187e07dfefac",
|
||||
},
|
||||
"https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
|
||||
})
|
||||
vim.api.nvim_create_autocmd("PackChanged", {
|
||||
callback = function(ev)
|
||||
local name, kind = ev.data.spec.name, ev.data.kind
|
||||
if name == "nvim-treesitter" and (kind == "install" or kind == "update") then
|
||||
require("nvim-treesitter").update()
|
||||
end
|
||||
end,
|
||||
})
|
||||
require("nvim-treesitter").install({
|
||||
"bash",
|
||||
"css",
|
||||
"dot",
|
||||
"diff",
|
||||
"git_config",
|
||||
"git_rebase",
|
||||
"gitattributes",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"go",
|
||||
"gomod",
|
||||
"gosum",
|
||||
"gowork",
|
||||
"html",
|
||||
"javascript",
|
||||
"jq",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"proto",
|
||||
"python",
|
||||
"ruby",
|
||||
"rust",
|
||||
"scss",
|
||||
"sql",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"yaml",
|
||||
})
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
enable = true,
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
include_surrounding_whitespace = false,
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects#overriding-or-extending-textobjects
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@comment.outer",
|
||||
["ic"] = "@comment.outer",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
goto_next_start = {
|
||||
["]m"] = "@function.outer",
|
||||
["]{"] = "@block.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]}"] = "@block.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[{"] = "@block.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[}"] = "@block.outer",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.pack.add({ "https://github.com/lukas-reineke/indent-blankline.nvim" })
|
||||
require("ibl").setup({
|
||||
indent = {
|
||||
char = "┊",
|
||||
},
|
||||
scope = { enabled = false },
|
||||
})
|
||||
|
||||
vim.pack.add({ "https://github.com/stevearc/aerial.nvim" })
|
||||
require("aerial").setup()
|
||||
vim.keymap.set("n", "<Space>st", "<cmd>AerialNavToggle<cr>")
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Telescope
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({
|
||||
{
|
||||
src = "https://github.com/nvim-telescope/telescope.nvim",
|
||||
version = vim.version.range("^0.2"),
|
||||
},
|
||||
"https://github.com/nvim-lua/plenary.nvim",
|
||||
"https://github.com/nvim-telescope/telescope-fzf-native.nvim",
|
||||
"https://github.com/nvim-telescope/telescope-ui-select.nvim",
|
||||
})
|
||||
-- TODO: Is it possible to make this run synchronously here, but only on install/update?
|
||||
vim
|
||||
.system({ "make" }, {
|
||||
cwd = vim.pack.get({ "telescope-fzf-native.nvim" })[1].path,
|
||||
})
|
||||
:wait();
|
||||
(function()
|
||||
local telescope = require("telescope")
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("aerial")
|
||||
telescope.load_extension("ui-select")
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
local function find_files(opts)
|
||||
opts = opts or {}
|
||||
opts["hidden"] = true
|
||||
return builtin.find_files(opts)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Space>f", find_files)
|
||||
vim.keymap.set("n", "<Space>/", builtin.live_grep)
|
||||
vim.keymap.set("n", "<Space>b", builtin.buffers)
|
||||
vim.keymap.set("n", "<Space>*", builtin.grep_string)
|
||||
vim.keymap.set("n", "<Space>o", telescope.extensions.aerial.aerial)
|
||||
|
||||
vim.keymap.set("n", "<Space><Space>", builtin.builtin)
|
||||
vim.keymap.set("i", "<Space>i", builtin.symbols)
|
||||
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local transform_mod = require("telescope.actions.mt").transform_mod
|
||||
|
||||
-- https://github.com/nvim-telescope/telescope.nvim/issues/1048#issuecomment-1225975038
|
||||
local function multiopen(prompt_bufnr, method)
|
||||
local method = method or "default"
|
||||
|
||||
local edit_file_cmd_map = {
|
||||
vertical = "vsplit",
|
||||
horizontal = "split",
|
||||
tab = "tabedit",
|
||||
default = "edit",
|
||||
}
|
||||
local edit_buf_cmd_map = {
|
||||
vertical = "vert sbuffer",
|
||||
horizontal = "sbuffer",
|
||||
tab = "tab sbuffer",
|
||||
default = "buffer",
|
||||
}
|
||||
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
local multi_selection = picker:get_multi_selection()
|
||||
|
||||
if #multi_selection > 1 then
|
||||
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
||||
pcall(vim.api.nvim_set_current_win, picker.original_win_id)
|
||||
|
||||
for i, entry in ipairs(multi_selection) do
|
||||
local filename, row, col
|
||||
|
||||
if entry.path or entry.filename then
|
||||
filename = entry.path or entry.filename
|
||||
|
||||
row = entry.row or entry.lnum
|
||||
col = vim.F.if_nil(entry.col, 1)
|
||||
elseif not entry.bufnr then
|
||||
local value = entry.value
|
||||
if not value then
|
||||
goto continue
|
||||
end
|
||||
|
||||
if type(value) == "table" then
|
||||
value = entry.display
|
||||
end
|
||||
|
||||
local sections = vim.split(value, ":")
|
||||
|
||||
filename = sections[1]
|
||||
row = tonumber(sections[2])
|
||||
col = tonumber(sections[3])
|
||||
end
|
||||
|
||||
local entry_bufnr = entry.bufnr
|
||||
|
||||
if entry_bufnr then
|
||||
if not vim.api.nvim_buf_get_option(entry_bufnr, "buflisted") then
|
||||
vim.api.nvim_buf_set_option(entry_bufnr, "buflisted", true)
|
||||
end
|
||||
local command = i == 1 and "buffer" or edit_buf_cmd_map[method]
|
||||
pcall(vim.cmd, string.format("%s %s", command, vim.api.nvim_buf_get_name(entry_bufnr)))
|
||||
else
|
||||
local command = i == 1 and "edit" or edit_file_cmd_map[method]
|
||||
if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then
|
||||
filename = require("plenary.path"):new(vim.fn.fnameescape(filename)):normalize(vim.loop.cwd())
|
||||
pcall(vim.cmd, string.format("%s %s", command, filename))
|
||||
end
|
||||
end
|
||||
|
||||
if row and col then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, { row, col - 1 })
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
else
|
||||
actions["select_" .. method](prompt_bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<CR>"] = multiopen,
|
||||
},
|
||||
n = {
|
||||
["<CR>"] = multiopen,
|
||||
},
|
||||
},
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
-- Include hidden files, but continue ignoring the .git directory itself.
|
||||
"--hidden",
|
||||
"--iglob",
|
||||
"!.git",
|
||||
},
|
||||
},
|
||||
pickers = {},
|
||||
extensions = {
|
||||
aerial = {},
|
||||
},
|
||||
})
|
||||
end)()
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Completion and snippets
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({
|
||||
{
|
||||
src = "https://github.com/L3MON4D3/LuaSnip",
|
||||
version = vim.version.range("^2"),
|
||||
},
|
||||
"https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||
"https://github.com/hrsh7th/nvim-cmp",
|
||||
"https://github.com/saadparwaiz1/cmp_luasnip",
|
||||
})
|
||||
|
||||
-- TODO: Is it possible to make this run synchronously here, but only on install/update?
|
||||
vim
|
||||
.system({ "make", "install_jsregexp" }, {
|
||||
cwd = vim.pack.get({ "LuaSnip" })[1].path,
|
||||
})
|
||||
:wait();
|
||||
(function()
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
luasnip.filetype_extend("typescript", { "javascript" })
|
||||
luasnip.filetype_extend("typescriptreact", { "javascript", "react" })
|
||||
|
||||
-- Put snippets in ./snippets/<filetype>.snippets
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
require("luasnip.loaders.from_lua").lazy_load()
|
||||
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
completion = {
|
||||
autocomplete = false,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
})
|
||||
end)()
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Language-specific plugins
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
-- Rust
|
||||
vim.pack.add({ {
|
||||
src = "https://github.com/mrcjkb/rustaceanvim",
|
||||
version = vim.version.range("^9"),
|
||||
} })
|
||||
|
||||
-- Uiua
|
||||
vim.pack.add({ "https://github.com/Apeiros-46B/uiua.vim" })
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Language Server Protocol (LSP)
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({ "https://github.com/neovim/nvim-lspconfig" })
|
||||
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
|
||||
if client:supports_method("textDocument/completion") then
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = false })
|
||||
end
|
||||
|
||||
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
|
||||
already_waits = client:supports_method("textDocument/willSaveWaitUntil")
|
||||
can_fmt = client:supports_method("textDocument/formatting")
|
||||
|
||||
should_fmt = ({
|
||||
-- tsserver/ts_ls seems to have no other way of disabling formatting.
|
||||
["ts_ls"] = false,
|
||||
-- zls doesn't seem to trigger the normal way.
|
||||
["zls"] = true,
|
||||
})[client.name]
|
||||
|
||||
if should_fmt == nil then
|
||||
should_fmt = not already_waits and can_fmt
|
||||
end
|
||||
|
||||
if should_fmt then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.lsp.enable("eslint")
|
||||
vim.lsp.config("eslint", {
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function()
|
||||
client:request_sync("workspace/executeCommand", {
|
||||
command = "eslint.applyAllFixes",
|
||||
arguments = {
|
||||
{
|
||||
uri = vim.uri_from_bufnr(bufnr),
|
||||
version = vim.lsp.util.buf_versions[bufnr],
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.lsp.enable("stylua")
|
||||
|
||||
-- rust-analyzer is already enabled and configured by rustaceanvim
|
||||
|
||||
vim.lsp.enable("uiua")
|
||||
|
||||
vim.lsp.enable("zls")
|
||||
vim.lsp.config("zls", {
|
||||
settings = {
|
||||
enable_build_on_save = true,
|
||||
inlay_hints_hide_redundant_param_names = true,
|
||||
inlay_hints_hide_redundant_param_names_last_token = true,
|
||||
warn_style = true,
|
||||
},
|
||||
})
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- which-key
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
vim.pack.add({ "https://github.com/folke/which-key.nvim" })
|
||||
require("which-key").setup({
|
||||
preset = "helix",
|
||||
keys = {
|
||||
Up = " ",
|
||||
Down = " ",
|
||||
Left = " ",
|
||||
Right = " ",
|
||||
C = "^",
|
||||
M = "M-",
|
||||
D = "W-",
|
||||
S = "S-",
|
||||
CR = "CR",
|
||||
Esc = "Esc",
|
||||
ScrollWheelDown = "⤓",
|
||||
ScrollWheelUp = "⤒",
|
||||
NL = "⏎",
|
||||
BS = "⇐",
|
||||
Space = "Space",
|
||||
Tab = "Tab",
|
||||
F1 = "F1",
|
||||
F2 = "F2",
|
||||
F3 = "F3",
|
||||
F4 = "F4",
|
||||
F5 = "F5",
|
||||
F6 = "F6",
|
||||
F7 = "F7",
|
||||
F8 = "F8",
|
||||
F9 = "F9",
|
||||
F10 = "F10",
|
||||
F11 = "F11",
|
||||
F12 = "F12",
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("", "<Space>?", function()
|
||||
require("which-key").show()
|
||||
end, { desc = "which-key" })
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "ccf25a5452b8697a823de3e5ecda63ed3d723b79" },
|
||||
"aerial.nvim": { "branch": "master", "commit": "5e687b5a14004fa2dd9eccbee042b96869fe1557" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"context.vim": { "branch": "master", "commit": "82eb26de265292808917b82f3eda2725b53d785c" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "220446c8c86a280180d852efac60991eaf1a21d4" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "005b56001b2cb30bfa61b7986bc50657816ba4ba" },
|
||||
"keytrail.nvim": { "branch": "main", "commit": "153a76d5891065a328be82316b6813662904da71" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "ed4dc336a73c18da6fea6e1cf7ad6e1b76d281eb" },
|
||||
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1d77bd86e1c3eaa777010c95dad455b83823f247" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"nerdtree": { "branch": "master", "commit": "690d061b591525890f1471c6675bcb5bdc8cdff9" },
|
||||
"none-ls.nvim": { "branch": "main", "commit": "a96172f673f720cd4f3572e1fcd08400ed3eb25d" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7a2c97cccd60abc559344042fefb1d5a85b3e33b" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a7bcf1d88069fc67c9ace8a62ba480b8fe879025" },
|
||||
"nvim-coverage": { "branch": "main", "commit": "a939e425e363319d952a6c35fb3f38b34041ded2" },
|
||||
"nvim-dap": { "branch": "master", "commit": "6782b097af2417a4c3e33849b0a26ae2188bd7ea" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a9b2fb560c4ab22c10728fd5149dbd7b62aa4f69" },
|
||||
"nvim-surround": { "branch": "main", "commit": "fcfa7e02323d57bfacc3a141f8a74498e1522064" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "a9742cbc1f95db9eaf3293bf8cd0622ca36542bb" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "c4ca798ab95b316a768d51eaaaee48f64a4a46bc" },
|
||||
"openingh.nvim": { "branch": "main", "commit": "99fe3b052c827ea0ec4d88d7d141d4a4239f1487" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||
"rustaceanvim": { "branch": "master", "commit": "12504405821c05874d2d1f6b5ec919f9808e2c99" },
|
||||
"sql-ghosty.nvim": { "branch": "main", "commit": "7a61ef8536a515fd68ff211fb4362049a1c1e191" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||
"telescope-symbols.nvim": { "branch": "master", "commit": "a6d0127a53d39b9fc2af75bd169d288166118aec" },
|
||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"uiua.vim": { "branch": "main", "commit": "7088832aa53258a30ec50639193af8510f621f69" },
|
||||
"unimpaired.nvim": { "branch": "main", "commit": "4995cb674cb4c5e442f0cd9d86f6f9c20333a0b8" },
|
||||
"vim-abolish": { "branch": "master", "commit": "dcbfe065297d31823561ba787f51056c147aa682" },
|
||||
"vim-addon-local-vimrc": { "branch": "master", "commit": "5430ada07e199aba932f9eab68399e624512596f" },
|
||||
"vim-better-whitespace": { "branch": "master", "commit": "de99b55a6fe8c96a69f9376f16b1d5d627a56e81" },
|
||||
"vim-bufkill": { "branch": "master", "commit": "3113181d0c1bfb8719f3ddcd2e2f35a8d763d1e5" },
|
||||
"vim-commentary": { "branch": "master", "commit": "64a654ef4a20db1727938338310209b6a63f60c9" },
|
||||
"vim-easy-align": { "branch": "master", "commit": "9815a55dbcd817784458df7a18acacc6f82b1241" },
|
||||
"vim-endwise": { "branch": "master", "commit": "eab530110d7a0d985902a3964894816b50dbf31a" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
|
||||
"vim-illuminate": { "branch": "master", "commit": "0d1e93684da00ab7c057410fecfc24f434698898" },
|
||||
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "b4177e3eaf15fe5eb8357ebac2286d488be1ed00" }
|
||||
}
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
return {
|
||||
-- Theme
|
||||
"rktjmp/lush.nvim",
|
||||
|
||||
-- tpope extended universe
|
||||
"tpope/vim-abolish",
|
||||
"tpope/vim-commentary",
|
||||
"tpope/vim-endwise",
|
||||
"tpope/vim-repeat",
|
||||
{ "kylechui/nvim-surround", config = true },
|
||||
{
|
||||
"tpope/vim-fugitive",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<Space>G", ":Git<Space>", mode = "n" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"tummetott/unimpaired.nvim",
|
||||
opts = {
|
||||
keymaps = {
|
||||
-- Tags
|
||||
tprevious = false,
|
||||
tnext = false,
|
||||
tfirst = false,
|
||||
tlast = false,
|
||||
ptprevious = false,
|
||||
ptnext = false,
|
||||
|
||||
-- Files
|
||||
previous_file = false,
|
||||
next_file = false,
|
||||
|
||||
-- Settings
|
||||
enable_cursorline = false,
|
||||
disable_cursorline = false,
|
||||
toggle_cursorline = false,
|
||||
enable_diff = false,
|
||||
disable_diff = false,
|
||||
toggle_diff = false,
|
||||
enable_hlsearch = false,
|
||||
disable_hlsearch = false,
|
||||
toggle_hlsearch = false,
|
||||
enable_ignorecase = false,
|
||||
disable_ignorecase = false,
|
||||
toggle_ignorecase = false,
|
||||
enable_list = false,
|
||||
disable_list = false,
|
||||
toggle_list = false,
|
||||
enable_number = false,
|
||||
disable_number = false,
|
||||
toggle_number = false,
|
||||
enable_relativenumber = false,
|
||||
disable_relativenumber = false,
|
||||
toggle_relativenumber = false,
|
||||
enable_spell = false,
|
||||
disable_spell = false,
|
||||
toggle_spell = false,
|
||||
enable_background = false,
|
||||
disable_background = false,
|
||||
toggle_background = false,
|
||||
enable_colorcolumn = false,
|
||||
disable_colorcolumn = false,
|
||||
toggle_colorcolumn = false,
|
||||
enable_cursorcolumn = false,
|
||||
disable_cursorcolumn = false,
|
||||
toggle_cursorcolumn = false,
|
||||
enable_virtualedit = false,
|
||||
disable_virtualedit = false,
|
||||
toggle_virtualedit = false,
|
||||
enable_wrap = false,
|
||||
disable_wrap = false,
|
||||
toggle_wrap = false,
|
||||
enable_cursorcross = false,
|
||||
disable_cursorcross = false,
|
||||
toggle_cursorcross = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- etc.
|
||||
"MarcWeber/vim-addon-local-vimrc",
|
||||
"qpkorr/vim-bufkill",
|
||||
{
|
||||
"almo7aya/openingh.nvim",
|
||||
url = "https://github.com/jdkaplan/openingh.nvim",
|
||||
keys = {
|
||||
{ "<Leader>gh", "V:OpenInGHFile<CR>", mode = { "n" } },
|
||||
{ "<Leader>gh", ":OpenInGHFile<CR>", mode = { "v" } },
|
||||
},
|
||||
},
|
||||
{
|
||||
"junegunn/vim-easy-align",
|
||||
keys = {
|
||||
{ "ga", "<Plug>(EasyAlign)", mode = "x" },
|
||||
{ "ga", "<Plug>(EasyAlign)", mode = "n" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"ntpeters/vim-better-whitespace",
|
||||
init = function()
|
||||
vim.g.better_whitespace_enabled = 1
|
||||
vim.g.better_whitespace_filetypes_blacklist = { "diff", "zig" }
|
||||
vim.g.strip_whitespace_on_save = 1
|
||||
vim.g.strip_whitespace_confirm = 0
|
||||
vim.g.better_whitespace_operator = ""
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
opts = {
|
||||
map_cr = true,
|
||||
enable_moveright = true,
|
||||
enable_check_bracket_line = false,
|
||||
check_ts = true,
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
preset = "helix",
|
||||
keys = {
|
||||
Up = " ",
|
||||
Down = " ",
|
||||
Left = " ",
|
||||
Right = " ",
|
||||
C = "^",
|
||||
M = "M-",
|
||||
D = "W-",
|
||||
S = "S-",
|
||||
CR = "CR",
|
||||
Esc = "Esc",
|
||||
ScrollWheelDown = "⤓",
|
||||
ScrollWheelUp = "⤒",
|
||||
NL = "⏎",
|
||||
BS = "⇐",
|
||||
Space = "Space",
|
||||
Tab = "Tab",
|
||||
F1 = "F1",
|
||||
F2 = "F2",
|
||||
F3 = "F3",
|
||||
F4 = "F4",
|
||||
F5 = "F5",
|
||||
F6 = "F6",
|
||||
F7 = "F7",
|
||||
F8 = "F8",
|
||||
F9 = "F9",
|
||||
F10 = "F10",
|
||||
F11 = "F11",
|
||||
F12 = "F12",
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,641 +0,0 @@
|
|||
vim.lsp.inlay_hint.enable(true)
|
||||
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("jdkaplan.lsp", {}),
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
|
||||
if client:supports_method("textDocument/completion") then
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = false })
|
||||
end
|
||||
|
||||
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
|
||||
already_waits = client:supports_method("textDocument/willSaveWaitUntil")
|
||||
can_fmt = client:supports_method("textDocument/formatting")
|
||||
|
||||
should_fmt = ({
|
||||
-- tsserver/ts_ls seems to have no other way of disabling formatting.
|
||||
["ts_ls"] = false,
|
||||
-- zls doesn't seem to trigger the normal way.
|
||||
["zls"] = true,
|
||||
})[client.name]
|
||||
|
||||
if should_fmt == nil then
|
||||
should_fmt = not already_waits and can_fmt
|
||||
end
|
||||
|
||||
if should_fmt then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = vim.api.nvim_create_augroup("jdkaplan.lsp", { clear = false }),
|
||||
buffer = args.buf,
|
||||
callback = function()
|
||||
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.lsp.config("eslint", {
|
||||
on_attach = function(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
callback = function()
|
||||
client:request_sync("workspace/executeCommand", {
|
||||
command = "eslint.applyAllFixes",
|
||||
arguments = {
|
||||
{
|
||||
uri = vim.uri_from_bufnr(bufnr),
|
||||
version = vim.lsp.util.buf_versions[bufnr],
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.lsp.config("zls", {
|
||||
settings = {
|
||||
enable_build_on_save = true,
|
||||
inlay_hints_hide_redundant_param_names = true,
|
||||
inlay_hints_hide_redundant_param_names_last_token = true,
|
||||
warn_style = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.enable("uiua")
|
||||
|
||||
return {
|
||||
-- HUD
|
||||
{
|
||||
"preservim/nerdtree",
|
||||
keys = {
|
||||
{ "<leader>t", ":NERDTreeToggle<cr>" },
|
||||
{ "<leader>a", ":NERDTreeFind<cr>" },
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/aerial.nvim",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>m", "<cmd>AerialToggle<cr>" },
|
||||
{ "<leader>n", "<cmd>AerialNavToggle<cr>" },
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
"wellle/context.vim",
|
||||
lazy = false,
|
||||
init = function()
|
||||
vim.g.context_enabled = 0
|
||||
vim.keymap.set("", "<leader>cc", ":ContextToggleWindow<CR>", { silent = true })
|
||||
vim.keymap.set("", "<leader>cp", ":ContextPeek<CR>", { silent = true })
|
||||
end,
|
||||
},
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
commit = "220446c8c86a280180d852efac60991eaf1a21d4",
|
||||
lazy = false,
|
||||
init = function()
|
||||
local gitsigns = require("gitsigns")
|
||||
|
||||
local toggle = function(value)
|
||||
-- BUG: (?) If the blame delay is not zero, the setting can
|
||||
-- enter a race with cursor movement and leave a ghost blame in
|
||||
-- the buffer.
|
||||
|
||||
show = not show
|
||||
gitsigns.toggle_current_line_blame(show)
|
||||
gitsigns.toggle_deleted(show)
|
||||
gitsigns.toggle_signs(show)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>gg", toggle)
|
||||
vim.keymap.set("n", "[h", gitsigns.prev_hunk)
|
||||
vim.keymap.set("n", "]h", gitsigns.next_hunk)
|
||||
end,
|
||||
opts = {
|
||||
signcolumn = false,
|
||||
show_deleted = false,
|
||||
current_line_blame = false,
|
||||
current_line_blame_formatter = " <author> <author_time:%Y-%m-%d> <summary>",
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = "eol",
|
||||
delay = 0,
|
||||
ignore_whitespace = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"RRethy/vim-illuminate",
|
||||
init = function()
|
||||
local illuminate = require("illuminate")
|
||||
illuminate.configure({
|
||||
delay = 500,
|
||||
})
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>ii",
|
||||
function()
|
||||
require("illuminate").toggle_buf()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<leader>in",
|
||||
function()
|
||||
require("illuminate").goto_next_reference()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<leader>ip",
|
||||
function()
|
||||
require("illuminate").goto_prev_reference()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"<leader>if",
|
||||
function()
|
||||
require("illuminate").toggle_freeze_buf()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
indent = {
|
||||
char = "┊",
|
||||
},
|
||||
scope = { enabled = false },
|
||||
},
|
||||
},
|
||||
{
|
||||
"andythigpen/nvim-coverage",
|
||||
requires = { "nvim-lua/plenary.nvim" },
|
||||
version = "*",
|
||||
config = function()
|
||||
require("coverage").setup({
|
||||
auto_reload = true,
|
||||
signs = {
|
||||
covered = { text = "▎" },
|
||||
partial = { text = "▌" },
|
||||
uncovered = { text = "█" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"pmouraguedes/sql-ghosty.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
"jfryy/keytrail.nvim",
|
||||
url = "https://github.com/jdkaplan/keytrail.nvim",
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter" },
|
||||
opts = {
|
||||
key_mapping = "<Space>j",
|
||||
},
|
||||
},
|
||||
|
||||
-- Treesitter
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
init = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
highlight = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
|
||||
textobjects = {
|
||||
enable = true,
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true,
|
||||
include_surrounding_whitespace = false,
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects#overriding-or-extending-textobjects
|
||||
keymaps = {
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@comment.outer",
|
||||
["ic"] = "@comment.outer",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
goto_next_start = {
|
||||
["]m"] = "@function.outer",
|
||||
["]{"] = "@block.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]}"] = "@block.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[{"] = "@block.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[}"] = "@block.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"css",
|
||||
"dot",
|
||||
"diff",
|
||||
"git_config",
|
||||
"git_rebase",
|
||||
"gitattributes",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"go",
|
||||
"gomod",
|
||||
"gosum",
|
||||
"gowork",
|
||||
"html",
|
||||
"javascript",
|
||||
"jq",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"proto",
|
||||
"python",
|
||||
"ruby",
|
||||
"rust",
|
||||
"scss",
|
||||
"sql",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"yaml",
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
dependencies = {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
opts = {
|
||||
autotag = {
|
||||
enabled = true,
|
||||
enable_close_on_slash = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- Telescope
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
version = "^0.1.0",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
"nvim-telescope/telescope-ui-select.nvim",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"stevearc/aerial.nvim",
|
||||
"nvim-telescope/telescope-symbols.nvim",
|
||||
},
|
||||
init = function()
|
||||
local telescope = require("telescope")
|
||||
telescope.load_extension("fzf")
|
||||
telescope.load_extension("aerial")
|
||||
telescope.load_extension("ui-select")
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
local function find_files(opts)
|
||||
opts = opts or {}
|
||||
opts["hidden"] = true
|
||||
return builtin.find_files(opts)
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<Space>f", find_files)
|
||||
vim.keymap.set("n", "<Space>g", builtin.live_grep)
|
||||
vim.keymap.set("n", "<Space>b", builtin.buffers)
|
||||
vim.keymap.set("n", "<Space>*", builtin.grep_string)
|
||||
vim.keymap.set("n", "<Space>o", telescope.extensions.aerial.aerial)
|
||||
vim.keymap.set("n", "<Space>t", builtin.builtin)
|
||||
|
||||
-- TODO: Delete these ; fake-leader bindings
|
||||
vim.keymap.set("n", ";f", find_files)
|
||||
vim.keymap.set("n", ";g", builtin.live_grep)
|
||||
vim.keymap.set("n", ";b", builtin.buffers)
|
||||
vim.keymap.set("n", ";*", builtin.grep_string)
|
||||
|
||||
vim.keymap.set("i", "<C-G><C-F>", builtin.symbols)
|
||||
end,
|
||||
opts = function(_plugin, _config)
|
||||
local actions = require("telescope.actions")
|
||||
local action_state = require("telescope.actions.state")
|
||||
local transform_mod = require("telescope.actions.mt").transform_mod
|
||||
|
||||
-- https://github.com/nvim-telescope/telescope.nvim/issues/1048#issuecomment-1225975038
|
||||
local function multiopen(prompt_bufnr, method)
|
||||
local method = method or "default"
|
||||
|
||||
local edit_file_cmd_map = {
|
||||
vertical = "vsplit",
|
||||
horizontal = "split",
|
||||
tab = "tabedit",
|
||||
default = "edit",
|
||||
}
|
||||
local edit_buf_cmd_map = {
|
||||
vertical = "vert sbuffer",
|
||||
horizontal = "sbuffer",
|
||||
tab = "tab sbuffer",
|
||||
default = "buffer",
|
||||
}
|
||||
|
||||
local picker = action_state.get_current_picker(prompt_bufnr)
|
||||
local multi_selection = picker:get_multi_selection()
|
||||
|
||||
if #multi_selection > 1 then
|
||||
require("telescope.pickers").on_close_prompt(prompt_bufnr)
|
||||
pcall(vim.api.nvim_set_current_win, picker.original_win_id)
|
||||
|
||||
for i, entry in ipairs(multi_selection) do
|
||||
local filename, row, col
|
||||
|
||||
if entry.path or entry.filename then
|
||||
filename = entry.path or entry.filename
|
||||
|
||||
row = entry.row or entry.lnum
|
||||
col = vim.F.if_nil(entry.col, 1)
|
||||
elseif not entry.bufnr then
|
||||
local value = entry.value
|
||||
if not value then
|
||||
goto continue
|
||||
end
|
||||
|
||||
if type(value) == "table" then
|
||||
value = entry.display
|
||||
end
|
||||
|
||||
local sections = vim.split(value, ":")
|
||||
|
||||
filename = sections[1]
|
||||
row = tonumber(sections[2])
|
||||
col = tonumber(sections[3])
|
||||
end
|
||||
|
||||
local entry_bufnr = entry.bufnr
|
||||
|
||||
if entry_bufnr then
|
||||
if not vim.api.nvim_buf_get_option(entry_bufnr, "buflisted") then
|
||||
vim.api.nvim_buf_set_option(entry_bufnr, "buflisted", true)
|
||||
end
|
||||
local command = i == 1 and "buffer" or edit_buf_cmd_map[method]
|
||||
pcall(vim.cmd, string.format("%s %s", command, vim.api.nvim_buf_get_name(entry_bufnr)))
|
||||
else
|
||||
local command = i == 1 and "edit" or edit_file_cmd_map[method]
|
||||
if vim.api.nvim_buf_get_name(0) ~= filename or command ~= "edit" then
|
||||
filename = require("plenary.path"):new(vim.fn.fnameescape(filename)):normalize(vim.loop.cwd())
|
||||
pcall(vim.cmd, string.format("%s %s", command, filename))
|
||||
end
|
||||
end
|
||||
|
||||
if row and col then
|
||||
pcall(vim.api.nvim_win_set_cursor, 0, { row, col - 1 })
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
else
|
||||
actions["select_" .. method](prompt_bufnr)
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<CR>"] = multiopen,
|
||||
},
|
||||
n = {
|
||||
["<CR>"] = multiopen,
|
||||
},
|
||||
},
|
||||
vimgrep_arguments = {
|
||||
"rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
-- Include hidden files, but continue ignoring the .git directory itself.
|
||||
"--hidden",
|
||||
"--iglob",
|
||||
"!.git",
|
||||
},
|
||||
},
|
||||
pickers = {},
|
||||
extensions = {
|
||||
aerial = {},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
},
|
||||
|
||||
-- LSP
|
||||
{
|
||||
"mrcjkb/rustaceanvim",
|
||||
version = "^6",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"Apeiros-46B/uiua.vim",
|
||||
lazy = false,
|
||||
},
|
||||
{
|
||||
"mason-org/mason-lspconfig.nvim",
|
||||
opts = {},
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = {
|
||||
PATH = "append",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"nvimtools/none-ls.nvim",
|
||||
config = function(_plugin, opts)
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local group = vim.api.nvim_create_augroup("lsp_format_on_save", { clear = false })
|
||||
|
||||
local prettier_filetypes = {}
|
||||
for k, v in ipairs(null_ls.builtins.formatting.prettier.filetypes) do
|
||||
prettier_filetypes[k] = v
|
||||
end
|
||||
table.insert(prettier_filetypes, "htmldjango") -- Jinja templates
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
filetypes = prettier_filetypes,
|
||||
}),
|
||||
null_ls.builtins.formatting.pg_format,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Completion + snippets
|
||||
{ "hrsh7th/cmp-nvim-lsp", branch = "main" },
|
||||
{ "hrsh7th/nvim-cmp", branch = "main" },
|
||||
{
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
dependencies = {
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
build = "make install_jsregexp",
|
||||
init = function()
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
luasnip.filetype_extend("typescript", { "javascript" })
|
||||
luasnip.filetype_extend("typescriptreact", { "javascript", "react" })
|
||||
|
||||
-- Put snippets in ./snippets/<filetype>.snippets
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
require("luasnip.loaders.from_lua").lazy_load()
|
||||
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
completion = {
|
||||
autocomplete = false,
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Debugging
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
"<Leader>db",
|
||||
function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end,
|
||||
desc = "Toggle breakpoint",
|
||||
},
|
||||
{
|
||||
"<Leader>dB",
|
||||
function()
|
||||
require("dap").set_breakpoint()
|
||||
end,
|
||||
desc = "Set breakpoint",
|
||||
},
|
||||
{
|
||||
"<Leader>dc",
|
||||
function()
|
||||
require("dap").continue()
|
||||
end,
|
||||
desc = "Continue",
|
||||
},
|
||||
{
|
||||
"<Leader>dn",
|
||||
function()
|
||||
require("dap").step_over()
|
||||
end,
|
||||
desc = "Step over",
|
||||
},
|
||||
{
|
||||
"<Leader>dsi",
|
||||
function()
|
||||
require("dap").step_into()
|
||||
end,
|
||||
desc = "Step into",
|
||||
},
|
||||
{
|
||||
"<Leader>dso",
|
||||
function()
|
||||
require("dap").step_out()
|
||||
end,
|
||||
desc = "Step out",
|
||||
},
|
||||
{
|
||||
"<Leader>dj",
|
||||
function()
|
||||
require("dap").down()
|
||||
end,
|
||||
desc = "Down",
|
||||
},
|
||||
{
|
||||
"<Leader>dk",
|
||||
function()
|
||||
require("dap").up()
|
||||
end,
|
||||
desc = "Up",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
108
neovim/nvim-pack-lock.json
Normal file
108
neovim/nvim-pack-lock.json
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
{
|
||||
"plugins": {
|
||||
"LuaSnip": {
|
||||
"rev": "642b0c595e11608b4c18219e93b88d7637af27bc",
|
||||
"src": "https://github.com/L3MON4D3/LuaSnip",
|
||||
"version": "2.0.0 - 3.0.0"
|
||||
},
|
||||
"aerial.nvim": {
|
||||
"rev": "585db11015abccf673dc5bd6502714d5655554be",
|
||||
"src": "https://github.com/stevearc/aerial.nvim"
|
||||
},
|
||||
"cmp-nvim-lsp": {
|
||||
"rev": "cbc7b02bb99fae35cb42f514762b89b5126651ef",
|
||||
"src": "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
"cmp_luasnip": {
|
||||
"rev": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90",
|
||||
"src": "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
"gitsigns.nvim": {
|
||||
"rev": "dd3f588bacbeb041be6facf1742e42097f62165d",
|
||||
"src": "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
"indent-blankline.nvim": {
|
||||
"rev": "d28a3f70721c79e3c5f6693057ae929f3d9c0a03",
|
||||
"src": "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||
},
|
||||
"lush.nvim": {
|
||||
"rev": "9c60ec2279d62487d942ce095e49006af28eed6e",
|
||||
"src": "https://github.com/rktjmp/lush.nvim"
|
||||
},
|
||||
"nerdtree": {
|
||||
"rev": "690d061b591525890f1471c6675bcb5bdc8cdff9",
|
||||
"src": "https://github.com/preservim/nerdtree"
|
||||
},
|
||||
"nvim-autopairs": {
|
||||
"rev": "7b9923abad60b903ece7c52940e1321d39eccc79",
|
||||
"src": "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
"nvim-cmp": {
|
||||
"rev": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca",
|
||||
"src": "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
"nvim-lspconfig": {
|
||||
"rev": "9573948c38bfabeec353ae7dd7d3ffec4c506a6b",
|
||||
"src": "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
"nvim-surround": {
|
||||
"rev": "2e93e154de9ff326def6480a4358bfc149d5da2c",
|
||||
"src": "https://github.com/kylechui/nvim-surround"
|
||||
},
|
||||
"nvim-treesitter": {
|
||||
"rev": "4916d6592ede8c07973490d9322f187e07dfefac",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter",
|
||||
"version": "'4916d6592ede8c07973490d9322f187e07dfefac'"
|
||||
},
|
||||
"nvim-treesitter-textobjects": {
|
||||
"rev": "851e865342e5a4cb1ae23d31caf6e991e1c99f1e",
|
||||
"src": "https://github.com/nvim-treesitter/nvim-treesitter-textobjects"
|
||||
},
|
||||
"plenary.nvim": {
|
||||
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
|
||||
"src": "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
"rustaceanvim": {
|
||||
"rev": "a60811ae6054ba981cb4693aaecd715dea783327",
|
||||
"src": "https://github.com/mrcjkb/rustaceanvim",
|
||||
"version": "9.0.0 - 10.0.0"
|
||||
},
|
||||
"telescope-fzf-native.nvim": {
|
||||
"rev": "b25b749b9db64d375d782094e2b9dce53ad53a40",
|
||||
"src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
|
||||
},
|
||||
"telescope-ui-select.nvim": {
|
||||
"rev": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2",
|
||||
"src": "https://github.com/nvim-telescope/telescope-ui-select.nvim"
|
||||
},
|
||||
"telescope.nvim": {
|
||||
"rev": "5255aa27c422de944791318024167ad5d40aad20",
|
||||
"src": "https://github.com/nvim-telescope/telescope.nvim",
|
||||
"version": "0.2.0 - 0.3.0"
|
||||
},
|
||||
"uiua.vim": {
|
||||
"rev": "5071e4a22fd2952617ae995cd3fab737c77753ae",
|
||||
"src": "https://github.com/Apeiros-46B/uiua.vim"
|
||||
},
|
||||
"vim-abolish": {
|
||||
"rev": "dcbfe065297d31823561ba787f51056c147aa682",
|
||||
"src": "https://github.com/tpope/vim-abolish"
|
||||
},
|
||||
"vim-commentary": {
|
||||
"rev": "64a654ef4a20db1727938338310209b6a63f60c9",
|
||||
"src": "https://github.com/tpope/vim-commentary"
|
||||
},
|
||||
"vim-fugitive": {
|
||||
"rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0",
|
||||
"src": "https://github.com/tpope/vim-fugitive"
|
||||
},
|
||||
"vim-repeat": {
|
||||
"rev": "65846025c15494983dafe5e3b46c8f88ab2e9635",
|
||||
"src": "https://github.com/tpope/vim-repeat"
|
||||
},
|
||||
"which-key.nvim": {
|
||||
"rev": "3aab2147e74890957785941f0c1ad87d0a44c15a",
|
||||
"src": "https://github.com/folke/which-key.nvim"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -exuo pipefail
|
||||
|
||||
VENV="${HOME}/.virtualenvs/neovim3"
|
||||
PYTHON="${VENV}/bin/python"
|
||||
|
||||
if [ -d "${VENV}" ]; then
|
||||
# Upgrade the venv if the global Python version has changed.
|
||||
local_py=$("${PYTHON}" --version)
|
||||
global_py=$(python3 --version)
|
||||
if [ "${local_py}" != "${global_py}" ]; then
|
||||
python3 -m venv --upgrade "${VENV}"
|
||||
"${PYTHON}" -m pip install --upgrade pip
|
||||
fi
|
||||
else
|
||||
python3 -m venv "${VENV}"
|
||||
fi
|
||||
|
||||
if ! "${PYTHON}" -c 'import pynvim'; then
|
||||
"${PYTHON}" -m ensurepip
|
||||
"${PYTHON}" -m pip install pynvim
|
||||
fi
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
- shell:
|
||||
- ./neovim/postinstall
|
||||
Loading…
Add table
Add a link
Reference in a new issue