Initial Commit
This commit is contained in:
commit
f407f526b2
|
|
@ -0,0 +1,8 @@
|
||||||
|
-- Handle plugins with lazy.nvim
|
||||||
|
require("core.lazy")
|
||||||
|
|
||||||
|
-- General Neovim keymaps
|
||||||
|
require("core.keymaps")
|
||||||
|
|
||||||
|
-- Other options
|
||||||
|
require("core.options")
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||||
|
"LuaSnip": { "branch": "master", "commit": "ea7d7ea510c641c4f15042becd27f35b3e5b3c2b" },
|
||||||
|
"bg.nvim": { "branch": "main", "commit": "e7318e901f4bb9272814cf2af1eb6435bfa2e905" },
|
||||||
|
"bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" },
|
||||||
|
"catppuccin": { "branch": "main", "commit": "85e93601e0f0b48aa2c6bbfae4d0e9d7a1898280" },
|
||||||
|
"close-buffers.nvim": { "branch": "master", "commit": "3acbcad1211572342632a6c0151f839e7dead27f" },
|
||||||
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
|
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||||
|
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
|
||||||
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||||
|
"everforest": { "branch": "master", "commit": "83b666410d7ae0eccf96dbbe3b4b6ac5b8172d38" },
|
||||||
|
"fidget.nvim": { "branch": "main", "commit": "89b633f3bd0b7187f070236b348697de176860e2" },
|
||||||
|
"friendly-snippets": { "branch": "main", "commit": "ebf6d6e83494cdd88a54a429340256f4dbb6a052" },
|
||||||
|
"git-conflict.nvim": { "branch": "main", "commit": "2957f747e1a34f1854e4e0efbfbfa59a1db04af5" },
|
||||||
|
"gitsigns.nvim": { "branch": "main", "commit": "907ae8636016aab2f283576fc60d46ca3427e579" },
|
||||||
|
"gruvbox.nvim": { "branch": "main", "commit": "7fb36e0f67aa6f3d7f3e54f37ca7032ea1af0b59" },
|
||||||
|
"lazy.nvim": { "branch": "main", "commit": "2a9354c7d2368d78cbd5575a51a2af5bd8a6ad01" },
|
||||||
|
"lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" },
|
||||||
|
"mason-lspconfig.nvim": { "branch": "main", "commit": "f014db32437aa61c86fc0ef1067cd2bc6a37205c" },
|
||||||
|
"mason.nvim": { "branch": "main", "commit": "d66c60e17dd6fd8165194b1d14d21f7eb2c1697a" },
|
||||||
|
"melange-nvim": { "branch": "master", "commit": "517518347e41301bb2d1189d257f3918551a2ea5" },
|
||||||
|
"mini.move": { "branch": "main", "commit": "3afd39873eb9171684e554a214c055482444a47d" },
|
||||||
|
"neo-tree.nvim": { "branch": "v2.x", "commit": "80dc74d081823649809f78370fa5b204aa9a853a" },
|
||||||
|
"neodev.nvim": { "branch": "main", "commit": "471324e6c746284dbbdc1d357799d1911bb7e120" },
|
||||||
|
"nui.nvim": { "branch": "main", "commit": "c8de23342caf8d50b15d6b28368d36a56a69d76f" },
|
||||||
|
"null-ls.nvim": { "branch": "main", "commit": "0010ea927ab7c09ef0ce9bf28c2b573fc302f5a7" },
|
||||||
|
"nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" },
|
||||||
|
"nvim-lspconfig": { "branch": "master", "commit": "cc388d3f6b9c7c943ae2b2dcd46ad470fd257f91" },
|
||||||
|
"nvim-treesitter": { "branch": "master", "commit": "bf8b089eecef9e9e8c1765f81613a2fd5e49175c" },
|
||||||
|
"nvim-treesitter-textobjects": { "branch": "master", "commit": "bd103502252027434ec42f628d2dbf54821d4ce6" },
|
||||||
|
"nvim-ts-rainbow": { "branch": "master", "commit": "8312b513ce930e7669a1721befbe56f2e1853301" },
|
||||||
|
"nvim-web-devicons": { "branch": "master", "commit": "973ab742f143a796a779af4d786ec409116a0d87" },
|
||||||
|
"plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" },
|
||||||
|
"rose-pine": { "branch": "main", "commit": "e29002cbee4854a9c8c4b148d8a52fae3176070f" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" },
|
||||||
|
"telescope.nvim": { "branch": "0.1.x", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" },
|
||||||
|
"toggleterm.nvim": { "branch": "main", "commit": "b90a1381e9b5b8596f49070ee86c71db267ac868" },
|
||||||
|
"vim-fugitive": { "branch": "master", "commit": "6fcb0ad03982de646e3fecb6915e585651b9a9fb" },
|
||||||
|
"vim-illuminate": { "branch": "master", "commit": "8c910b2f84ae6acd9b4b17330bb94dd783c0c11a" },
|
||||||
|
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||||
|
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||||
|
"which-key.nvim": { "branch": "main", "commit": "7ccf476ebe0445a741b64e36c78a682c1c6118b7" }
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
{
|
||||||
|
"workspace.library": [
|
||||||
|
"/home/robot/.local/share/nvim/lazy/neodev.nvim/types/stable",
|
||||||
|
"/squashfs-root/usr/share/nvim/runtime/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/close-buffers.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/which-key.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/melange-nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/nvim-treesitter-textobjects/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/telescope.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/null-ls.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/telescope-fzf-native.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/nvim-web-devicons/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/nvim-cmp/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/lualine.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/cmp-nvim-lsp/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/cmp-nvim-lua/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/nvim-lspconfig/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/catppuccin/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/cmp-buffer/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/mason.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/gitsigns.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/mini.move/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/cmp-path/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/lazy.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/git-conflict.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/nvim-treesitter/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/everforest/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/LuaSnip/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/rose-pine/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/nui.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/gruvbox.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/plenary.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/cmp_luasnip/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/bufferline.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/neodev.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/mason-lspconfig.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/Comment.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/fidget.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/neo-tree.nvim/lua",
|
||||||
|
"/home/robot/.local/share/nvim/lazy/vim-illuminate/lua",
|
||||||
|
"/home/robot/.config/nvim/lua",
|
||||||
|
"${3rd}/luv/library"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,71 @@
|
||||||
|
local map = require("helpers.keys").map
|
||||||
|
|
||||||
|
-- Quick access to some common actions
|
||||||
|
map("n", "<leader>fw", "<cmd>w<cr>", "Write")
|
||||||
|
map("n", "<leader>fa", "<cmd>wa<cr>", "Write all")
|
||||||
|
map("n", "<leader>qq", "<cmd>q<cr>", "Quit")
|
||||||
|
map("n", "<leader>qa", "<cmd>qa!<cr>", "Quit all")
|
||||||
|
map("n", "<leader>dw", "<cmd>close<cr>", "Window")
|
||||||
|
|
||||||
|
-- Diagnostic keymaps
|
||||||
|
map('n', 'gx', vim.diagnostic.open_float, "Show diagnostics under cursor")
|
||||||
|
|
||||||
|
-- Easier access to beginning and end of lines
|
||||||
|
map("n", "<M-h>", "^", "Go to beginning of line")
|
||||||
|
map("n", "<M-l>", "$", "Go to end of line")
|
||||||
|
|
||||||
|
-- Better window navigation
|
||||||
|
map("n", "<C-h>", "<C-w><C-h>", "Navigate windows to the left")
|
||||||
|
map("n", "<C-j>", "<C-w><C-j>", "Navigate windows down")
|
||||||
|
map("n", "<C-k>", "<C-w><C-k>", "Navigate windows up")
|
||||||
|
map("n", "<C-l>", "<C-w><C-l>", "Navigate windows to the right")
|
||||||
|
|
||||||
|
-- Move with shift-arrows
|
||||||
|
map("n", "<S-Left>", "<C-w><S-h>", "Move window to the left")
|
||||||
|
map("n", "<S-Down>", "<C-w><S-j>", "Move window down")
|
||||||
|
map("n", "<S-Up>", "<C-w><S-k>", "Move window up")
|
||||||
|
map("n", "<S-Right>", "<C-w><S-l>", "Move window to the right")
|
||||||
|
|
||||||
|
-- Resize with arrows
|
||||||
|
map("n", "<C-Up>", ":resize +2<CR>")
|
||||||
|
map("n", "<C-Down>", ":resize -2<CR>")
|
||||||
|
map("n", "<C-Left>", ":vertical resize +2<CR>")
|
||||||
|
map("n", "<C-Right>", ":vertical resize -2<CR>")
|
||||||
|
|
||||||
|
-- Deleting buffers
|
||||||
|
local buffers = require("helpers.buffers")
|
||||||
|
map("n", "<leader>db", buffers.delete_this, "Current buffer")
|
||||||
|
map("n", "<leader>do", buffers.delete_others, "Other buffers")
|
||||||
|
map("n", "<leader>da", buffers.delete_all, "All buffers")
|
||||||
|
|
||||||
|
-- Navigate buffers
|
||||||
|
map("n", "<S-l>", ":bnext<CR>")
|
||||||
|
map("n", "<S-h>", ":bprevious<CR>")
|
||||||
|
|
||||||
|
-- Stay in indent mode
|
||||||
|
map("v", "<", "<gv")
|
||||||
|
map("v", ">", ">gv")
|
||||||
|
|
||||||
|
-- Switch between light and dark modes
|
||||||
|
map("n", "<leader>ut", function()
|
||||||
|
if vim.o.background == "dark" then
|
||||||
|
vim.o.background = "light"
|
||||||
|
else
|
||||||
|
vim.o.background = "dark"
|
||||||
|
end
|
||||||
|
end, "Toggle between light and dark themes")
|
||||||
|
|
||||||
|
-- Clear after search
|
||||||
|
map("n", "<leader>ur", "<cmd>nohl<cr>", "Clear highlights")
|
||||||
|
|
||||||
|
-- Open config
|
||||||
|
map("n", "<leader>Nc", "<cmd>n ~/.config/nvim/init.lua<cr>", "Open Config")
|
||||||
|
|
||||||
|
-- ToggleTerm config
|
||||||
|
local Terminal = require('toggleterm.terminal').Terminal
|
||||||
|
local lazygit = Terminal:new({cmd = "lazygit", hidden = true, direction='tab'})
|
||||||
|
|
||||||
|
function _lazygit_toggle()
|
||||||
|
lazygit:toggle()
|
||||||
|
end
|
||||||
|
map("n", "<leader>gg", "<cmd>lua _lazygit_toggle()<cr>", "open lazygit")
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
-- Install lazy.nvim if not already installed
|
||||||
|
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",
|
||||||
|
"--branch=stable", -- latest stable release
|
||||||
|
lazypath,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Use a protected call so we don't error out on first use
|
||||||
|
local ok, lazy = pcall(require, "lazy")
|
||||||
|
if not ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- We have to set the leader key here for lazy.nvim to work
|
||||||
|
require("helpers.keys").set_leader(" ")
|
||||||
|
|
||||||
|
-- Load plugins from specifications
|
||||||
|
-- (The leader key must be set before this)
|
||||||
|
lazy.setup("plugins")
|
||||||
|
|
||||||
|
-- Might as well set up an easy-access keybinding
|
||||||
|
|
||||||
|
require("helpers.keys").map("n", "<leader>pL", lazy.show, "Show Lazy")
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
local opts = {
|
||||||
|
shiftwidth = 4,
|
||||||
|
tabstop = 4,
|
||||||
|
expandtab = true,
|
||||||
|
wrap = false,
|
||||||
|
termguicolors = true,
|
||||||
|
number = true,
|
||||||
|
relativenumber = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Set options from table
|
||||||
|
for opt, val in pairs(opts) do
|
||||||
|
vim.o[opt] = val
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Set other options
|
||||||
|
local colorscheme = require("helpers.colorscheme")
|
||||||
|
vim.cmd.colorscheme(colorscheme)
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
local M = {}
|
||||||
|
local function noop()
|
||||||
|
print("NOOP")
|
||||||
|
end
|
||||||
|
|
||||||
|
local ok, close_buffers = pcall(require, "close_buffers")
|
||||||
|
if ok then
|
||||||
|
M.delete_this = function()
|
||||||
|
close_buffers.delete({ type = "this" })
|
||||||
|
end
|
||||||
|
M.delete_all = function()
|
||||||
|
close_buffers.delete({ type = "all", force = true })
|
||||||
|
end
|
||||||
|
M.delete_others = function()
|
||||||
|
close_buffers.delete({ type = "other", force = true })
|
||||||
|
end
|
||||||
|
else
|
||||||
|
M.delete_this = function()
|
||||||
|
vim.cmd.bdelete()
|
||||||
|
end
|
||||||
|
M.delete_all = noop
|
||||||
|
M.delete_others = noop
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
-- Fetch and setup colorscheme if available, otherwise just return 'default'
|
||||||
|
-- This should prevent Neovim from complaining about missing colorschemes on first boot
|
||||||
|
local function get_if_available(name, opts)
|
||||||
|
local lua_ok, colorscheme = pcall(require, name)
|
||||||
|
if lua_ok then
|
||||||
|
colorscheme.setup(opts)
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
|
||||||
|
local vim_ok, _ = pcall(vim.cmd.colorscheme, name)
|
||||||
|
if vim_ok then
|
||||||
|
return name
|
||||||
|
end
|
||||||
|
|
||||||
|
return "default"
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Uncomment the colorscheme to use
|
||||||
|
-- local colorscheme = get_if_available('gruvbox')
|
||||||
|
-- local colorscheme = get_if_available('rose-pine')
|
||||||
|
local colorscheme = get_if_available('catppuccin')
|
||||||
|
-- local colorscheme = get_if_available('melange')
|
||||||
|
|
||||||
|
return colorscheme
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.map = function(mode, lhs, rhs, desc)
|
||||||
|
vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
M.lsp_map = function(lhs, rhs, bufnr, desc)
|
||||||
|
vim.keymap.set("n", lhs, rhs, { silent = true, buffer = bufnr, desc = desc })
|
||||||
|
end
|
||||||
|
|
||||||
|
M.dap_map = function(mode, lhs, rhs, desc)
|
||||||
|
M.map(mode, lhs, rhs, desc)
|
||||||
|
end
|
||||||
|
|
||||||
|
M.set_leader = function(key)
|
||||||
|
vim.g.mapleader = key
|
||||||
|
vim.g.maplocalleader = key
|
||||||
|
M.map({ "n", "v" }, key, "<nop>")
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
-- See current buffers at the top of the editor
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"akinsho/bufferline.nvim",
|
||||||
|
version = "v3.*",
|
||||||
|
dependencies = "nvim-tree/nvim-web-devicons",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,105 @@
|
||||||
|
-- Autocompletion
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
dependencies = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"rafamadriz/friendly-snippets",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require("cmp")
|
||||||
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
|
local kind_icons = {
|
||||||
|
Text = "",
|
||||||
|
Method = "m",
|
||||||
|
Function = "",
|
||||||
|
Constructor = "",
|
||||||
|
Field = "",
|
||||||
|
Variable = "",
|
||||||
|
Class = "",
|
||||||
|
Interface = "",
|
||||||
|
Module = "",
|
||||||
|
Property = "",
|
||||||
|
Unit = "",
|
||||||
|
Value = "",
|
||||||
|
Enum = "",
|
||||||
|
Keyword = "",
|
||||||
|
Snippet = "",
|
||||||
|
Color = "",
|
||||||
|
File = "",
|
||||||
|
Reference = "",
|
||||||
|
Folder = "",
|
||||||
|
EnumMember = "",
|
||||||
|
Constant = "",
|
||||||
|
Struct = "",
|
||||||
|
Event = "",
|
||||||
|
Operator = "",
|
||||||
|
TypeParameter = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||||
|
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<CR>"] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
|
select = false,
|
||||||
|
}),
|
||||||
|
["<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" }),
|
||||||
|
}),
|
||||||
|
formatting = {
|
||||||
|
fields = { "kind", "abbr", "menu" },
|
||||||
|
format = function(entry, vim_item)
|
||||||
|
-- Kind icons
|
||||||
|
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||||
|
vim_item.menu = ({
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
luasnip = "[Snippet]",
|
||||||
|
buffer = "[Buffer]",
|
||||||
|
path = "[Path]",
|
||||||
|
})[entry.source.name]
|
||||||
|
return vim_item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = "nvim_lsp" },
|
||||||
|
{ name = "luasnip" },
|
||||||
|
{ name = "buffer" },
|
||||||
|
{ name = "path" },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
-- Git related plugins
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"lewis6991/gitsigns.nvim",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"akinsho/git-conflict.nvim",
|
||||||
|
commit = "2957f74",
|
||||||
|
config = function()
|
||||||
|
require("git-conflict").setup({
|
||||||
|
default_mappings = {
|
||||||
|
ours = "co",
|
||||||
|
theirs = "ct",
|
||||||
|
none = "c0",
|
||||||
|
both = "cb",
|
||||||
|
next = "cn",
|
||||||
|
prev = "cp",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tpope/vim-fugitive",
|
||||||
|
config = function ()
|
||||||
|
local map = require("helpers.keys").map
|
||||||
|
map("n", "<leader>ga", "<cmd>Git add %<cr>", "Stage the current file")
|
||||||
|
map("n", "<leader>gb", "<cmd>Git blame<cr>", "Show the blame")
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,143 @@
|
||||||
|
-- LSP Configuration & Plugins
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
"williamboman/mason-lspconfig.nvim",
|
||||||
|
"j-hui/fidget.nvim",
|
||||||
|
"folke/neodev.nvim",
|
||||||
|
"RRethy/vim-illuminate",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
-- Set up Mason before anything else
|
||||||
|
require("mason").setup()
|
||||||
|
require("mason-lspconfig").setup({
|
||||||
|
ensure_installed = {
|
||||||
|
"lua_ls",
|
||||||
|
"pylsp",
|
||||||
|
},
|
||||||
|
automatic_installation = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Quick access via keymap
|
||||||
|
require("helpers.keys").map("n", "<leader>M", "<cmd>Mason<cr>", "Show Mason")
|
||||||
|
|
||||||
|
-- Neodev setup before LSP config
|
||||||
|
require("neodev").setup()
|
||||||
|
|
||||||
|
-- Turn on LSP status information
|
||||||
|
require("fidget").setup()
|
||||||
|
|
||||||
|
-- Set up cool signs for diagnostics
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Diagnostic config
|
||||||
|
local config = {
|
||||||
|
virtual_text = false,
|
||||||
|
signs = {
|
||||||
|
active = signs,
|
||||||
|
},
|
||||||
|
update_in_insert = true,
|
||||||
|
underline = true,
|
||||||
|
severity_sort = true,
|
||||||
|
float = {
|
||||||
|
focusable = true,
|
||||||
|
style = "minimal",
|
||||||
|
border = "rounded",
|
||||||
|
source = "always",
|
||||||
|
header = "",
|
||||||
|
prefix = "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
vim.diagnostic.config(config)
|
||||||
|
|
||||||
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
local lsp_map = require("helpers.keys").lsp_map
|
||||||
|
|
||||||
|
lsp_map("<leader>lr", vim.lsp.buf.rename, bufnr, "Rename symbol")
|
||||||
|
lsp_map("<leader>la", vim.lsp.buf.code_action, bufnr, "Code action")
|
||||||
|
lsp_map("<leader>ld", vim.lsp.buf.type_definition, bufnr, "Type definition")
|
||||||
|
lsp_map("<leader>ls", require("telescope.builtin").lsp_document_symbols, bufnr, "Document symbols")
|
||||||
|
|
||||||
|
lsp_map("gd", vim.lsp.buf.definition, bufnr, "Goto Definition")
|
||||||
|
lsp_map("gr", require("telescope.builtin").lsp_references, bufnr, "Goto References")
|
||||||
|
lsp_map("gI", vim.lsp.buf.implementation, bufnr, "Goto Implementation")
|
||||||
|
lsp_map("K", vim.lsp.buf.hover, bufnr, "Hover Documentation")
|
||||||
|
lsp_map("gD", vim.lsp.buf.declaration, bufnr, "Goto Declaration")
|
||||||
|
|
||||||
|
-- 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" })
|
||||||
|
|
||||||
|
lsp_map("<leader>ff", "<cmd>Format<cr>", bufnr, "Format")
|
||||||
|
|
||||||
|
-- Attach and configure vim-illuminate
|
||||||
|
require("illuminate").on_attach(client)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 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)
|
||||||
|
|
||||||
|
-- Lua
|
||||||
|
require("lspconfig")["lua_ls"].setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
completion = {
|
||||||
|
callSnippet = "Replace",
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
globals = { "vim" },
|
||||||
|
},
|
||||||
|
workspace = {
|
||||||
|
library = {
|
||||||
|
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||||
|
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Python
|
||||||
|
require("lspconfig")["pylsp"].setup({
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
settings = {
|
||||||
|
pylsp = {
|
||||||
|
plugins = {
|
||||||
|
flake8 = {
|
||||||
|
enabled = true,
|
||||||
|
maxLineLength = 88, -- Black's line length
|
||||||
|
},
|
||||||
|
-- Disable plugins overlapping with flake8
|
||||||
|
pycodestyle = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
mccabe = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
pyflakes = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
-- Use Black as the formatter
|
||||||
|
autopep8 = {
|
||||||
|
enabled = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
-- Fancier statusline
|
||||||
|
return {
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
config = function()
|
||||||
|
local colorscheme = require("helpers.colorscheme")
|
||||||
|
local lualine_theme = colorscheme == "default" and "auto" or colorscheme
|
||||||
|
require("lualine").setup({
|
||||||
|
options = {
|
||||||
|
icons_enabled = true,
|
||||||
|
theme = lualine_theme,
|
||||||
|
component_separators = "|",
|
||||||
|
section_separators = "",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end, }
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
-- Miscelaneous fun stuff
|
||||||
|
return {
|
||||||
|
-- Comment with haste
|
||||||
|
{
|
||||||
|
"numToStr/Comment.nvim",
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
-- Move stuff with <M-j> and <M-k> in both normal and visual mode
|
||||||
|
{
|
||||||
|
"echasnovski/mini.move",
|
||||||
|
config = function()
|
||||||
|
require("mini.move").setup()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
-- Better buffer closing actions. Available via the buffers helper.
|
||||||
|
{
|
||||||
|
"kazhala/close-buffers.nvim",
|
||||||
|
opts = {
|
||||||
|
preserve_window_layout = { "this", "nameless" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"tpope/vim-sleuth", -- Detect tabstop and shiftwidth automatically
|
||||||
|
"tpope/vim-surround", -- Surround stuff with the ys-, cs-, ds- commands
|
||||||
|
"mrjones2014/nvim-ts-rainbow",
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
-- Nicer filetree than NetRW
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-neo-tree/neo-tree.nvim",
|
||||||
|
branch = "v2.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-tree/nvim-web-devicons",
|
||||||
|
"MunifTanjim/nui.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("neo-tree").setup({
|
||||||
|
close_if_last_window=true,
|
||||||
|
filesystem = {
|
||||||
|
follow_current_file = { enable=true },
|
||||||
|
use_libuv_file_watcher=true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
require("helpers.keys").map(
|
||||||
|
{ "n", "v" },
|
||||||
|
"<leader>e",
|
||||||
|
"<cmd>NeoTreeRevealToggle<cr>",
|
||||||
|
"Toggle file explorer"
|
||||||
|
)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
null_ls.setup({
|
||||||
|
sources = {
|
||||||
|
null_ls.builtins.formatting.stylua,
|
||||||
|
null_ls.builtins.formatting.clang_format,
|
||||||
|
null_ls.builtins.formatting.black,
|
||||||
|
null_ls.builtins.formatting.isort,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
-- Telescope fuzzy finding (all the things)
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
branch = "0.1.x",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
|
||||||
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make", cond = vim.fn.executable("make") == 1 },
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("telescope").setup({
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-u>"] = false,
|
||||||
|
["<C-d>"] = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Enable telescope fzf native, if installed
|
||||||
|
pcall(require("telescope").load_extension, "fzf")
|
||||||
|
|
||||||
|
local map = require("helpers.keys").map
|
||||||
|
map("n", "<leader>fr", require("telescope.builtin").oldfiles, "Recently opened")
|
||||||
|
map("n", "<leader><space>", require("telescope.builtin").buffers, "Open buffers")
|
||||||
|
map("n", "<leader>/", function()
|
||||||
|
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||||
|
require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||||
|
winblend = 10,
|
||||||
|
previewer = false,
|
||||||
|
}))
|
||||||
|
end, "Search in current buffer")
|
||||||
|
|
||||||
|
map("n", "<leader>sf", require("telescope.builtin").find_files, "Files")
|
||||||
|
map("n", "<leader>sh", require("telescope.builtin").help_tags, "Help")
|
||||||
|
map("n", "<leader>sw", require("telescope.builtin").grep_string, "Current word")
|
||||||
|
map("n", "<leader>sg", require("telescope.builtin").live_grep, "Grep")
|
||||||
|
map("n", "<leader>sd", require("telescope.builtin").diagnostics, "Diagnostics")
|
||||||
|
|
||||||
|
map("n", "<C-p>", require("telescope.builtin").keymaps, "Search keymaps")
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
-- Themes
|
||||||
|
return {
|
||||||
|
"typicode/bg.nvim",
|
||||||
|
|
||||||
|
"ellisonleao/gruvbox.nvim",
|
||||||
|
|
||||||
|
{
|
||||||
|
"catppuccin/nvim",
|
||||||
|
name = "catppuccin",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"rose-pine/nvim",
|
||||||
|
name = "rose-pine",
|
||||||
|
},
|
||||||
|
|
||||||
|
"sainnhe/everforest",
|
||||||
|
|
||||||
|
"savq/melange-nvim"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
'akinsho/toggleterm.nvim',
|
||||||
|
version = "*",
|
||||||
|
config = {
|
||||||
|
direction = 'float',
|
||||||
|
shell = 'fish',
|
||||||
|
float_opts = { border = 'curved' },
|
||||||
|
open_mapping = [[<c-\>]],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
build = function()
|
||||||
|
pcall(require("nvim-treesitter.install").update({ with_sync = true }))
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
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", "vim" },
|
||||||
|
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true, disable = { "python" } },
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "<c-space>",
|
||||||
|
node_incremental = "<c-space>",
|
||||||
|
scope_incremental = "<c-s>",
|
||||||
|
node_decremental = "<c-backspace>",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
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",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
return {
|
||||||
|
{
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
config = function()
|
||||||
|
local wk = require("which-key")
|
||||||
|
wk.setup()
|
||||||
|
wk.register(
|
||||||
|
{
|
||||||
|
["<leader>"] = {
|
||||||
|
f = { name = "File" },
|
||||||
|
d = { name = "Delete/Close" },
|
||||||
|
q = { name = "Quit" },
|
||||||
|
s = { name = "Search" },
|
||||||
|
l = { name = "LSP" },
|
||||||
|
u = { name = "UI" },
|
||||||
|
b = { name = "Debugging" },
|
||||||
|
g = { name = "Git" },
|
||||||
|
N = { name = "Neovim" },
|
||||||
|
p = { name = "Plugins" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue