my neovim configuration

updates

+1
init.lua
···
require "ptero.theme"
require "ptero.keymaps"
+
require "ptero.lsp"
+9 -8
lazy-lock.json
···
{
-
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
-
"catppuccin": { "branch": "main", "commit": "5b5e3aef9ad7af84f463d17b5479f06b87d5c429" },
-
"gitsigns.nvim": { "branch": "main", "commit": "17ab794b6fce6fce768430ebc925347e349e1d60" },
+
"blink.cmp": { "branch": "main", "commit": "586ee87534f5bf65f1c8dea2d1da2a57e8cddd36" },
+
"catppuccin": { "branch": "main", "commit": "fa42eb5e26819ef58884257d5ae95dd0552b9a66" },
+
"gitsigns.nvim": { "branch": "main", "commit": "0cb5a7753d3c4b8e9cfdc9d88d9110cb8d4b1544" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
-
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
-
"nvim-lspconfig": { "branch": "master", "commit": "442e077e326ac467daf9cd63e72120fb450a850b" },
-
"nvim-treesitter": { "branch": "master", "commit": "0e21ee8df6235511c02bab4a5b391d18e165a58d" },
-
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
-
"telescope.nvim": { "branch": "master", "commit": "a4ed82509cecc56df1c7138920a1aeaf246c0ac5" }
+
"mason-lspconfig.nvim": { "branch": "main", "commit": "bb3a17efc797c34c054463174e5522442576ebd8" },
+
"mason.nvim": { "branch": "main", "commit": "8024d64e1330b86044fed4c8494ef3dcd483a67c" },
+
"nvim-lspconfig": { "branch": "master", "commit": "f47cd681d7cb6048876a2e908b6d8ba1e530d152" },
+
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
+
"nvim-web-devicons": { "branch": "master", "commit": "0422a19d9aa3aad2c7e5cca167e5407b13407a9d" },
+
"snacks.nvim": { "branch": "main", "commit": "bc0630e43be5699bb94dadc302c0d21615421d93" }
}
+30
lua/plugins/catpuccin.lua
···
+
local M = {
+
"catppuccin/nvim",
+
name = "catppuccin",
+
priority = 1000,
+
opts = {
+
flavour = "mocha",
+
background = {
+
light = "latte",
+
dark = "mocha",
+
},
+
styles = {
+
comments = { "italic" },
+
},
+
transparent_background = true,
+
integrations = {
+
gitsigns = true,
+
treesitter = true,
+
notify = true,
+
blink_cmp = true,
+
snacks = {enabled = true},
+
which_key = true,
+
},
+
},
+
config = function(_, opts)
+
require("catppuccin").setup(opts)
+
vim.cmd.colorscheme("catppuccin-mocha")
+
end,
+
}
+
+
return M
+20
lua/plugins/gitsigns.lua
···
+
local M = {
+
"lewis6991/gitsigns.nvim",
+
event = { "BufReadPost", "BufNewFile", "BufWritePre" },
+
opts = {
+
signs = {
+
add = { text = "▎" },
+
change = { text = "▎" },
+
delete = { text = "󰐊" },
+
topdelete = { text = "󰐊" },
+
changedelete = { text = "▎" },
+
untracked = { text = "▎" },
+
},
+
current_line_blame = false,
+
preview_config = {
+
border = "rounded",
+
},
+
},
+
}
+
+
return M
+25
lua/plugins/lspconfig.lua
···
+
local M = {
+
"mason-org/mason-lspconfig.nvim",
+
dependencies = {
+
"neovim/nvim-lspconfig",
+
{ "mason-org/mason.nvim", opts = { ui = { border = "rounded" } } },
+
},
+
opts = {
+
ensure_installed = {
+
"bashls",
+
"cssls",
+
"dockerls",
+
"gopls",
+
"html",
+
"jsonls",
+
"lua_ls",
+
"pyright",
+
"rust_analyzer",
+
"ts_ls",
+
"vimls",
+
"zls",
+
},
+
},
+
}
+
+
return M
+23
lua/plugins/snacks.lua
···
+
local M = {
+
"folke/snacks.nvim",
+
dependencies = {
+
"nvim-tree/nvim-web-devicons",
+
},
+
priority = 1000,
+
lazy = false,
+
opts = {
+
bigfile = { enabled = true },
+
dashboard = { enabled = false },
+
explorer = { enabled = true },
+
git = { enabled = true },
+
image = { enabled = true },
+
indent = { enabled = true },
+
input = { enabled = true },
+
notifier = { enabled = true },
+
picker = { enabled = true },
+
terminal = { enabled = true },
+
words = { enabled = true },
+
},
+
}
+
+
return M
+26
lua/plugins/treesitter.lua
···
+
local M = {
+
"nvim-treesitter/nvim-treesitter",
+
branch = "master",
+
lazy = false,
+
build = ":TSUpdate",
+
+
opts = {
+
ensure_installed = "all",
+
auto_install = true,
+
highlight = {
+
enable = true,
+
additional_vim_regex_highlighting = false,
+
},
+
indent = {
+
enable = true,
+
disable = {
+
"python"
+
}
+
},
+
matchup = {
+
enable = true,
+
},
+
},
+
}
+
+
return M
+15 -4
lua/ptero/keymaps.lua
···
vim.keymap.set("n", "<S-Tab>", ":tabprevious<cr>", opts)
vim.keymap.set("n", "<S-T>", ":tabnew<cr>", opts)
-
-- telescope
-
vim.keymap.set("n", "<leader>sf", require('telescope.builtin').find_files, opts)
-
vim.keymap.set("n", "<leader>st", require('telescope.builtin').live_grep, opts)
-
vim.keymap.set("n", "<leader>fm", require('telescope.builtin').man_pages, opts)
+
+
keymaps = {
+
------------------------- Search / pickers -------------------------
+
{ "<Leader>sf", function() Snacks.picker.files() end, desc = "Find File" },
+
{ "<Leader>st", function() Snacks.picker.grep() end, desc = "Live Grep" },
+
{ "<Leader>sg", function() Snacks.picker.git_grep({ cwd = Snacks.git.get_root(vim.uv.cwd()), untracked = true }) end, desc = "Grep Git" },
+
{ "<Leader>sM", function() Snacks.picker.man() end, desc = "Man Pages" },
+
{ "<Leader>sh", function() Snacks.picker.help() end, desc = "Help Pages" },
+
}
+
+
for _, map in ipairs(keymaps) do
+
local lhs, rhs, opts = map[1], map[2], { desc = map.desc, silent = true }
+
if map.remap then opts.remap = map.remap end
+
vim.keymap.set(map.mode or "n", lhs, rhs, opts)
+
end
+3 -18
lua/ptero/lazy.lua
···
require("lazy").setup({
spec = {
-
-- colors :3
-
{ import = "ptero.plugins.catppuccin" },
-
{ import = "ptero.plugins.treesitter" },
-
-
-- install lsps easier
-
{ import = "ptero.plugins.mason" },
-
{ import = "ptero.plugins.lspconfig" },
-
-
-- autocomplete
-
{ import = "ptero.plugins.blink" },
-
-
-- git
-
{ import = "ptero.plugins.gitsigns" },
-
-
-- telescope
-
{ import = "ptero.plugins.telescope" },
+
{ import = "plugins" },
},
install = { colorscheme = { "catppuccin-mocha" } },
-
-- automatically check for plugin updates
-
checker = { enabled = true },
+
checker = { enabled = false },
+
ui = { border = "rounded" }
})
+70
lua/ptero/lsp.lua
···
+
vim.diagnostic.config({
+
severity_sort = true,
+
float = {
+
border = "rounded",
+
source = true,
+
header = "",
+
prefix = "",
+
},
+
signs = {
+
text = {
+
[vim.diagnostic.severity.ERROR] = "",
+
[vim.diagnostic.severity.WARN] = "",
+
[vim.diagnostic.severity.INFO] = "",
+
[vim.diagnostic.severity.HINT] = "󰌶",
+
},
+
},
+
})
+
+
vim.api.nvim_create_autocmd("LspAttach", {
+
group = vim.api.nvim_create_augroup("user_config_lsp_attach", { clear = true }),
+
callback = function(event)
+
local keymaps = {
+
---------------------- Hover & Signature -----------------------
+
{ "K", function() vim.lsp.buf.hover({ border = "rounded" }) end, desc = "Hover Documentation" },
+
{ "gK", function() vim.lsp.buf.signature_help({ border = "rounded" }) end, desc = "Signature Help" },
+
+
---------------------- Goto / Navigation -----------------------
+
{ "gd", vim.lsp.buf.definition, desc = "Goto Definition" },
+
{ "gD", vim.lsp.buf.declaration, desc = "Goto Declaration" },
+
{ "gi", vim.lsp.buf.implementation, desc = "Goto Implementation" },
+
{ "gy", vim.lsp.buf.type_definition, desc = "Goto Type Definition" },
+
{ "gr", vim.lsp.buf.references, desc = "References" },
+
-- { "gr", function() Snacks.picker.lsp_references() end, desc = "References" },
+
+
------------------------- Diagnostics --------------------------
+
{ "gl", vim.diagnostic.open_float, desc = "Show Line Diagnostics" },
+
{ "]d", function() vim.diagnostic.jump({ count = 1, float = true }) end, desc = "Next Diagnostic" },
+
{ "[d", function() vim.diagnostic.jump({ count = -1, float = true }) end, desc = "Prev Diagnostic" },
+
{ "<Leader>lj", function() vim.diagnostic.jump({ count = 1, float = true }) end, desc = "Next Diagnostic" },
+
{ "<Leader>lk", function() vim.diagnostic.jump({ count = -1, float = true }) end, desc = "Prev Diagnostic" },
+
{ "<Leader>lq", vim.diagnostic.setloclist, desc = "Diagnostics → Loclist" },
+
{ "<Leader>ld", function() Snacks.picker.diagnostics_buffer() end, desc = "Buffer Diagnostics" },
+
{ "<Leader>lD", function() Snacks.picker.diagnostics() end, desc = "Workspace Diagnostics" },
+
+
-------------------- Code Actions & Lenses ---------------------
+
{ "<Leader>la", vim.lsp.buf.code_action, desc = "Code Action", mode = { "n", "x" } },
+
{ "<Leader>lf", vim.lsp.buf.format, desc = "Format Document" },
+
{ "<Leader>lr", vim.lsp.buf.rename, desc = "Rename Symbol" },
+
{ "<Leader>lc", vim.lsp.codelens.run, desc = "Run CodeLens" },
+
+
--------------------- Symbols & Workspace ----------------------
+
{ "<Leader>ls", function() Snacks.picker.lsp_symbols() end, desc = "Symbols" },
+
{ "<Leader>lS", function() Snacks.picker.lsp_workspace_symbols() end, desc = "Workspace Symbols" },
+
{ "<Leader>ll", "<Cmd>Trouble lsp toggle focus=false<CR>", desc = "LSP Definitions / References / ... (Trouble)" },
+
+
-------------------------- Misc LSP ----------------------------
+
{ "<Leader>li", "<Cmd>LspInfo<CR>", desc = "LSP Info" },
+
{ "<Leader>lR", "<Cmd>LspRestart<CR>", desc = "Restart LSP" },
+
}
+
+
for _, map in ipairs(keymaps) do
+
local lhs, rhs = map[1], map[2]
+
vim.keymap.set(map.mode or "n", lhs, rhs, {
+
buffer = event.buf,
+
desc = map.desc,
+
silent = true,
+
})
+
end
+
end,
+
})
+2 -25
lua/ptero/plugins.lua
···
local utils = require("ptero/utils")
require("lazy").setup({
-
{
+
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
···
config=function() require("ptero.configs.treesitter") end
},
-
-- fuzzy find all the things
-
{
-
"nvim-telescope/telescope.nvim",
-
config=function() require("ptero.configs.telescope") end
-
},
-
-- git signs in the side
{
"lewis6991/gitsigns.nvim",
config=function() require("ptero.configs.gitsigns") end
},
-
-- completeion
-
{
-
"hrsh7th/nvim-cmp",
-
config=function() require('ptero.configs.cmp') end,
-
dependencies = {
-
"hrsh7th/cmp-buffer",
-
"hrsh7th/cmp-nvim-lsp",
-
"hrsh7th/cmp-path",
-
{
-
"saadparwaiz1/cmp_luasnip",
-
dependencies = {
-
"L3MON4D3/luasnip"
-
}
-
},
-
},
-
},
-
-- lsp
"neovim/nvim-lspconfig",
···
},
-- visual keybindings
-
"folke/which-key.nvim",
+
"folke/which-key.nvim"
})
-24
lua/ptero/plugins/blink.lua
···
-
local utils = require("ptero/utils")
-
-
return {
-
{
-
"saghen/blink.cmp",
-
version = '1.*',
-
opts = {
-
keymap = { preset = 'super-tab' },
-
appearance = {
-
nerd_font_variant = 'mono'
-
},
-
completion = { documentation = { auto_show = true } },
-
sources = {
-
default = {
-
'lsp',
-
'path',
-
'buffer',
-
}
-
},
-
fuzzy = { implementation = "prefer_rust" }
-
},
-
opts_extend = { "sources.default" }
-
}
-
}
-29
lua/ptero/plugins/catppuccin.lua
···
-
local utils = require("ptero.utils")
-
-
return {
-
"catppuccin/nvim",
-
name = "catppuccin",
-
priority = 1000,
-
config = function()
-
local catppuccin = utils.Load("catppuccin")
-
if catppuccin then
-
catppuccin.setup({
-
flavour = "mocha",
-
background = {
-
light = "latte",
-
dark = "mocha",
-
},
-
styles = {
-
comments = { "italic" },
-
},
-
transparent_background = true,
-
integrations = {
-
gitsigns = true,
-
treesitter = true,
-
notify = true,
-
blink_cmp = true,
-
},
-
})
-
end
-
end,
-
}
-40
lua/ptero/plugins/gitsigns.lua
···
-
local utils = require("ptero/utils")
-
-
return {
-
{
-
"lewis6991/gitsigns.nvim",
-
config = function()
-
local gitsigns = utils.Load("gitsigns")
-
-
gitsigns.setup({
-
signcolumn = true,
-
numhl = false,
-
linehl = false,
-
word_diff = false,
-
watch_gitdir = {
-
interval = 1000,
-
follow_files = true,
-
},
-
attach_to_untracked = true,
-
current_line_blame = false,
-
current_line_blame_opts = {
-
virt_text = true,
-
virt_text_pos = "eol",
-
delay = 1000,
-
ignore_whitespace = false,
-
},
-
sign_priority = 6,
-
update_debounce = 100,
-
status_formatter = nil,
-
max_file_length = 50000,
-
preview_config = {
-
style = "minimal",
-
border = "single",
-
relative = "cursor",
-
row = 0,
-
col = 1,
-
},
-
})
-
end
-
}
-
}
-20
lua/ptero/plugins/lspconfig.lua
···
-
local utils = require("ptero/utils")
-
-
local servers = {
-
gopls = {}
-
}
-
-
return {
-
{
-
"neovim/nvim-lspconfig",
-
dependencies = { 'sahgen/blink.cmp' },
-
config = function()
-
local lspconfig = utils.Load("lspconfig")
-
for server, config in pairs(servers) do
-
config.capabilities =
-
require('blink.cmp').get_lsp_capabilities(config.capabilities)
-
lspconfig[server].setup(config)
-
end
-
end
-
}
-
}
-12
lua/ptero/plugins/mason.lua
···
-
local utils = require("ptero/utils")
-
-
return {
-
{
-
"williamboman/mason.nvim",
-
config = function()
-
local mason = utils.Load("mason")
-
mason.setup({
-
})
-
end
-
}
-
}
-55
lua/ptero/plugins/telescope.lua
···
-
local utils = require("ptero.utils")
-
-
local actions = require("telescope.actions")
-
-
return {
-
{
-
"nvim-telescope/telescope.nvim",
-
config = function()
-
local telescope = utils.Load("telescope")
-
-
telescope.setup({
-
defaults = {
-
prompt_prefix = "> ",
-
selection_caret = "> ",
-
borderchars = border,
-
file_ignore_patterns = {
-
"deps",
-
"node_modules",
-
"_build"
-
},
-
mappings = {
-
i = {
-
["<C-j>"] = actions.move_selection_next,
-
["<C-k>"] = actions.move_selection_previous,
-
["<C-c>"] = actions.close,
-
["<C-n>"] = actions.cycle_history_next,
-
["<C-p>"] = actions.cycle_history_prev,
-
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
-
},
-
n = {
-
["<esc>"] = actions.close,
-
["<C-j>"] = actions.move_selection_next,
-
["<C-k>"] = actions.move_selection_previous,
-
},
-
},
-
path_display = {
-
"smart"
-
},
-
set_env = { COLORTERM = "truecolor" },
-
},
-
pickers = {
-
},
-
extensions = {
-
fzf = {
-
fuzzy = true,
-
override_generic_sorter = true,
-
override_file_sorter = true,
-
case_mode = "smart_case",
-
},
-
},
-
})
-
end
-
}
-
}
-
-27
lua/ptero/plugins/treesitter.lua
···
-
local utils = require("ptero/utils")
-
-
return {
-
{
-
"nvim-treesitter/nvim-treesitter",
-
build = ":TSUpdate",
-
event = { "BufReadPost", "BufNewFile" },
-
config = function()
-
local configs = utils.Load("nvim-treesitter.configs")
-
-
configs.setup {
-
ensure_installed = "all",
-
auto_install = true,
-
highlight = {
-
enable = true,
-
additional_vim_regex_highlighting = false,
-
},
-
indent = {
-
enable = true,
-
disable = {
-
"python"
-
}
-
},
-
}
-
end
-
}
-
}