Big neovim config refactor + adjustments
This commit is contained in:
parent
8031f3fe6a
commit
5574cc866a
|
@ -1,49 +1,9 @@
|
||||||
--[[
|
-- Basic vim config stuff
|
||||||
|
require("keymaps")
|
||||||
|
require("options")
|
||||||
|
require("autocmds")
|
||||||
|
|
||||||
=====================================================================
|
-- Install lazy package manager
|
||||||
==================== READ THIS BEFORE CONTINUING ====================
|
|
||||||
=====================================================================
|
|
||||||
|
|
||||||
Kickstart.nvim is *not* a distribution.
|
|
||||||
|
|
||||||
Kickstart.nvim is a template for your own configuration.
|
|
||||||
The goal is that you can read every line of code, top-to-bottom, and understand
|
|
||||||
what your configuration is doing.
|
|
||||||
|
|
||||||
Once you've done that, you should start exploring, configuring and tinkering to
|
|
||||||
explore Neovim!
|
|
||||||
|
|
||||||
If you don't know anything about Lua, I recommend taking some time to read through
|
|
||||||
a guide. One possible example:
|
|
||||||
- https://learnxinyminutes.com/docs/lua/
|
|
||||||
|
|
||||||
And then you can explore or search through `:help lua-guide`
|
|
||||||
|
|
||||||
|
|
||||||
Kickstart Guide:
|
|
||||||
|
|
||||||
I have left several `:help X` comments throughout the init.lua
|
|
||||||
You should run that command and read that help section for more information.
|
|
||||||
|
|
||||||
In addition, I have some `NOTE:` items throughout the file.
|
|
||||||
These are for you, the reader to help understand what is happening. Feel free to delete
|
|
||||||
them once you know what you're doing, but they should serve as a guide for when you
|
|
||||||
are first encountering a few different constructs in your nvim config.
|
|
||||||
|
|
||||||
I hope you enjoy your Neovim journey,
|
|
||||||
- TJ
|
|
||||||
|
|
||||||
P.S. You can delete this when you're done too. It's your config now :)
|
|
||||||
--]]
|
|
||||||
-- Set <space> as the leader key
|
|
||||||
-- See `:help mapleader`
|
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
|
||||||
vim.g.mapleader = " "
|
|
||||||
vim.g.maplocalleader = " "
|
|
||||||
|
|
||||||
-- Install package manager
|
|
||||||
-- https://github.com/folke/lazy.nvim
|
|
||||||
-- `:help lazy.nvim.txt` for more info
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
|
@ -57,220 +17,8 @@ if not vim.loop.fs_stat(lazypath) then
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
local symbols = require("constant.symbols")
|
|
||||||
local border = "rounded"
|
|
||||||
|
|
||||||
-- Helper function for staging selection
|
|
||||||
local function gitsigns_visual_op(op)
|
|
||||||
return function()
|
|
||||||
return require("gitsigns")[op]({ vim.fn.line("."), vim.fn.line("v") })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- NOTE: Here is where you install your plugins.
|
|
||||||
-- You can configure plugins using the `config` key.
|
|
||||||
--
|
|
||||||
-- You can also configure plugins after the setup call,
|
|
||||||
-- as they will be available in your neovim runtime.
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
|
{ import = "themes" },
|
||||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
|
||||||
-- The configuration is done below. Search for lspconfig to find it below.
|
|
||||||
{
|
|
||||||
-- LSP Configuration & Plugins
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
dependencies = {
|
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
"williamboman/mason-lspconfig.nvim",
|
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
|
||||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
||||||
{ "j-hui/fidget.nvim", opts = {} },
|
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing!
|
|
||||||
"folke/neodev.nvim",
|
|
||||||
|
|
||||||
-- Add document color
|
|
||||||
"mrshmllow/document-color.nvim",
|
|
||||||
|
|
||||||
"b0o/schemastore.nvim",
|
|
||||||
|
|
||||||
-- Rename with immediate visual feedback
|
|
||||||
{
|
|
||||||
"smjonas/inc-rename.nvim",
|
|
||||||
config = function()
|
|
||||||
require("inc_rename").setup({
|
|
||||||
preview_empty_name = true,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"ray-x/lsp_signature.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"neovim/nvim-lspconfig",
|
|
||||||
},
|
|
||||||
opts = {
|
|
||||||
hint_enable = false,
|
|
||||||
handler_opts = {
|
|
||||||
border = border,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Autocompletion
|
|
||||||
"hrsh7th/nvim-cmp",
|
|
||||||
dependencies = {
|
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
"L3MON4D3/LuaSnip",
|
|
||||||
"saadparwaiz1/cmp_luasnip",
|
|
||||||
"hrsh7th/cmp-path",
|
|
||||||
"onsails/lspkind-nvim",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Useful plugin to show you pending keybinds.
|
|
||||||
{
|
|
||||||
"folke/which-key.nvim",
|
|
||||||
opts = {},
|
|
||||||
init = function()
|
|
||||||
require("which-key").register({
|
|
||||||
["<leader>g"] = { name = "[G]it", _ = "which_key_ignore" },
|
|
||||||
["<leader>b"] = { name = "[B]buffer", _ = "which_key_ignore" },
|
|
||||||
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
||||||
"lewis6991/gitsigns.nvim",
|
|
||||||
init = function()
|
|
||||||
vim.keymap.set("n", "<leader>gs", require("gitsigns.actions").stage_hunk, { desc = "[G]it [S]tage hunk" })
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>gS",
|
|
||||||
require("gitsigns.actions").undo_stage_hunk,
|
|
||||||
{ desc = "[G]it undo [S]tage hunk" }
|
|
||||||
)
|
|
||||||
vim.keymap.set(
|
|
||||||
"n",
|
|
||||||
"<leader>gd",
|
|
||||||
require("gitsigns.actions").preview_hunk_inline,
|
|
||||||
{ desc = "[G]it [D]iff hunk" }
|
|
||||||
)
|
|
||||||
vim.keymap.set("n", "<leader>gr", require("gitsigns.actions").reset_hunk, { desc = "[G]it [R]eset hunk" })
|
|
||||||
vim.keymap.set("v", "<leader>gs", gitsigns_visual_op("stage_hunk"), { desc = "[G]it [S]tage selection" })
|
|
||||||
vim.keymap.set("v", "<leader>gr", gitsigns_visual_op("reset_hunk"), { desc = "[G]it [R]eset selection" })
|
|
||||||
vim.keymap.set("n", "]g", function()
|
|
||||||
require("gitsigns.actions").nav_hunk("next")
|
|
||||||
end, { desc = "Go to next hunk" })
|
|
||||||
vim.keymap.set("n", "[g", function()
|
|
||||||
require("gitsigns.actions").nav_hunk("prev")
|
|
||||||
end, { desc = "Go to previous hunk" })
|
|
||||||
end,
|
|
||||||
opts = {
|
|
||||||
-- See `:help gitsigns.txt`
|
|
||||||
signs = {
|
|
||||||
add = { text = "+" },
|
|
||||||
change = { text = "~" },
|
|
||||||
delete = { text = "_" },
|
|
||||||
topdelete = { text = "‾" },
|
|
||||||
changedelete = { text = "~" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Set lualine as statusline
|
|
||||||
"nvim-lualine/lualine.nvim",
|
|
||||||
-- See `:help lualine.txt`
|
|
||||||
opts = {
|
|
||||||
options = {
|
|
||||||
icons_enabled = true,
|
|
||||||
theme = "gruvbox",
|
|
||||||
component_separators = { left = "", right = "" },
|
|
||||||
section_separators = { left = "", right = "" },
|
|
||||||
},
|
|
||||||
sections = {
|
|
||||||
lualine_b = {
|
|
||||||
"branch",
|
|
||||||
"diff",
|
|
||||||
{ "diagnostics", symbols = { error = "", warn = "", info = "", hint = "" } },
|
|
||||||
},
|
|
||||||
lualine_c = {
|
|
||||||
{
|
|
||||||
"filename",
|
|
||||||
path = 1,
|
|
||||||
symbols = {
|
|
||||||
modified = symbols.file.modified,
|
|
||||||
readonly = symbols.file.readonly,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
lualine_x = {
|
|
||||||
"encoding",
|
|
||||||
{ "fileformat", icons_enabled = false },
|
|
||||||
"filetype",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inactive_sections = {
|
|
||||||
lualine_c = {
|
|
||||||
{ "filename", path = 1 },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Add indentation guides even on blank lines
|
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
|
||||||
-- See `:help indent_blankline.txt`
|
|
||||||
main = "ibl",
|
|
||||||
opts = {
|
|
||||||
indent = {
|
|
||||||
char = "¦",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Fuzzy Finder (files, lsp, etc)
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope.nvim",
|
|
||||||
version = "*",
|
|
||||||
dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope-ui-select.nvim" },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
|
|
||||||
-- Only load if `make` is available. Make sure you have the system
|
|
||||||
-- requirements installed.
|
|
||||||
{
|
|
||||||
"nvim-telescope/telescope-fzf-native.nvim",
|
|
||||||
-- NOTE: If you are having trouble with this installation,
|
|
||||||
-- refer to the README for telescope-fzf-native for more instructions.
|
|
||||||
build = "make",
|
|
||||||
cond = function()
|
|
||||||
return vim.fn.executable("make") == 1
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Highlight, edit, and navigate code
|
|
||||||
"nvim-treesitter/nvim-treesitter",
|
|
||||||
dependencies = {
|
|
||||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
pcall(require("nvim-treesitter.install").update({ with_sync = true }))
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
require("themes.gruvbox"),
|
|
||||||
{ import = "plugins" },
|
{ import = "plugins" },
|
||||||
}, {
|
}, {
|
||||||
install = {
|
install = {
|
||||||
|
@ -278,386 +26,8 @@ require("lazy").setup({
|
||||||
"gruvbox",
|
"gruvbox",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
ui = {
|
||||||
|
border = require("symbols.window").border,
|
||||||
require("options")
|
backdrop = 100,
|
||||||
require("keymaps")
|
|
||||||
require("autocmds")
|
|
||||||
|
|
||||||
-- [[ Configure Telescope ]]
|
|
||||||
-- See `:help telescope` and `:help telescope.setup()`
|
|
||||||
require("telescope").setup({
|
|
||||||
pickers = {
|
|
||||||
find_files = {
|
|
||||||
hidden = true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
defaults = {
|
|
||||||
file_ignore_patterns = {
|
|
||||||
".git/",
|
|
||||||
},
|
|
||||||
mappings = {
|
|
||||||
n = {
|
|
||||||
["<c-d>"] = "delete_buffer",
|
|
||||||
["<Tab>"] = "move_selection_next",
|
|
||||||
["<S-Tab>"] = "move_selection_previous",
|
|
||||||
},
|
|
||||||
i = {
|
|
||||||
["<c-d>"] = "delete_buffer",
|
|
||||||
["<Tab>"] = "move_selection_next",
|
|
||||||
["<S-Tab>"] = "move_selection_previous",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
["ui-select"] = {
|
|
||||||
require("telescope.themes").get_dropdown({}),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Enable telescope fzf native, if installed
|
|
||||||
pcall(require("telescope").load_extension, "fzf")
|
|
||||||
pcall(require("telescope").load_extension, "ui-select")
|
|
||||||
|
|
||||||
-- See `:help telescope.builtin`
|
|
||||||
vim.keymap.set("n", "<leader>.", require("telescope.builtin").oldfiles, { desc = "[.] Find recently opened files" })
|
|
||||||
vim.keymap.set("n", "<leader><space>", require("telescope.builtin").buffers, { desc = "[ ] Find existing buffers" })
|
|
||||||
vim.keymap.set("n", "<leader>/", function()
|
|
||||||
require("telescope.builtin").current_buffer_fuzzy_find({
|
|
||||||
-- Show matches in the order they appear in the document
|
|
||||||
sorting_strategy = "ascending",
|
|
||||||
})
|
|
||||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
|
||||||
vim.keymap.set("n", "<leader>s/", function()
|
|
||||||
require("telescope.builtin").live_grep({
|
|
||||||
grep_open_files = true,
|
|
||||||
prompt_title = "Live Grep in Open Files",
|
|
||||||
})
|
|
||||||
end, { desc = "[S]earch [/] in Open Files" })
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" })
|
|
||||||
vim.keymap.set("n", "<leader>sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" })
|
|
||||||
vim.keymap.set("n", "<leader>sw", function()
|
|
||||||
require("telescope.builtin").grep_string({
|
|
||||||
-- Show matches in the order they appear in the document
|
|
||||||
sorting_strategy = "ascending",
|
|
||||||
})
|
|
||||||
end, { desc = "[S]earch current [W]ord" })
|
|
||||||
vim.keymap.set("n", "<leader>sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" })
|
|
||||||
vim.keymap.set("n", "<leader>sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" })
|
|
||||||
vim.keymap.set("n", "<leader>sr", require("telescope.builtin").resume, { desc = "[S]earch [R]esume" })
|
|
||||||
vim.keymap.set("n", "<leader>sk", require("telescope.builtin").keymaps, { desc = "[S]earch [K]eymaps" })
|
|
||||||
vim.keymap.set("n", "<leader>sn", function()
|
|
||||||
require("telescope.builtin").find_files({ cwd = vim.fn.stdpath("config") })
|
|
||||||
end, { desc = "[S]earch [N]eovim files" })
|
|
||||||
|
|
||||||
-- [[ Configure Treesitter ]]
|
|
||||||
-- See `:help nvim-treesitter`
|
|
||||||
require("nvim-treesitter.configs").setup({
|
|
||||||
-- Add languages to be installed here that you want installed for treesitter
|
|
||||||
ensure_installed = {
|
|
||||||
"c",
|
|
||||||
"cpp",
|
|
||||||
"go",
|
|
||||||
"lua",
|
|
||||||
"python",
|
|
||||||
"rust",
|
|
||||||
"tsx",
|
|
||||||
"typescript",
|
|
||||||
"vimdoc",
|
|
||||||
"vim",
|
|
||||||
"markdown",
|
|
||||||
"markdown_inline",
|
|
||||||
"bash",
|
|
||||||
"zig",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
|
||||||
auto_install = true,
|
|
||||||
|
|
||||||
highlight = { enable = true },
|
|
||||||
-- Disabled because it caueses issues with nvim-autopair
|
|
||||||
indent = { enable = false, disable = { "python" } },
|
|
||||||
incremental_selection = {
|
|
||||||
enable = true,
|
|
||||||
keymaps = {
|
|
||||||
init_selection = "<c-space>",
|
|
||||||
node_incremental = "<c-space>",
|
|
||||||
scope_incremental = "<c-s>",
|
|
||||||
node_decremental = "<M-space>",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
textobjects = {
|
|
||||||
select = {
|
|
||||||
enable = true,
|
|
||||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
|
||||||
keymaps = {
|
|
||||||
-- You can use the capture groups defined in textobjects.scm
|
|
||||||
["aa"] = "@parameter.outer",
|
|
||||||
["ia"] = "@parameter.inner",
|
|
||||||
["af"] = "@function.outer",
|
|
||||||
["if"] = "@function.inner",
|
|
||||||
["ac"] = "@class.outer",
|
|
||||||
["ic"] = "@class.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
move = {
|
|
||||||
enable = true,
|
|
||||||
set_jumps = true, -- whether to set jumps in the jumplist
|
|
||||||
goto_next_start = {
|
|
||||||
["]m"] = "@function.outer",
|
|
||||||
["]]"] = "@class.outer",
|
|
||||||
},
|
|
||||||
goto_next_end = {
|
|
||||||
["]M"] = "@function.outer",
|
|
||||||
["]["] = "@class.outer",
|
|
||||||
},
|
|
||||||
goto_previous_start = {
|
|
||||||
["[m"] = "@function.outer",
|
|
||||||
["[["] = "@class.outer",
|
|
||||||
},
|
|
||||||
goto_previous_end = {
|
|
||||||
["[M"] = "@function.outer",
|
|
||||||
["[]"] = "@class.outer",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
swap = {
|
|
||||||
enable = true,
|
|
||||||
swap_next = {
|
|
||||||
["<leader>a"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
swap_previous = {
|
|
||||||
["<leader>A"] = "@parameter.inner",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- LSP settings.
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
|
||||||
|
|
||||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
|
||||||
|
|
||||||
vim.diagnostic.config({
|
|
||||||
float = {
|
|
||||||
border = border,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Set the diagnostic symbols (Also used by Neo-tree)
|
|
||||||
local signs = {
|
|
||||||
Error = symbols.diagnostic.error,
|
|
||||||
Warn = symbols.diagnostic.warning,
|
|
||||||
Hint = symbols.diagnostic.hint,
|
|
||||||
Info = symbols.diagnostic.info,
|
|
||||||
}
|
|
||||||
for type, icon in pairs(signs) do
|
|
||||||
local hl = "DiagnosticSign" .. type
|
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
|
||||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
|
||||||
-- many times.
|
|
||||||
--
|
|
||||||
-- In this case, we create a function that lets us more easily define mappings specific
|
|
||||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
|
||||||
local nmap = function(keys, func, desc)
|
|
||||||
if desc then
|
|
||||||
desc = "LSP: " .. desc
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
|
||||||
end
|
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>rn", function()
|
|
||||||
return ":IncRename " .. vim.fn.expand("<cword>")
|
|
||||||
end, { expr = true, desc = "[R]e[n]ame" })
|
|
||||||
|
|
||||||
-- nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
|
||||||
-- Should allow code actions in visual mode
|
|
||||||
vim.keymap.set(
|
|
||||||
{ "v", "n" },
|
|
||||||
"<leader>ca",
|
|
||||||
vim.lsp.buf.code_action,
|
|
||||||
{ buffer = bufnr, desc = "LSP: [C]ode [A]ction", remap = true }
|
|
||||||
)
|
|
||||||
-- nmap('<leader>ca', require('telescope.builtin')., '[C]ode [A]ction')
|
|
||||||
|
|
||||||
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
|
||||||
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
|
||||||
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
|
||||||
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
|
||||||
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]symbols")
|
|
||||||
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]symbols")
|
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
|
||||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
|
||||||
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
|
||||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
|
||||||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
|
||||||
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
|
|
||||||
nmap("<leader>wl", function()
|
|
||||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
|
||||||
end, "[W]orkspace [L]ist Folders")
|
|
||||||
|
|
||||||
-- -- Create a command `:Format` local to the LSP buffer
|
|
||||||
-- vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
|
||||||
-- vim.lsp.buf.format()
|
|
||||||
-- end, { desc = 'Format current buffer with LSP' })
|
|
||||||
--
|
|
||||||
-- -- Format on save
|
|
||||||
-- local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|
||||||
-- if client.supports_method("textDocument/formatting") then
|
|
||||||
-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
|
||||||
-- vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
-- group = augroup,
|
|
||||||
-- buffer = bufnr,
|
|
||||||
-- callback = function()
|
|
||||||
-- vim.lsp.buf.format()
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- -- Attach document colour support
|
|
||||||
-- if client.server_capabilities.colorProvider then
|
|
||||||
-- require("document-color").buf_attach(bufnr)
|
|
||||||
-- end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Enable the following language servers
|
|
||||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
|
||||||
--
|
|
||||||
-- Add any additional override configuration in the following tables. They will be passed to
|
|
||||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
|
||||||
local servers = {
|
|
||||||
clangd = {},
|
|
||||||
gopls = {},
|
|
||||||
pyright = {},
|
|
||||||
rust_analyzer = {
|
|
||||||
["rust-analyzer"] = {
|
|
||||||
check = {
|
|
||||||
command = "clippy",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tsserver = {},
|
|
||||||
tailwindcss = {},
|
|
||||||
-- cssls = {},
|
|
||||||
|
|
||||||
lua_ls = {
|
|
||||||
Lua = {
|
|
||||||
workspace = { checkThirdParty = false },
|
|
||||||
telemetry = { enable = false },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
jsonls = {
|
|
||||||
json = {
|
|
||||||
schemas = require("schemastore").json.schemas(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
yamlls = {
|
|
||||||
yaml = {
|
|
||||||
schemas = require("schemastore").yaml.schemas(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
taplo = {},
|
|
||||||
cmake = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Setup neovim lua configuration
|
|
||||||
require("neodev").setup()
|
|
||||||
|
|
||||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
|
||||||
capabilities.textDocument.colorProvider = {
|
|
||||||
dynamicRegistration = true,
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Setup mason so it can manage external tooling
|
|
||||||
require("mason").setup()
|
|
||||||
|
|
||||||
-- Ensure the servers above are installed
|
|
||||||
local mason_lspconfig = require("mason-lspconfig")
|
|
||||||
|
|
||||||
mason_lspconfig.setup({
|
|
||||||
ensure_installed = vim.tbl_keys(servers),
|
|
||||||
})
|
|
||||||
|
|
||||||
mason_lspconfig.setup_handlers({
|
|
||||||
function(server_name)
|
|
||||||
require("lspconfig")[server_name].setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
settings = servers[server_name],
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- nvim-cmp setup
|
|
||||||
local cmp = require("cmp")
|
|
||||||
local luasnip = require("luasnip")
|
|
||||||
local lspkind = require("lspkind")
|
|
||||||
|
|
||||||
luasnip.config.setup({})
|
|
||||||
|
|
||||||
cmp.setup({
|
|
||||||
snippet = {
|
|
||||||
expand = function(args)
|
|
||||||
luasnip.lsp_expand(args.body)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
-- Include the source of the cmp entry
|
|
||||||
formatting = {
|
|
||||||
format = lspkind.cmp_format({
|
|
||||||
mode = "text",
|
|
||||||
menu = {
|
|
||||||
nvim_lsp = "[LSP]",
|
|
||||||
luasnip = "[LuaSnip]",
|
|
||||||
path = "[Path]",
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
mapping = cmp.mapping.preset.insert({
|
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
|
||||||
["<C-d>"] = 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 = "luasnip" },
|
|
||||||
{ name = "nvim_lsp" },
|
|
||||||
{ name = "path" },
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "9d5ba06d6ee7418c674f498634617416d15b6239" },
|
"conform.nvim": { "branch": "master", "commit": "820eec990d5f332d30cf939954c8672a43a0459e" },
|
||||||
"document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" },
|
"document-color.nvim": { "branch": "main", "commit": "74c487f0e5accfaae033755451b9e367220693fd" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
|
"fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "c097cb255096f333e14d341082a84f572b394fa2" },
|
"gitsigns.nvim": { "branch": "main", "commit": "d96ef3bbff0bdbc3916a220f5c74a04c4db033f2" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "487598d979868224aff92cf8818195c1a60e5dfe" },
|
"gruvbox.nvim": { "branch": "main", "commit": "487598d979868224aff92cf8818195c1a60e5dfe" },
|
||||||
"guess-indent.nvim": { "branch": "main", "commit": "b8ae749fce17aa4c267eec80a6984130b94f80b2" },
|
"guess-indent.nvim": { "branch": "main", "commit": "b8ae749fce17aa4c267eec80a6984130b94f80b2" },
|
||||||
"inc-rename.nvim": { "branch": "main", "commit": "5e03e986625961d1fac296d1bf332a6510c3add6" },
|
"inc-rename.nvim": { "branch": "main", "commit": "5e03e986625961d1fac296d1bf332a6510c3add6" },
|
||||||
|
@ -17,8 +17,8 @@
|
||||||
"lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
|
"lsp_signature.nvim": { "branch": "master", "commit": "c6aeb2f1d2538bbdfdaab1664d9d4c3c75aa9db8" },
|
||||||
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||||
"mason-conform.nvim": { "branch": "main", "commit": "c41b19222db71b016e55c64454b5e03441f56859" },
|
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
|
||||||
|
"mason-tool-installer.nvim": { "branch": "main", "commit": "b129892f783740e6cf741f2ea09fa5dd512aa584" },
|
||||||
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
|
||||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "b529fb2ae9206ca1d84ee72b596deecbc088ac59" },
|
"neo-tree.nvim": { "branch": "v2.x", "commit": "b529fb2ae9206ca1d84ee72b596deecbc088ac59" },
|
||||||
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
|
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
|
||||||
|
@ -27,23 +27,21 @@
|
||||||
"nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" },
|
"nvim-bufdel": { "branch": "main", "commit": "523d58e94e7212fff3e05c247b962dc8f93bcfde" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
|
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
|
||||||
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "b3014f2209503944f2714cf27c95591433a0c7d8" },
|
"nvim-lspconfig": { "branch": "master", "commit": "9266dc26862d8f3556c2ca77602e811472b4c5b8" },
|
||||||
"nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
|
"nvim-surround": { "branch": "main", "commit": "a4e30d33add8a9743b4f518b3a788b3c8e5def71" },
|
||||||
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "b0ac1135fe304edd34e18204304906744db0fe63" },
|
"nvim-treesitter": { "branch": "master", "commit": "2a95ff14764af20d32ec1edb27e11c38a84b9478" },
|
||||||
"nvim-treesitter-context": { "branch": "master", "commit": "f19766163c18515fb4d3c12d572bf9cba6cdb990" },
|
"nvim-treesitter-context": { "branch": "master", "commit": "ba05c6b753130d96b284d3e8ba8f54c28c0fb6d1" },
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "67ac27f859ee3f7584f3edef81d0942bb61d5344" },
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
|
||||||
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
"nvim-ts-autotag": { "branch": "main", "commit": "531f48334c422222aebc888fd36e7d109cb354cd" },
|
||||||
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
|
"peek.nvim": { "branch": "master", "commit": "5820d937d5414baea5f586dc2a3d912a74636e5b" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
|
||||||
"schemastore.nvim": { "branch": "main", "commit": "c5d5abc86910fb31b9f734cae2547322e81d3a26" },
|
"schemastore.nvim": { "branch": "main", "commit": "8b9002aae3c284e20020966c8b33242251b079e7" },
|
||||||
"symbols-outline.nvim": { "branch": "master", "commit": "564ee65dfc9024bdde73a6621820866987cbb256" },
|
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
|
||||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
|
"telescope.nvim": { "branch": "master", "commit": "4d4ade7f2b8f403e8816ca50c05ed16e259b21fb" },
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "a736bbe08c8eff370dfa60701f1e669816d4e3c8" },
|
"todo-comments.nvim": { "branch": "main", "commit": "a736bbe08c8eff370dfa60701f1e669816d4e3c8" },
|
||||||
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
|
"trouble.nvim": { "branch": "main", "commit": "b9cf677f20bb2faa2dacfa870b084e568dca9572" },
|
||||||
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
|
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
|
||||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
|
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||||
"whitespace.nvim": { "branch": "master", "commit": "34d319e07f86a628deeb237133088f01f8432bc0" }
|
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
-- Highlight on yank
|
-- Highlight on yank
|
||||||
local highlight_group = vim.api.nvim_create_augroup('YankHighlight', { clear = true })
|
local highlight_group = vim.api.nvim_create_augroup("YankHighlight", { clear = true })
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank({ higroup = 'YankHighlight' })
|
vim.highlight.on_yank({ higroup = "YankHighlight" })
|
||||||
end,
|
end,
|
||||||
group = highlight_group,
|
group = highlight_group,
|
||||||
pattern = '*',
|
pattern = "*",
|
||||||
})
|
})
|
||||||
|
|
||||||
-- show cursor line only in active window
|
-- show cursor line only in active window
|
||||||
local cursor_group = vim.api.nvim_create_augroup('ActiveCursor', { clear = true })
|
local cursor_group = vim.api.nvim_create_augroup("ActiveCursor", { clear = true })
|
||||||
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
|
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
|
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
|
||||||
|
@ -19,7 +19,7 @@ vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
group = cursor_group,
|
group = cursor_group,
|
||||||
pattern = '*',
|
pattern = "*",
|
||||||
})
|
})
|
||||||
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
|
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
|
||||||
callback = function()
|
callback = function()
|
||||||
|
@ -30,5 +30,5 @@ vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
group = cursor_group,
|
group = cursor_group,
|
||||||
pattern = '*',
|
pattern = "*",
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
-- Symbols to use for diagnostics
|
|
||||||
return {
|
|
||||||
-- LSP Status symbols
|
|
||||||
error = "",
|
|
||||||
warning = "",
|
|
||||||
info = "",
|
|
||||||
hint = "",
|
|
||||||
-- Comment type symbols
|
|
||||||
bug = "",
|
|
||||||
todo = "",
|
|
||||||
hack = "",
|
|
||||||
performance = "",
|
|
||||||
note = "",
|
|
||||||
test = "",
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
return {
|
|
||||||
diagnostic = require("constant.symbols.diagnostic"),
|
|
||||||
fold = require("constant.symbols.fold"),
|
|
||||||
file = require("constant.symbols.file"),
|
|
||||||
git = require("constant.symbols.git"),
|
|
||||||
}
|
|
|
@ -1,9 +1,11 @@
|
||||||
-- See `:help vim.keymap.set()`
|
vim.g.mapleader = " "
|
||||||
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { noremap = true, silent = true })
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
vim.keymap.set({ "n", "v" }, "<Space>", "<Nop>", { noremap = true, silent = true })
|
||||||
|
|
||||||
-- Remap for dealing with word wrap
|
-- Remap for dealing with word wrap
|
||||||
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
|
||||||
vim.keymap.set('n', 'j', "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
|
||||||
|
|
||||||
-- Keybinds for resizing windows
|
-- Keybinds for resizing windows
|
||||||
vim.keymap.set("n", "<S-Up>", "<cmd>resize +2<CR>")
|
vim.keymap.set("n", "<S-Up>", "<cmd>resize +2<CR>")
|
||||||
|
@ -12,14 +14,15 @@ vim.keymap.set("n", "<S-Left>", "<cmd>vertical resize -2<CR>")
|
||||||
vim.keymap.set("n", "<S-Right>", "<cmd>vertical resize +2<CR>")
|
vim.keymap.set("n", "<S-Right>", "<cmd>vertical resize +2<CR>")
|
||||||
|
|
||||||
-- Diagnostic keymaps
|
-- Diagnostic keymaps
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||||
-- Disabled in favor of using Trouble (<F3>)
|
|
||||||
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
|
||||||
|
|
||||||
-- Some nice adjustments
|
-- Some nice adjustments
|
||||||
vim.keymap.set('n', '<C-d>', '<C-d>zz')
|
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||||
vim.keymap.set('n', '<C-u>', '<C-u>zz')
|
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||||
vim.keymap.set('n', 'n', 'nzz')
|
vim.keymap.set("n", "n", "nzz")
|
||||||
vim.keymap.set('n', 'N', 'Nzz')
|
vim.keymap.set("n", "N", "Nzz")
|
||||||
|
|
||||||
|
-- Clear search highlight by pressing esc
|
||||||
|
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
-- Set highlight on search, clear by pressing esc
|
-- Set highlight on search
|
||||||
vim.o.hlsearch = true
|
vim.o.hlsearch = true
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.wo.number = true
|
vim.wo.number = true
|
||||||
vim.wo.relativenumber = true
|
vim.wo.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode
|
-- Enable mouse mode
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = "a"
|
||||||
|
|
||||||
-- Sync clipboard between OS and Neovim.
|
-- Sync clipboard between OS and Neovim.
|
||||||
-- Remove this option if you want your OS clipboard to remain independent.
|
-- Remove this option if you want your OS clipboard to remain independent.
|
||||||
-- See `:help 'clipboard'`
|
-- See `:help 'clipboard'`
|
||||||
vim.o.clipboard = 'unnamedplus'
|
vim.o.clipboard = "unnamedplus"
|
||||||
|
|
||||||
-- Enable break indent
|
-- Enable break indent
|
||||||
vim.o.breakindent = true
|
vim.o.breakindent = true
|
||||||
|
@ -25,7 +24,7 @@ vim.o.ignorecase = true
|
||||||
vim.o.smartcase = true
|
vim.o.smartcase = true
|
||||||
|
|
||||||
-- Keep signcolumn on by default
|
-- Keep signcolumn on by default
|
||||||
vim.wo.signcolumn = 'yes'
|
vim.wo.signcolumn = "yes"
|
||||||
|
|
||||||
-- Decrease update time
|
-- Decrease update time
|
||||||
vim.o.updatetime = 250
|
vim.o.updatetime = 250
|
||||||
|
@ -33,7 +32,7 @@ vim.o.timeout = true
|
||||||
vim.o.timeoutlen = 300
|
vim.o.timeoutlen = 300
|
||||||
|
|
||||||
-- Set completeopt to have a better completion experience
|
-- Set completeopt to have a better completion experience
|
||||||
vim.o.completeopt = 'menuone,noselect'
|
vim.o.completeopt = "menuone,noselect"
|
||||||
|
|
||||||
-- NOTE: You should make sure your terminal supports this
|
-- NOTE: You should make sure your terminal supports this
|
||||||
vim.o.termguicolors = true
|
vim.o.termguicolors = true
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- https://github.com/windwp/nvim-autopairs
|
-- https://github.com/windwp/nvim-autopairs
|
||||||
return {
|
return {
|
||||||
'windwp/nvim-autopairs',
|
"windwp/nvim-autopairs",
|
||||||
event = "VeryLazy",
|
event = "InsertEnter",
|
||||||
opts = {},
|
config = true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
-- https://github.com/windwp/nvim-ts-autotag
|
|
||||||
return {
|
|
||||||
'windwp/nvim-ts-autotag',
|
|
||||||
event = "VeryLazy",
|
|
||||||
opts = {},
|
|
||||||
}
|
|
|
@ -1,35 +1,36 @@
|
||||||
-- https://github.com/akinsho/bufferline.nvim
|
-- https://github.com/akinsho/bufferline.nvim
|
||||||
|
local diagnostic = require("symbols.diagnostic")
|
||||||
|
local file = require("symbols.file")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'akinsho/bufferline.nvim',
|
"akinsho/bufferline.nvim",
|
||||||
version = "v3.*",
|
version = "v3.*",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'ojroques/nvim-bufdel',
|
"ojroques/nvim-bufdel",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- Enable mousemoveevent if possible
|
-- Enable mousemoveevent if possible
|
||||||
vim.o.mousemoveevent = true;
|
vim.o.mousemoveevent = true
|
||||||
|
|
||||||
local bufferline = require('bufferline');
|
local bufferline = require("bufferline")
|
||||||
|
|
||||||
-- Setup keybinds to move between buffers
|
-- Setup keybinds to move between buffers
|
||||||
vim.keymap.set('n', '<tab>', function()
|
vim.keymap.set("n", "<tab>", function()
|
||||||
bufferline.cycle(1)
|
bufferline.cycle(1)
|
||||||
end, { silent = true, desc = 'Goto next buffer' })
|
end, { silent = true, desc = "Goto next buffer" })
|
||||||
vim.keymap.set('n', '<S-tab>', function()
|
vim.keymap.set("n", "<S-tab>", function()
|
||||||
bufferline.cycle(-1)
|
bufferline.cycle(-1)
|
||||||
end, { silent = true, desc = 'Goto previous buffer' })
|
end, { silent = true, desc = "Goto previous buffer" })
|
||||||
|
|
||||||
-- Setup keybinds to move buffers around
|
-- Setup keybinds to move buffers around
|
||||||
vim.keymap.set('n', '<leader>b[', function()
|
vim.keymap.set("n", "<leader>b[", function()
|
||||||
bufferline.move(-1)
|
bufferline.move(-1)
|
||||||
end, { silent = true, desc = '[B]uffer to the [ left' })
|
end, { silent = true, desc = "[B]uffer to the [ left" })
|
||||||
vim.keymap.set('n', '<leader>b]', function()
|
vim.keymap.set("n", "<leader>b]", function()
|
||||||
bufferline.move(1)
|
bufferline.move(1)
|
||||||
end, { silent = true, desc = '[B]uffer to the ] right' })
|
end, { silent = true, desc = "[B]uffer to the ] right" })
|
||||||
|
|
||||||
local symbols = require('constant.symbols');
|
bufferline.setup({
|
||||||
|
|
||||||
bufferline.setup {
|
|
||||||
options = {
|
options = {
|
||||||
show_buffer_icons = false,
|
show_buffer_icons = false,
|
||||||
show_buffer_close_icons = true,
|
show_buffer_close_icons = true,
|
||||||
|
@ -37,25 +38,25 @@ return {
|
||||||
close_command = "BufDel %d",
|
close_command = "BufDel %d",
|
||||||
right_mouse_command = "BufDel %d",
|
right_mouse_command = "BufDel %d",
|
||||||
separator_style = "thick",
|
separator_style = "thick",
|
||||||
left_trunc_marker = '',
|
left_trunc_marker = "",
|
||||||
right_trunc_marker = '',
|
right_trunc_marker = "",
|
||||||
sort_by = "insert_at_end",
|
sort_by = "insert_at_end",
|
||||||
indicator = {
|
indicator = {
|
||||||
style = 'none',
|
style = "none",
|
||||||
},
|
},
|
||||||
modified_icon = symbols.file.modified,
|
modified_icon = file.modified,
|
||||||
---@diagnostic disable-next-line: unused-local
|
---@diagnostic disable-next-line: unused-local
|
||||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||||
local s = " "
|
local s = " "
|
||||||
for e, n in pairs(diagnostics_dict) do
|
for e, n in pairs(diagnostics_dict) do
|
||||||
local sym = e == "error" and symbols.diagnostic.error .. ' '
|
local sym = e == "error" and diagnostic.error .. " "
|
||||||
or (e == "warning" and symbols.diagnostic.warning .. ' ')
|
or (e == "warning" and diagnostic.warn .. " ")
|
||||||
or (e == "info" and symbols.diagnostic.info .. ' ' or symbols.diagnostic.hint .. ' ')
|
or (e == "info" and diagnostic.info .. " " or diagnostic.hint .. " ")
|
||||||
s = s .. n .. sym
|
s = s .. n .. sym
|
||||||
end
|
end
|
||||||
return s
|
return s
|
||||||
end
|
end,
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
77
nvim/dot-config/nvim/lua/plugins/cmp.lua
Normal file
77
nvim/dot-config/nvim/lua/plugins/cmp.lua
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
-- https://github.com/hrsh7th/nvim-cmp
|
||||||
|
-- TODO: Go over this
|
||||||
|
return {
|
||||||
|
-- Autocompletion
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"onsails/lspkind-nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
local lspkind = require("lspkind")
|
||||||
|
|
||||||
|
luasnip.config.setup({})
|
||||||
|
|
||||||
|
local border = require("symbols.window").border
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered({ border = border, winhighlight = "CursorLine:YankHighlight" }),
|
||||||
|
documentation = cmp.config.window.bordered({ border = border }),
|
||||||
|
},
|
||||||
|
-- Include the source of the cmp entry
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
mode = "text",
|
||||||
|
menu = {
|
||||||
|
nvim_lsp = "LSP",
|
||||||
|
luasnip = "LuaSnip",
|
||||||
|
path = "Path",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-d>"] = 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 = "luasnip" },
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "path" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
-- https://github.com/stevearc/conform.nvim
|
-- https://github.com/stevearc/conform.nvim
|
||||||
|
|
||||||
local slow_format_filetypes = {}
|
local slow_format_filetypes = {}
|
||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
},
|
||||||
event = { "BufWritePre" },
|
event = { "BufWritePre" },
|
||||||
cmd = { "ConformInfo" },
|
cmd = { "ConformInfo" },
|
||||||
keys = {
|
keys = {
|
||||||
|
@ -16,26 +20,7 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
-- TODO: Automate installing these using e.g. mason
|
formatters_by_ft = require("tools").formatters,
|
||||||
formatters_by_ft = {
|
|
||||||
c = { "clang-format" },
|
|
||||||
cpp = { "clang-format" },
|
|
||||||
go = { "goimports", "gofmt" },
|
|
||||||
python = { "ruff_format" },
|
|
||||||
rust = { "rustfmt" },
|
|
||||||
javascript = { { "prettierd", "prettier" } },
|
|
||||||
typescript = { { "prettierd", "prettier" } },
|
|
||||||
typescriptreact = { { "prettierd", "prettier" } },
|
|
||||||
css = { { "prettierd", "prettier" } },
|
|
||||||
markdown = { { "prettierd", "prettier" } },
|
|
||||||
lua = { "stylua" },
|
|
||||||
json = { "jq" },
|
|
||||||
yaml = { { "prettierd", "prettier" } },
|
|
||||||
toml = { "taplo" },
|
|
||||||
cmake = { "cmake_format" },
|
|
||||||
-- ["*"] = { "codespell" },
|
|
||||||
["_"] = { "trim_whitespace", "trim_newlines" },
|
|
||||||
},
|
|
||||||
format_on_save = function(bufnr)
|
format_on_save = function(bufnr)
|
||||||
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
|
||||||
return
|
return
|
||||||
|
@ -59,7 +44,7 @@ return {
|
||||||
end
|
end
|
||||||
return { lsp_fallback = true }
|
return { lsp_fallback = true }
|
||||||
end,
|
end,
|
||||||
notify_on_error = true,
|
-- log_level = vim.log.levels.DEBUG,
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
vim.api.nvim_create_user_command("FormatDisable", function(args)
|
vim.api.nvim_create_user_command("FormatDisable", function(args)
|
||||||
|
|
12
nvim/dot-config/nvim/lua/plugins/fidget.lua
Normal file
12
nvim/dot-config/nvim/lua/plugins/fidget.lua
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
"j-hui/fidget.nvim",
|
||||||
|
opts = {
|
||||||
|
notification = {
|
||||||
|
window = {
|
||||||
|
border = require("symbols.window").border,
|
||||||
|
y_padding = 1,
|
||||||
|
x_padding = 2,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
45
nvim/dot-config/nvim/lua/plugins/gitsigns.lua
Normal file
45
nvim/dot-config/nvim/lua/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
return {
|
||||||
|
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
opts = {
|
||||||
|
signs = {
|
||||||
|
add = { text = "+" },
|
||||||
|
change = { text = "~" },
|
||||||
|
delete = { text = "_" },
|
||||||
|
topdelete = { text = "‾" },
|
||||||
|
changedelete = { text = "~" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
vim.keymap.set("n", "<leader>gs", require("gitsigns.actions").stage_hunk, { desc = "[G]it [S]tage hunk" })
|
||||||
|
vim.keymap.set("v", "<leader>gs", function()
|
||||||
|
require("gitsigns.actions").stage_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
|
end, { desc = "[G]it [S]tage selection" })
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader>gS",
|
||||||
|
require("gitsigns.actions").undo_stage_hunk,
|
||||||
|
{ desc = "[G]it undo [S]tage hunk" }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader>gd",
|
||||||
|
require("gitsigns.actions").preview_hunk_inline,
|
||||||
|
{ desc = "[G]it [D]iff hunk" }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>gr", require("gitsigns.actions").reset_hunk, { desc = "[G]it [R]eset hunk" })
|
||||||
|
vim.keymap.set("v", "<leader>gr", function()
|
||||||
|
require("gitsigns.actions").reset_hunk({ vim.fn.line("."), vim.fn.line("v") })
|
||||||
|
end, { desc = "[G]it [R]eset selection" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "]g", function()
|
||||||
|
require("gitsigns.actions").nav_hunk("next")
|
||||||
|
end, { desc = "Go to next hunk" })
|
||||||
|
vim.keymap.set("n", "[g", function()
|
||||||
|
require("gitsigns.actions").nav_hunk("prev")
|
||||||
|
end, { desc = "Go to previous hunk" })
|
||||||
|
end,
|
||||||
|
}
|
7
nvim/dot-config/nvim/lua/plugins/inc-rename.lua
Normal file
7
nvim/dot-config/nvim/lua/plugins/inc-rename.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
-- https://github.com/smjonas/inc-rename.nvim
|
||||||
|
return {
|
||||||
|
"smjonas/inc-rename.nvim",
|
||||||
|
opts = {
|
||||||
|
preview_empty_name = true,
|
||||||
|
},
|
||||||
|
}
|
14
nvim/dot-config/nvim/lua/plugins/indent-blankline.lua
Normal file
14
nvim/dot-config/nvim/lua/plugins/indent-blankline.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
-- https://github.com/lukas-reineke/indent-blankline.nvim
|
||||||
|
return {
|
||||||
|
-- Add indentation guides even on blank lines
|
||||||
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
|
-- See `:help indent_blankline.txt`
|
||||||
|
main = "ibl",
|
||||||
|
opts = {
|
||||||
|
indent = {
|
||||||
|
char = "¦",
|
||||||
|
},
|
||||||
|
scope = { enabled = true },
|
||||||
|
},
|
||||||
|
}
|
104
nvim/dot-config/nvim/lua/plugins/lsp.lua
Normal file
104
nvim/dot-config/nvim/lua/plugins/lsp.lua
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
return {
|
||||||
|
-- LSP Configuration & Plugins
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
|
|
||||||
|
-- Some of the lsp keybindings rely on telescope
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
-- Set capabilities from cmp
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
|
||||||
|
-- Additional lua configuration, makes nvim stuff amazing!
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
|
|
||||||
|
-- Add document color
|
||||||
|
"mrshmllow/document-color.nvim",
|
||||||
|
|
||||||
|
"b0o/schemastore.nvim",
|
||||||
|
|
||||||
|
-- Rename with immediate visual feedback
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local border = require("symbols.window").border
|
||||||
|
|
||||||
|
-- Set borders
|
||||||
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = border })
|
||||||
|
vim.lsp.handlers["textDocument/signatureHelp"] =
|
||||||
|
vim.lsp.with(vim.lsp.handlers.signature_help, { border = border })
|
||||||
|
|
||||||
|
require("lspconfig.ui.windows").default_options = {
|
||||||
|
border = border,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Create the signs for diagnostic symbols
|
||||||
|
local diagnostic = require("symbols.diagnostic")
|
||||||
|
local signs = {
|
||||||
|
Error = diagnostic.error,
|
||||||
|
Warn = diagnostic.warning,
|
||||||
|
Hint = diagnostic.hint,
|
||||||
|
Info = diagnostic.info,
|
||||||
|
}
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
|
group = vim.api.nvim_create_augroup("dx-lsp-attach", { clear = true }),
|
||||||
|
callback = function(event)
|
||||||
|
local map = function(keys, func, desc)
|
||||||
|
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP:" .. desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
map("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
||||||
|
map("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||||
|
map("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||||
|
map("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
||||||
|
map("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]symbols")
|
||||||
|
map("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]symbols")
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>rn", function()
|
||||||
|
return ":IncRename " .. vim.fn.expand("<cword>")
|
||||||
|
end, { buffer = event.buf, expr = true, desc = "LSP: [R]e[N]ame" })
|
||||||
|
|
||||||
|
-- Also works in visual mode
|
||||||
|
-- TODO: Is that something we even need?
|
||||||
|
vim.keymap.set(
|
||||||
|
{ "v", "n" },
|
||||||
|
"<leader>ca",
|
||||||
|
vim.lsp.buf.code_action,
|
||||||
|
{ buffer = event.buf, desc = "LSP: [C]ode [A]ction", remap = true }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Signature help
|
||||||
|
map("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||||
|
map("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
||||||
|
|
||||||
|
-- Lesser used LSP functionality
|
||||||
|
map("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
-- TODO: Only do this is cmp_nvim_lsp is enabled
|
||||||
|
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||||
|
-- TODO: Check if this is still up to date
|
||||||
|
capabilities.textDocument.colorProvider = {
|
||||||
|
dynamicRegistration = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
handlers = {
|
||||||
|
function(server_name)
|
||||||
|
local server = require("tools").servers[server_name] or {}
|
||||||
|
server.capabilities = vim.tbl_deep_extend("force", capabilities, server.capabilities or {})
|
||||||
|
|
||||||
|
require("lspconfig")[server_name].setup(server)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
14
nvim/dot-config/nvim/lua/plugins/lsp_signature.lua
Normal file
14
nvim/dot-config/nvim/lua/plugins/lsp_signature.lua
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
-- https://github.com/ray-x/lsp_signature.nvim
|
||||||
|
return {
|
||||||
|
"ray-x/lsp_signature.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
dependencies = {
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
hint_enable = false,
|
||||||
|
handler_opts = {
|
||||||
|
border = require("symbols.window").border,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
39
nvim/dot-config/nvim/lua/plugins/lualine.lua
Normal file
39
nvim/dot-config/nvim/lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
-- https://github.com/nvim-lualine/lualine.nvim
|
||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = "gruvbox",
|
||||||
|
component_separators = { left = "", right = "" },
|
||||||
|
section_separators = { left = "", right = "" },
|
||||||
|
},
|
||||||
|
sections = {
|
||||||
|
lualine_b = {
|
||||||
|
"branch",
|
||||||
|
"diff",
|
||||||
|
{
|
||||||
|
"diagnostics",
|
||||||
|
symbols = require("symbols.diagnostic"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_c = {
|
||||||
|
{
|
||||||
|
"filename",
|
||||||
|
path = 1,
|
||||||
|
symbols = require("symbols.file"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lualine_x = {
|
||||||
|
"encoding",
|
||||||
|
{ "fileformat", icons_enabled = false },
|
||||||
|
"filetype",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inactive_sections = {
|
||||||
|
lualine_c = {
|
||||||
|
{ "filename", path = 1 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
-- https://github.com/zapling/mason-conform.nvim
|
|
||||||
return {
|
|
||||||
"zapling/mason-conform.nvim",
|
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
},
|
|
||||||
opts = {},
|
|
||||||
}
|
|
28
nvim/dot-config/nvim/lua/plugins/mason.lua
Normal file
28
nvim/dot-config/nvim/lua/plugins/mason.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
opts = {
|
||||||
|
ui = {
|
||||||
|
border = require("symbols.window").border,
|
||||||
|
height = 0.8,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local tools = require("tools")
|
||||||
|
local ensure_installed = vim.tbl_keys(tools.servers)
|
||||||
|
ensure_installed =
|
||||||
|
vim.list_extend(ensure_installed, require("util.mason").process_formatters(tools.formatters))
|
||||||
|
ensure_installed = vim.list_extend(ensure_installed, tools.extra)
|
||||||
|
|
||||||
|
require("mason-tool-installer").setup({
|
||||||
|
ensure_installed = ensure_installed,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,20 +1,22 @@
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
local fold = require("symbols.fold")
|
||||||
|
local file = require("symbols.file")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'nvim-neo-tree/neo-tree.nvim',
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
version = "v2.x",
|
version = "v2.x",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
"nvim-lua/plenary.nvim",
|
||||||
'MunifTanjim/nui.nvim',
|
"MunifTanjim/nui.nvim",
|
||||||
},
|
},
|
||||||
cmd = { 'Neotree' },
|
cmd = { "Neotree" },
|
||||||
keys = {
|
keys = {
|
||||||
{ '<F2>', '<cmd>Neotree toggle reveal filesystem float<cr>', desc = 'Open floating Neo-tree window' },
|
{ "<F2>", "<cmd>Neotree toggle reveal filesystem float<cr>", desc = "Open floating Neo-tree window" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local symbols = require('constant.symbols');
|
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||||
|
|
||||||
require('neo-tree').setup {
|
require("neo-tree").setup({
|
||||||
close_if_last_window = true,
|
close_if_last_window = true,
|
||||||
enable_diagnostics = true,
|
enable_diagnostics = true,
|
||||||
source_selector = {
|
source_selector = {
|
||||||
|
@ -22,27 +24,27 @@ return {
|
||||||
},
|
},
|
||||||
default_component_configs = {
|
default_component_configs = {
|
||||||
icon = {
|
icon = {
|
||||||
folder_closed = symbols.fold.closed,
|
folder_closed = fold.closed,
|
||||||
folder_open = symbols.fold.open,
|
folder_open = fold.open,
|
||||||
folder_empty = symbols.fold.empty,
|
folder_empty = fold.empty,
|
||||||
default = symbols.file.icon,
|
default = file.icon,
|
||||||
},
|
},
|
||||||
modified = {
|
modified = {
|
||||||
symbol = symbols.file.modified,
|
symbol = file.modified,
|
||||||
},
|
},
|
||||||
name = {
|
name = {
|
||||||
use_git_status_colors = false,
|
use_git_status_colors = false,
|
||||||
},
|
},
|
||||||
git_status = {
|
git_status = {
|
||||||
symbols = symbols.git,
|
symbols = require("symbols.git"),
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
filesystem = {
|
filesystem = {
|
||||||
filtered_items = {
|
filtered_items = {
|
||||||
hide_dotfiles = false,
|
hide_dotfiles = false,
|
||||||
hide_by_name = {
|
hide_by_name = {
|
||||||
".git"
|
".git",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
use_libuv_file_watcher = true,
|
use_libuv_file_watcher = true,
|
||||||
},
|
},
|
||||||
|
@ -60,6 +62,6 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
return {
|
|
||||||
enabled = false,
|
|
||||||
'jose-elias-alvarez/null-ls.nvim',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-lua/plenary.nvim',
|
|
||||||
},
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = function()
|
|
||||||
local null_ls = require('null-ls')
|
|
||||||
|
|
||||||
null_ls.setup {
|
|
||||||
sources = {
|
|
||||||
null_ls.builtins.code_actions.gitsigns,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
}
|
|
|
@ -1,34 +1,30 @@
|
||||||
-- https://github.com/toppair/peek.nvim
|
-- https://github.com/toppair/peek.nvim
|
||||||
return {
|
return {
|
||||||
'toppair/peek.nvim',
|
"toppair/peek.nvim",
|
||||||
build = 'deno task --quiet build:fast',
|
build = "deno task --quiet build:fast",
|
||||||
cond = function()
|
cond = function()
|
||||||
return vim.fn.executable 'deno' == 1
|
return vim.fn.executable("deno") == 1
|
||||||
end,
|
end,
|
||||||
lazy = true,
|
lazy = true,
|
||||||
cmds = { "PeekOpen", "PeekClose" },
|
cmds = { "PeekOpen", "PeekClose" },
|
||||||
init = function()
|
init = function()
|
||||||
vim.api.nvim_create_user_command('PeekOpen', function() require('peek').open() end, {})
|
vim.api.nvim_create_user_command("PeekOpen", function()
|
||||||
vim.api.nvim_create_user_command('PeekClose', function() require('peek').close() end, {})
|
require("peek").open()
|
||||||
|
end, {})
|
||||||
|
vim.api.nvim_create_user_command("PeekClose", function()
|
||||||
|
require("peek").close()
|
||||||
|
end, {})
|
||||||
|
|
||||||
local augroup = vim.api.nvim_create_augroup('Peek', { clear = true })
|
-- local augroup = vim.api.nvim_create_augroup('Peek', { clear = true })
|
||||||
|
--
|
||||||
-- Automatically open a markdown preview window
|
-- -- Automatically open a markdown preview window
|
||||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
-- vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||||
callback = function()
|
-- callback = function()
|
||||||
require('peek').open()
|
-- require('peek').open()
|
||||||
end,
|
-- end,
|
||||||
group = augroup,
|
-- group = augroup,
|
||||||
pattern = "markdown",
|
-- pattern = "markdown",
|
||||||
})
|
-- })
|
||||||
end,
|
end,
|
||||||
opts = {},
|
opts = {},
|
||||||
-- config = function()
|
|
||||||
-- local peek = require('peek');
|
|
||||||
--
|
|
||||||
--
|
|
||||||
-- peek.setup {
|
|
||||||
--
|
|
||||||
-- }
|
|
||||||
-- end
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
-- https://github.com/kylechui/nvim-surround
|
-- https://github.com/kylechui/nvim-surround
|
||||||
return {
|
return {
|
||||||
'kylechui/nvim-surround',
|
"kylechui/nvim-surround",
|
||||||
version = '*', -- Use for stability; omit to use `main` branch for the latest features
|
event = "VeryLazy",
|
||||||
event = 'VeryLazy',
|
|
||||||
config = true,
|
config = true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
-- https://github.com/simrat39/symbols-outline.nvim
|
-- https://github.com/simrat39/symbols-outline.nvim
|
||||||
return {
|
return {
|
||||||
'simrat39/symbols-outline.nvim',
|
enabled = false,
|
||||||
|
"simrat39/symbols-outline.nvim",
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<F5>',
|
"<F5>",
|
||||||
function()
|
function()
|
||||||
require('symbols-outline').toggle_outline()
|
require("symbols-outline").toggle_outline()
|
||||||
end,
|
end,
|
||||||
desc = 'Toggle symbols outline'
|
desc = "Toggle symbols outline",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
opts = {},
|
opts = {},
|
||||||
|
|
92
nvim/dot-config/nvim/lua/plugins/telescope.lua
Normal file
92
nvim/dot-config/nvim/lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
-- https://github.com/nvim-telescope/telescope.nvim
|
||||||
|
-- TODO: Ensure installed ripgrep
|
||||||
|
return {
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope-ui-select.nvim",
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope-fzf-native.nvim",
|
||||||
|
build = "make",
|
||||||
|
cond = function()
|
||||||
|
return vim.fn.executable("make") == 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("telescope").setup({
|
||||||
|
|
||||||
|
pickers = {
|
||||||
|
find_files = {
|
||||||
|
hidden = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaults = {
|
||||||
|
file_ignore_patterns = {
|
||||||
|
".git/",
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
n = {
|
||||||
|
["<S-Tab>"] = "move_selection_next",
|
||||||
|
["<Tab>"] = "move_selection_previous",
|
||||||
|
},
|
||||||
|
i = {
|
||||||
|
["<S-Tab>"] = "move_selection_next",
|
||||||
|
["<Tab>"] = "move_selection_previous",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
borderchars = require("symbols.window").borderchars,
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
["ui-select"] = {
|
||||||
|
require("telescope.themes").get_dropdown(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
require("telescope").load_extension("fzf")
|
||||||
|
require("telescope").load_extension("ui-select")
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader>.",
|
||||||
|
require("telescope.builtin").oldfiles,
|
||||||
|
{ desc = "[.] Find recently opened files" }
|
||||||
|
)
|
||||||
|
vim.keymap.set(
|
||||||
|
"n",
|
||||||
|
"<leader><space>",
|
||||||
|
require("telescope.builtin").buffers,
|
||||||
|
{ desc = "[ ] Find existing buffers" }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>/", function()
|
||||||
|
require("telescope.builtin").current_buffer_fuzzy_find({
|
||||||
|
-- Show matches in the order they appear in the document
|
||||||
|
sorting_strategy = "ascending",
|
||||||
|
})
|
||||||
|
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||||
|
vim.keymap.set("n", "<leader>s/", function()
|
||||||
|
require("telescope.builtin").live_grep({
|
||||||
|
grep_open_files = true,
|
||||||
|
prompt_title = "Live Grep in Open Files",
|
||||||
|
})
|
||||||
|
end, { desc = "[S]earch [/] in Open Files" })
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" })
|
||||||
|
vim.keymap.set("n", "<leader>sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" })
|
||||||
|
vim.keymap.set("n", "<leader>sw", function()
|
||||||
|
require("telescope.builtin").grep_string({
|
||||||
|
-- Show matches in the order they appear in the document
|
||||||
|
sorting_strategy = "ascending",
|
||||||
|
})
|
||||||
|
end, { desc = "[S]earch current [W]ord" })
|
||||||
|
vim.keymap.set("n", "<leader>sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" })
|
||||||
|
vim.keymap.set("n", "<leader>sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||||
|
vim.keymap.set("n", "<leader>sr", require("telescope.builtin").resume, { desc = "[S]earch [R]esume" })
|
||||||
|
vim.keymap.set("n", "<leader>sk", require("telescope.builtin").keymaps, { desc = "[S]earch [K]eymaps" })
|
||||||
|
vim.keymap.set("n", "<leader>sn", function()
|
||||||
|
require("telescope.builtin").find_files({ cwd = vim.fn.stdpath("config") })
|
||||||
|
end, { desc = "[S]earch [N]eovim files" })
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,14 +1,14 @@
|
||||||
-- https://github.com/folke/todo-comments.nvim
|
-- https://github.com/folke/todo-comments.nvim
|
||||||
|
local diagnostic = require("symbols.diagnostic")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- NOTE: Using a fork for the time being upstream does not support authors
|
-- NOTE: Using a fork for the time being upstream does not support authors
|
||||||
-- 'folke/todo-comments.nvim',
|
-- 'folke/todo-comments.nvim',
|
||||||
'doongjohn/todo-comments.nvim',
|
"doongjohn/todo-comments.nvim",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
"nvim-lua/plenary.nvim",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local symbols = require('constant.symbols')
|
|
||||||
|
|
||||||
vim.keymap.set("n", "]t", function()
|
vim.keymap.set("n", "]t", function()
|
||||||
require("todo-comments").jump_next()
|
require("todo-comments").jump_next()
|
||||||
end, { desc = "Next todo comment" })
|
end, { desc = "Next todo comment" })
|
||||||
|
@ -23,18 +23,18 @@ return {
|
||||||
vim.keymap.set("n", "<F4>", "<cmd>TroubleToggle todo<cr>", { desc = "Next todo comment" })
|
vim.keymap.set("n", "<F4>", "<cmd>TroubleToggle todo<cr>", { desc = "Next todo comment" })
|
||||||
end
|
end
|
||||||
if pcall(require, "telescope") then
|
if pcall(require, "telescope") then
|
||||||
vim.keymap.set('n', '<leader>st', '<cmd>TodoTelescope<cr>', { desc = '[S]earch [T]odo' })
|
vim.keymap.set("n", "<leader>st", "<cmd>TodoTelescope<cr>", { desc = "[S]earch [T]odo" })
|
||||||
end
|
end
|
||||||
|
|
||||||
require('todo-comments').setup {
|
require("todo-comments").setup({
|
||||||
keywords = {
|
keywords = {
|
||||||
FIX = { icon = symbols.diagnostic.bug },
|
FIX = { icon = diagnostic.bug },
|
||||||
TODO = { icon = symbols.diagnostic.todo },
|
TODO = { icon = diagnostic.todo },
|
||||||
HACK = { icon = symbols.diagnostic.hack },
|
HACK = { icon = diagnostic.hack },
|
||||||
WARN = { icon = symbols.diagnostic.warning },
|
WARN = { icon = diagnostic.warning },
|
||||||
PERF = { icon = symbols.diagnostic.performance },
|
PERF = { icon = diagnostic.performance },
|
||||||
NOTE = { icon = symbols.diagnostic.note },
|
NOTE = { icon = diagnostic.note },
|
||||||
TEST = { icon = symbols.diagnostic.test },
|
TEST = { icon = diagnostic.test },
|
||||||
},
|
},
|
||||||
highlight = {
|
highlight = {
|
||||||
-- TODO: Have multiline, but end when %p (punctuation) is at the end of a line
|
-- TODO: Have multiline, but end when %p (punctuation) is at the end of a line
|
||||||
|
@ -43,7 +43,7 @@ return {
|
||||||
pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:]],
|
pattern = [[(KEYWORDS)\s*(\([^\)]*\))?:]],
|
||||||
},
|
},
|
||||||
search = {
|
search = {
|
||||||
pattern = [[\b(KEYWORDS)(\(.*\))?:]]
|
pattern = [[\b(KEYWORDS)(\(.*\))?:]],
|
||||||
},
|
},
|
||||||
colors = {
|
colors = {
|
||||||
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
error = { "DiagnosticError", "ErrorMsg", "#DC2626" },
|
||||||
|
@ -51,8 +51,8 @@ return {
|
||||||
info = { "Todo", "#2563EB" },
|
info = { "Todo", "#2563EB" },
|
||||||
hint = { "DiagnosticHint", "#10B981" },
|
hint = { "DiagnosticHint", "#10B981" },
|
||||||
default = { "Identifier", "#7C3AED" },
|
default = { "Identifier", "#7C3AED" },
|
||||||
test = { "Identifier", "#FF00FF" }
|
test = { "Identifier", "#FF00FF" },
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
104
nvim/dot-config/nvim/lua/plugins/treesitter.lua
Normal file
104
nvim/dot-config/nvim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
|
"windwp/nvim-ts-autotag",
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
-- Add languages to be installed here that you want installed for treesitter
|
||||||
|
ensure_installed = {
|
||||||
|
"c",
|
||||||
|
"cpp",
|
||||||
|
"go",
|
||||||
|
"lua",
|
||||||
|
"python",
|
||||||
|
"rust",
|
||||||
|
"tsx",
|
||||||
|
"typescript",
|
||||||
|
"vimdoc",
|
||||||
|
"vim",
|
||||||
|
"markdown",
|
||||||
|
"markdown_inline",
|
||||||
|
"bash",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||||
|
auto_install = true,
|
||||||
|
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<c-space>",
|
||||||
|
node_incremental = "<c-space>",
|
||||||
|
scope_incremental = "<c-s>",
|
||||||
|
node_decremental = "<M-space>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
lookahead = true,
|
||||||
|
keymaps = {
|
||||||
|
["aa"] = "@parameter.outer",
|
||||||
|
["ia"] = "@parameter.inner",
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
-- ["ac"] = "@class.outer",
|
||||||
|
-- ["ic"] = "@class.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
move = {
|
||||||
|
enable = true,
|
||||||
|
set_jumps = true,
|
||||||
|
goto_next_start = {
|
||||||
|
["]a"] = "@parameter.inner",
|
||||||
|
["]f"] = "@function.outer",
|
||||||
|
["]c"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_next_end = {
|
||||||
|
["]A"] = "@parameter.inner",
|
||||||
|
["]F"] = "@function.outer",
|
||||||
|
["]c"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_previous_start = {
|
||||||
|
["[a"] = "@parameter.inner",
|
||||||
|
["[f"] = "@function.outer",
|
||||||
|
["[c"] = "@class.outer",
|
||||||
|
},
|
||||||
|
goto_previous_end = {
|
||||||
|
["[A"] = "@parameter.inner",
|
||||||
|
["[F"] = "@function.outer",
|
||||||
|
["[c"] = "@class.outer",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
swap = {
|
||||||
|
enable = true,
|
||||||
|
swap_next = {
|
||||||
|
["<leader>a"] = "@parameter.inner",
|
||||||
|
},
|
||||||
|
swap_previous = {
|
||||||
|
["<leader>A"] = "@parameter.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autotag = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
|
require("nvim-treesitter.install").update({ with_sync = true })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
|
opts = {
|
||||||
|
separator = require("symbols.window").borderchars[3],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
-- https://github.com/Wansmer/treesj
|
|
||||||
return {
|
|
||||||
enabled = false,
|
|
||||||
'Wansmer/treesj',
|
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
'<space>m',
|
|
||||||
function()
|
|
||||||
require('treesj').toggle()
|
|
||||||
end,
|
|
||||||
desc = "Split or Join code block"
|
|
||||||
},
|
|
||||||
},
|
|
||||||
dependencies = { 'nvim-treesitter/nvim-treesitter' },
|
|
||||||
opts = {
|
|
||||||
use_default_keymaps = false,
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,18 +1,19 @@
|
||||||
-- https://github.com/folke/trouble.nvim
|
-- https://github.com/folke/trouble.nvim
|
||||||
|
local fold = require("symbols.fold")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'folke/trouble.nvim',
|
"folke/trouble.nvim",
|
||||||
cmd = { 'Trouble', 'TroubleToggle', },
|
cmd = { "Trouble", "TroubleToggle" },
|
||||||
keys = {
|
keys = {
|
||||||
{ '<F3>', '<cmd>TroubleToggle workspace_diagnostics<cr>', desc = 'Goto previous buffer' },
|
{ "<F3>", "<cmd>TroubleToggle workspace_diagnostics<cr>", desc = "Goto previous buffer" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local symbols = require('constant.symbols');
|
require("trouble").setup({
|
||||||
require('trouble').setup {
|
|
||||||
icons = false,
|
icons = false,
|
||||||
auto_close = true,
|
auto_close = true,
|
||||||
fold_open = symbols.fold.open, -- icon used for open folds
|
fold_open = fold.open, -- icon used for open folds
|
||||||
fold_closed = symbols.fold.close, -- icon used for closed folds
|
fold_closed = fold.close, -- icon used for closed folds
|
||||||
use_diagnostic_signs = true,
|
use_diagnostic_signs = true,
|
||||||
}
|
})
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
23
nvim/dot-config/nvim/lua/plugins/which-key.lua
Normal file
23
nvim/dot-config/nvim/lua/plugins/which-key.lua
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
-- https://github.com/folke/which-key.nvim
|
||||||
|
return {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
opts = {
|
||||||
|
window = {
|
||||||
|
border = "single",
|
||||||
|
margin = { 1, 5, 2, 3 },
|
||||||
|
padding = { 0, 0, 0, 0 },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- TODO: Can we tie these to where the keymaps are registered?
|
||||||
|
require("which-key").register({
|
||||||
|
["<leader>g"] = { name = "[G]it", _ = "which_key_ignore" },
|
||||||
|
["<leader>b"] = { name = "[B]buffer", _ = "which_key_ignore" },
|
||||||
|
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
|
||||||
|
["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" },
|
||||||
|
["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" },
|
||||||
|
["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" },
|
||||||
|
["<leader>r"] = { name = "[R]e[N]ame", _ = "which_key_ignore" },
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
|
@ -1,18 +1,19 @@
|
||||||
return {
|
return {
|
||||||
'johnfrankmorgan/whitespace.nvim',
|
enabled = false,
|
||||||
|
"johnfrankmorgan/whitespace.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require('whitespace-nvim').setup({
|
require("whitespace-nvim").setup({
|
||||||
-- configuration options and their defaults
|
-- configuration options and their defaults
|
||||||
|
|
||||||
-- `highlight` configures which highlight is used to display
|
-- `highlight` configures which highlight is used to display
|
||||||
-- trailing whitespace
|
-- trailing whitespace
|
||||||
highlight = 'CursorLine',
|
highlight = "CursorLine",
|
||||||
-- `ignored_filetypes` configures which filetypes to ignore when
|
-- `ignored_filetypes` configures which filetypes to ignore when
|
||||||
-- displaying trailing whitespace
|
-- displaying trailing whitespace
|
||||||
ignored_filetypes = { 'TelescopePrompt', 'Trouble', 'help' },
|
ignored_filetypes = { "TelescopePrompt", "Trouble", "help" },
|
||||||
})
|
})
|
||||||
|
|
||||||
-- remove trailing whitespace with a keybinding
|
-- remove trailing whitespace with a keybinding
|
||||||
vim.keymap.set('n', '<Leader>t', require('whitespace-nvim').trim, { desc = "Remove trailing whitespace" })
|
vim.keymap.set("n", "<Leader>t", require("whitespace-nvim").trim, { desc = "Remove trailing whitespace" })
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
|
|
15
nvim/dot-config/nvim/lua/symbols/diagnostic.lua
Normal file
15
nvim/dot-config/nvim/lua/symbols/diagnostic.lua
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
-- Symbols to use for diagnostics
|
||||||
|
return {
|
||||||
|
-- LSP Status symbols
|
||||||
|
error = "",
|
||||||
|
warn = "",
|
||||||
|
info = "",
|
||||||
|
hint = "",
|
||||||
|
-- Comment type symbols
|
||||||
|
bug = "",
|
||||||
|
todo = "",
|
||||||
|
hack = "",
|
||||||
|
performance = "",
|
||||||
|
note = "",
|
||||||
|
test = "",
|
||||||
|
}
|
13
nvim/dot-config/nvim/lua/symbols/window.lua
Normal file
13
nvim/dot-config/nvim/lua/symbols/window.lua
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
return {
|
||||||
|
border = "single",
|
||||||
|
borderchars = {
|
||||||
|
"─",
|
||||||
|
"│",
|
||||||
|
"─",
|
||||||
|
"│",
|
||||||
|
"┌",
|
||||||
|
"┐",
|
||||||
|
"┘",
|
||||||
|
"└",
|
||||||
|
},
|
||||||
|
}
|
|
@ -28,9 +28,14 @@ return {
|
||||||
TelescopeMatching = { fg = colors.aqua, bold = true },
|
TelescopeMatching = { fg = colors.aqua, bold = true },
|
||||||
TelescopeSelection = { fg = colors.blue },
|
TelescopeSelection = { fg = colors.blue },
|
||||||
TelescopeSelectionCaret = { fg = colors.red },
|
TelescopeSelectionCaret = { fg = colors.red },
|
||||||
|
CmpItemAbbrMatch = { fg = colors.aqua, bold = true },
|
||||||
|
CmpItemAbbrMatchFuzzy = { fg = colors.aqua, bold = true },
|
||||||
|
CmpItemMenu = { fg = colors.bg2 },
|
||||||
|
CmpItemKindFunction = { fg = colors.red },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Load the colorscheme
|
||||||
vim.cmd.colorscheme("gruvbox")
|
vim.cmd.colorscheme("gruvbox")
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
68
nvim/dot-config/nvim/lua/tools.lua
Normal file
68
nvim/dot-config/nvim/lua/tools.lua
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
local tools = {}
|
||||||
|
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
|
||||||
|
tools.servers = {
|
||||||
|
clangd = {},
|
||||||
|
gopls = {},
|
||||||
|
pyright = {},
|
||||||
|
rust_analyzer = {
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
check = {
|
||||||
|
command = "clippy",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
lua_ls = {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
workspace = { checkThirdParty = false },
|
||||||
|
telemetry = { enable = false },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
jsonls = {
|
||||||
|
settings = {
|
||||||
|
json = {
|
||||||
|
validate = { enable = true },
|
||||||
|
-- schemas = require("schemastore").json.schemas(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
yamlls = {
|
||||||
|
settings = {
|
||||||
|
yaml = {
|
||||||
|
schemaStore = {
|
||||||
|
enable = false,
|
||||||
|
url = "",
|
||||||
|
},
|
||||||
|
-- schemas = require("schemastore").yaml.schemas(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
taplo = {},
|
||||||
|
neocmake = {},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- https://github.com/stevearc/conform.nvim
|
||||||
|
tools.formatters = require("util.conform").assign_formatters({
|
||||||
|
{ { "c", "cpp" }, { "clang-format" } },
|
||||||
|
go = { "goimports", "gofmt" },
|
||||||
|
python = { "ruff_format" },
|
||||||
|
rust = { "rustfmt" },
|
||||||
|
{
|
||||||
|
{ "javascript", "typescript", "typescriptreact", "javascriptreact", "css", "markdown", "yaml" },
|
||||||
|
{ "prettierd" },
|
||||||
|
},
|
||||||
|
lua = { "stylua" },
|
||||||
|
json = { "jq" },
|
||||||
|
toml = { "taplo" },
|
||||||
|
-- ["*"] = { "codespell" },
|
||||||
|
["_"] = { "trim_whitespace", "trim_newlines" },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- https://mason-registry.dev/registry/list
|
||||||
|
tools.extra = {}
|
||||||
|
|
||||||
|
return tools
|
18
nvim/dot-config/nvim/lua/util/conform.lua
Normal file
18
nvim/dot-config/nvim/lua/util/conform.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
-- Helper function for assigning formatters to multiple languages at the same time
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.assign_formatters(input)
|
||||||
|
local table = {}
|
||||||
|
for k, v in pairs(input) do
|
||||||
|
if type(k) == "number" then
|
||||||
|
for _, lang in pairs(v[1]) do
|
||||||
|
table[lang] = v[2]
|
||||||
|
end
|
||||||
|
else
|
||||||
|
table[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return table
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
162
nvim/dot-config/nvim/lua/util/mason.lua
Normal file
162
nvim/dot-config/nvim/lua/util/mason.lua
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
-- Based on: https://github.com/zapling/mason-conform.nvim
|
||||||
|
-- conform formatter to mason package mapping
|
||||||
|
-- https://mason-registry.dev/registry/list
|
||||||
|
local conform_to_mason = {
|
||||||
|
-- alejandra
|
||||||
|
["asmfmt"] = "asmfmt",
|
||||||
|
["ast-grep"] = "ast-grep",
|
||||||
|
-- astyle
|
||||||
|
-- auto_optional
|
||||||
|
-- autocorrect
|
||||||
|
["autoflake"] = "autoflake",
|
||||||
|
["autopep8"] = "autopep8",
|
||||||
|
-- awk
|
||||||
|
-- bean-format
|
||||||
|
["beautysh"] = "beautysh",
|
||||||
|
["bibtex-tidy"] = "bibtex-tidy",
|
||||||
|
-- biome-check
|
||||||
|
["biome"] = "biome",
|
||||||
|
["black"] = "black",
|
||||||
|
["blade-formatter"] = "blade-formatter",
|
||||||
|
["blue"] = "blue",
|
||||||
|
["buf"] = "buf",
|
||||||
|
["buildifier"] = "buildifier",
|
||||||
|
["cbfmt"] = "cbfmt",
|
||||||
|
["clang-format"] = "clang-format",
|
||||||
|
-- cljstyle
|
||||||
|
["cmake_format"] = "cmakelang",
|
||||||
|
["codespell"] = "codespell",
|
||||||
|
["csharpier"] = "csharpier",
|
||||||
|
-- cue_fmt
|
||||||
|
["darker"] = "darker",
|
||||||
|
-- dart_format
|
||||||
|
["deno_fmt"] = "deno",
|
||||||
|
-- dfmt
|
||||||
|
["djlint"] = "djlint",
|
||||||
|
["dprint"] = "dprint",
|
||||||
|
["easy-coding-standard"] = "easy-coding-standard",
|
||||||
|
["elm_format"] = "elm-format",
|
||||||
|
-- erb_format
|
||||||
|
["eslint_d"] = "eslint_d",
|
||||||
|
["fantomas"] = "fantomas",
|
||||||
|
-- fish_indent
|
||||||
|
["fixjson"] = "fixjson",
|
||||||
|
-- fnlfmt
|
||||||
|
["fourmolu"] = "fourmolu",
|
||||||
|
["gci"] = "gci",
|
||||||
|
["gdformat"] = "gdtoolkit",
|
||||||
|
["gersemi"] = "gersemi",
|
||||||
|
-- gn
|
||||||
|
-- gofmt
|
||||||
|
["gofumpt"] = "gofumpt",
|
||||||
|
["goimports-reviser"] = "goimports-reviser",
|
||||||
|
["goimports"] = "goimports",
|
||||||
|
["golines"] = "golines",
|
||||||
|
["google-java-format"] = "google-java-format",
|
||||||
|
["htmlbeautifier"] = "htmlbeautifier",
|
||||||
|
-- indent
|
||||||
|
-- init
|
||||||
|
-- injected
|
||||||
|
["isort"] = "isort",
|
||||||
|
["joker"] = "joker",
|
||||||
|
["jq"] = "jq",
|
||||||
|
["jsonnetfmt"] = "jsonnetfmt",
|
||||||
|
-- just
|
||||||
|
["ktlint"] = "ktlint",
|
||||||
|
["latexindent"] = "latexindent",
|
||||||
|
["markdown-toc"] = "markdown-toc",
|
||||||
|
["markdownlint-cli2"] = "markdownlint-cli2",
|
||||||
|
["markdownlint"] = "markdownlint",
|
||||||
|
["mdformat"] = "mdformat",
|
||||||
|
["mdslw"] = "mdslw",
|
||||||
|
-- mix
|
||||||
|
-- nixfmt
|
||||||
|
["nixpkgs_fmt"] = "nixpkgs-fmt",
|
||||||
|
["ocamlformat"] = "ocamlformat",
|
||||||
|
-- opa_fmt
|
||||||
|
-- packer_fmt
|
||||||
|
-- pangu
|
||||||
|
-- perlimports
|
||||||
|
-- perltidy
|
||||||
|
-- pg_format
|
||||||
|
["php_cs_fixer"] = "php-cs-fixer",
|
||||||
|
["phpcbf"] = "phpcbf",
|
||||||
|
-- phpinsights
|
||||||
|
["pint"] = "pint",
|
||||||
|
["prettier"] = "prettier",
|
||||||
|
["prettierd"] = "prettierd",
|
||||||
|
["pretty-php"] = "pretty-php",
|
||||||
|
-- puppet-lint
|
||||||
|
["reorder-python-imports"] = "reorder-python-imports",
|
||||||
|
-- rescript-format
|
||||||
|
["rubocop"] = "rubocop",
|
||||||
|
["rubyfmt"] = "rubyfmt",
|
||||||
|
-- ruff
|
||||||
|
["ruff_fix"] = "ruff",
|
||||||
|
["ruff_format"] = "ruff",
|
||||||
|
["rufo"] = "rufo",
|
||||||
|
-- NOTE: Should install through rustup instead
|
||||||
|
-- ["rustfmt"] = "rustfmt",
|
||||||
|
["rustywind"] = "rustywind",
|
||||||
|
-- scalafmt
|
||||||
|
["shellcheck"] = "shellcheck",
|
||||||
|
["shellharden"] = "shellharden",
|
||||||
|
["shfmt"] = "shfmt",
|
||||||
|
["sql_formatter"] = "sql-formatter",
|
||||||
|
["sqlfluff"] = "sqlfluff",
|
||||||
|
["sqlfmt"] = "sqlfmt",
|
||||||
|
-- squeeze_blanks
|
||||||
|
["standardjs"] = "standardjs",
|
||||||
|
["standardrb"] = "standardrb",
|
||||||
|
["stylelint"] = "stylelint",
|
||||||
|
-- styler
|
||||||
|
["stylua"] = "stylua",
|
||||||
|
-- swift_format
|
||||||
|
-- swiftformat
|
||||||
|
["taplo"] = "taplo",
|
||||||
|
["templ"] = "templ",
|
||||||
|
-- terraform_fmt
|
||||||
|
-- terragrunt_hclfmt
|
||||||
|
["tlint"] = "tlint",
|
||||||
|
-- trim_newlines
|
||||||
|
-- trim_whitespace
|
||||||
|
-- twig-cs-fixer
|
||||||
|
["typos"] = "typos",
|
||||||
|
-- typstfmt
|
||||||
|
-- uncrustify
|
||||||
|
["usort"] = "usort",
|
||||||
|
["xmlformat"] = "xmlformatter",
|
||||||
|
-- xmllint
|
||||||
|
["yamlfix"] = "yamlfix",
|
||||||
|
["yamlfmt"] = "yamlfmt",
|
||||||
|
["yapf"] = "yapf",
|
||||||
|
["yq"] = "yq",
|
||||||
|
-- zigfmt
|
||||||
|
["zprint"] = "zprint",
|
||||||
|
}
|
||||||
|
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
function M.process_formatters(formatters_by_ft)
|
||||||
|
local formatters_to_install = {}
|
||||||
|
for _, formatters in pairs(formatters_by_ft) do
|
||||||
|
for _, formatter in pairs(formatters) do
|
||||||
|
if type(formatter) == "table" then
|
||||||
|
for _, f in pairs(formatter) do
|
||||||
|
local package = conform_to_mason[f]
|
||||||
|
if package ~= nil then
|
||||||
|
formatters_to_install[package] = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local package = conform_to_mason[formatter]
|
||||||
|
if package ~= nil then
|
||||||
|
formatters_to_install[package] = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return vim.tbl_keys(formatters_to_install)
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
Loading…
Reference in New Issue
Block a user