advent of neovim is prompting some changes :D

This commit is contained in:
Solomon Laing 2024-12-29 23:16:38 +10:30
parent f8bd90f45d
commit 802517b65b
20 changed files with 525 additions and 465 deletions

View File

@ -1,64 +1,84 @@
local opts = { noremap = true, silent = true }
local map = vim.api.nvim_set_keymap
-- better up/down
map("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true })
map("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", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })
-- Move text up and down
map("n", "<C-k>", "<ESC>:m .-2<CR>==", opts)
map("n", "<C-j>", "<ESC>:m .+1<CR>==", opts)
vim.keymap.set("n", "<C-k>", "<ESC>:m .-2<CR>==", opts)
vim.keymap.set("n", "<C-j>", "<ESC>:m .+1<CR>==", opts)
-- Move Lines
map("n", "<C-j>", ":m .+1<CR>==", { desc = "Move down" })
map("v", "<C-j>", ":m '>+1<CR>gv=gv", { desc = "Move down" })
map("i", "<C-j>", "<Esc>:m .+1<CR>==gi", { desc = "Move down" })
map("n", "<C-k>", ":m .-2<CR>==", { desc = "Move up" })
map("v", "<C-k>", ":m '<-2<CR>gv=gv", { desc = "Move up" })
map("i", "<C-k>", "<Esc>:m .-2<CR>==gi", { desc = "Move up" })
vim.keymap.set("n", "<C-j>", ":m .+1<CR>==", { desc = "Move down" })
vim.keymap.set("v", "<C-j>", ":m '>+1<CR>gv=gv", { desc = "Move down" })
vim.keymap.set("i", "<C-j>", "<Esc>:m .+1<CR>==gi", { desc = "Move down" })
vim.keymap.set("n", "<C-k>", ":m .-2<CR>==", { desc = "Move up" })
vim.keymap.set("v", "<C-k>", ":m '<-2<CR>gv=gv", { desc = "Move up" })
vim.keymap.set("i", "<C-k>", "<Esc>:m .-2<CR>==gi", { desc = "Move up" })
-- Clear search with <esc>
map("n", "<esc>", "<cmd>noh<cr><esc>", opts)
map("i", "<esc>", "<cmd>noh<cr><esc>", opts)
vim.keymap.set("n", "<esc>", "<cmd>noh<cr><esc>", opts)
vim.keymap.set("i", "<esc>", "<cmd>noh<cr><esc>", opts)
-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
map("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
map("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
map("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
map("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
map("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
map("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
vim.keymap.set("n", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
vim.keymap.set("x", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
vim.keymap.set("o", "n", "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
vim.keymap.set("n", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
vim.keymap.set("x", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
vim.keymap.set("o", "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
-- Save
map("n", "<C-s>", "<ESC>:w<CR>", opts)
map("i", "<C-s>", "<ESC>:w<CR>", opts)
vim.keymap.set("n", "<C-s>", "<ESC>:w<CR>", opts)
vim.keymap.set("i", "<C-s>", "<ESC>:w<CR>", opts)
-- Switch between buffers
map("n", "<S-l>", ":bnext<CR>", opts)
map("n", "<S-h>", ":bprevious<CR>", opts)
vim.keymap.set("n", "<S-l>", ":bnext<CR>", opts)
vim.keymap.set("n", "<S-h>", ":bprevious<CR>", opts)
-- center after up and down movements
map("n", "<C-u>", "<C-u>zz", opts)
map("n", "<C-d>", "<C-d>zz", opts)
vim.keymap.set("n", "<C-u>", "<C-u>zz", opts)
vim.keymap.set("n", "<C-d>", "<C-d>zz", opts)
-- Indenting
map("v", "<", "<gv", opts)
map("v", ">", ">gv", opts)
vim.keymap.set("v", "<", "<gv", opts)
vim.keymap.set("v", ">", ">gv", opts)
-- move through quickfix list
map("n", "<C-l>", ":cnext<cr>zz", { noremap = true, silent = true, desc = "Next quickfix" })
map("n", "<C-h>", ":cprev<cr>zz", { noremap = true, silent = true, desc = "Prev quickfix" })
map("n", "]q", ":cnext<cr>zz", { noremap = true, silent = true, desc = "Next quickfix" })
map("n", "[q", ":cprev<cr>zz", { noremap = true, silent = true, desc = "Prev quickfix" })
vim.keymap.set("n", "<C-l>", ":cnext<cr>zz", { noremap = true, silent = true, desc = "Next quickfix" })
vim.keymap.set("n", "<C-h>", ":cprev<cr>zz", { noremap = true, silent = true, desc = "Prev quickfix" })
vim.keymap.set("n", "]q", ":cnext<cr>zz", { noremap = true, silent = true, desc = "Next quickfix" })
vim.keymap.set("n", "[q", ":cprev<cr>zz", { noremap = true, silent = true, desc = "Prev quickfix" })
-- thanks teej
vim.keymap.set("n", "<leader>xx", "<cmd>source %<CR>", { desc = "Source File" })
vim.keymap.set("n", "<leader>x", ":.lua<CR>", { desc = "Source Line" })
vim.keymap.set("v", "<leader>x", ":lua<CR>", { desc = "Source Selection" })
vim.keymap.set("n", "<leader>-", "<cmd>Oil<CR>")
vim.keymap.set("t", "<esc><esc>", "<c-\\><c-n>")
local job_id = 0
vim.keymap.set("n", "<leader>Ts", function()
vim.cmd.vnew()
vim.cmd.term()
vim.cmd.wincmd("J")
vim.api.nvim_win_set_width(0, 5)
job_id = vim.bo.channel
end, { desc = "Small Terminal" })
vim.keymap.set("n", "<leader>gotest", function()
vim.fn.chansend(job_id, { "go test\r\n" })
end)
vim.keymap.set("n", "<leader>Tf", "<cmd>FloatTerminal<cr>")
-- Thanks Prime
vim.keymap.set("x", "<leader>p", [["_dP]])
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
vim.keymap.set("n", "<leader>Y", [["+Y]])
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
vim.keymap.set("i", "<C-c>", "<Esc>")
vim.keymap.set("n", "Q", "<nop>")
vim.keymap.set("n", "<leader>T", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "<leader>S", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
vim.keymap.set("n", "<leader>Tt", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
vim.keymap.set("n", "<leader>S", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], { desc = "search and replace" })
vim.keymap.set("n", "<leader>X", "<cmd>!chmod +x %<CR>", { silent = true, desc = "make me executable" })

View File

@ -19,6 +19,7 @@ vim.api.nvim_set_keymap("n", "<leader>L", "<cmd>:Lazy<cr>", { desc = "Lazy GUI"
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
require("lazyvim.config").setup()
require("lazyvim.utils").setup()
require("lazy").setup({
spec = "lazyvim.plugins",

View File

@ -1,48 +1,49 @@
return {
-- {
-- "goolord/alpha-nvim",
-- event = "VimEnter",
-- config = function()
-- local dashboard = require("alpha.themes.dashboard")
--
-- local function button(sc, txt, key, key_opts)
-- local b = dashboard.button(sc, txt, key, key_opts)
-- b.opts.hl_shortcut = "Macro"
-- return b
-- end
--
-- local icons = require("lazyvim.config.icons")
--
-- dashboard.section.header.val = {
-- [[ , __ ___ __. _ __ ` , _ , _ ]],
-- [[ |' `. .' ` .' \ | / | |' `|' `.]],
-- [[ | | |----' | | ` / | | | |]],
-- [[ / | `.___, `._.' \/ / / ' /]],
-- }
--
-- dashboard.section.buttons.val = {
-- button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"),
-- button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"),
-- button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"),
-- button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
-- button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),
-- button("u", icons.ui.CloudDownload .. " Update", ":Lazy<CR>"),
-- button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"),
-- }
--
-- dashboard.section.footer.val = {
-- [[┬┌┐┌┬┌─┬ ┌─┐┌┬┐┌┐ ┬ ┌─┐┌┬┐┌─┐┌─┐┌┬┐]],
-- [[││││├┴┐│ ├┤ │ ├┴┐│ │ │ │ │ │ ││││]],
-- [[┴┘└┘┴ ┴┴─┘└─┘ ┴ └─┘┴─┘└─┘ ┴o└─┘└─┘┴ ┴]],
-- }
--
-- dashboard.section.header.opts.hl = "Include"
-- dashboard.section.buttons.opts.hl = "Macro"
-- dashboard.section.footer.opts.hl = "Type"
--
-- dashboard.opts.opts.noautocmd = true
--
-- require("alpha").setup(dashboard.opts)
-- end,
-- },
{
"goolord/alpha-nvim",
enabled = false,
event = "VimEnter",
config = function()
local dashboard = require("alpha.themes.dashboard")
local function button(sc, txt, key, key_opts)
local b = dashboard.button(sc, txt, key, key_opts)
b.opts.hl_shortcut = "Macro"
return b
end
local icons = require("lazyvim.config.icons")
dashboard.section.header.val = {
[[ , __ ___ __. _ __ ` , _ , _ ]],
[[ |' `. .' ` .' \ | / | |' `|' `.]],
[[ | | |----' | | ` / | | | |]],
[[ / | `.___, `._.' \/ / / ' /]],
}
dashboard.section.buttons.val = {
button("f", icons.documents.Files .. " Find file", ":Telescope find_files <CR>"),
button("e", icons.ui.NewFile .. " New file", ":ene <BAR> startinsert <CR>"),
button("r", icons.ui.History .. " Recent files", ":Telescope oldfiles <CR>"),
button("t", icons.ui.List .. " Find text", ":Telescope live_grep <CR>"),
button("c", icons.ui.Gear .. " Config", ":e ~/.config/nvim/init.lua <CR>"),
button("u", icons.ui.CloudDownload .. " Update", ":Lazy<CR>"),
button("q", icons.ui.SignOut .. " Quit", ":qa<CR>"),
}
dashboard.section.footer.val = {
[[┬┌┐┌┬┌─┬ ┌─┐┌┬┐┌┐ ┬ ┌─┐┌┬┐┌─┐┌─┐┌┬┐]],
[[││││├┴┐│ ├┤ │ ├┴┐│ │ │ │ │ │ ││││]],
[[┴┘└┘┴ ┴┴─┘└─┘ ┴ └─┘┴─┘└─┘ ┴o└─┘└─┘┴ ┴]],
}
dashboard.section.header.opts.hl = "Include"
dashboard.section.buttons.opts.hl = "Macro"
dashboard.section.footer.opts.hl = "Type"
dashboard.opts.opts.noautocmd = true
require("alpha").setup(dashboard.opts)
end,
},
}

View File

@ -1,6 +1,46 @@
return {
{
'saghen/blink.cmp',
-- optional: provides snippets for the snippet source
dependencies = 'rafamadriz/friendly-snippets',
-- use a release tag to download pre-built binaries
version = '*',
-- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust
-- build = 'cargo build --release',
-- If you use nix, you can build from source using latest nightly rust with:
-- build = 'nix run .#build-plugin',
---@module 'blink.cmp'
---@type blink.cmp.Config
opts = {
-- 'default' for mappings similar to built-in completion
-- 'super-tab' for mappings similar to vscode (tab to accept, arrow keys to navigate)
-- 'enter' for mappings similar to 'super-tab' but with 'enter' to accept
-- See the full "keymap" documentation for information on defining your own keymap.
keymap = { preset = 'enter' },
appearance = {
-- Sets the fallback highlight groups to nvim-cmp's highlight groups
-- Useful for when your theme doesn't support blink.cmp
-- Will be removed in a future release
use_nvim_cmp_as_default = true,
-- Set to 'mono' for 'Nerd Font Mono' or 'normal' for 'Nerd Font'
-- Adjusts spacing to ensure icons are aligned
nerd_font_variant = 'mono'
},
-- Default list of enabled providers defined so that you can extend it
-- elsewhere in your config, without redefining it, due to `opts_extend`
sources = {
default = { 'lsp', 'path', 'snippets', 'buffer' },
},
},
opts_extend = { "sources.default" }
},
{
"hrsh7th/nvim-cmp",
enabled = false,
event = "InsertEnter",
dependencies = {
"hrsh7th/cmp-nvim-lsp",
@ -8,22 +48,6 @@ return {
"hrsh7th/cmp-emoji",
"hrsh7th/cmp-buffer",
"saadparwaiz1/cmp_luasnip",
-- {
-- "zbirenbaum/copilot-cmp",
-- dependencies = "copilot.lua",
-- opts = {},
-- config = function(_, opts)
-- local copilot_cmp = require("copilot_cmp")
-- copilot_cmp.setup(opts)
-- -- attach cmp source whenever copilot attaches
-- -- fixes lazy-loading issues with the copilot cmp source
-- require("lazyvim.utils").on_attach(function(client)
-- if client.name == "copilot" then
-- copilot_cmp._on_insert_enter({})
-- end
-- end)
-- end,
-- },
},
config = function()
local cmp = require("cmp")
@ -70,20 +94,4 @@ return {
})
end,
},
-- {
-- "zbirenbaum/copilot-cmp",
-- dependencies = "copilot.lua",
-- opts = {},
-- config = function(_, opts)
-- local copilot_cmp = require("copilot_cmp")
-- copilot_cmp.setup(opts)
-- -- attach cmp source whenever copilot attaches
-- -- fixes lazy-loading issues with the copilot cmp source
-- require("lazyvim.utils").on_attach(function(client)
-- if client.name == "copilot" then
-- copilot_cmp._on_insert_enter({})
-- end
-- end)
-- end,
-- }
}

View File

@ -1,43 +1,43 @@
return {
{
"sainnhe/gruvbox-material",
lazy = true,
priority = 1000,
},
{
"ellisonleao/gruvbox.nvim",
lazy = true,
priority = 1000,
},
{
"sainnhe/sonokai",
lazy = true,
priority = 1000,
},
{
"dracula/vim",
lazy = true,
priority = 1000,
},
{
"folke/tokyonight.nvim",
lazy = true,
priority = 1000,
},
{
"echasnovski/mini.base16",
lazy = false,
priority = 1000,
},
{
"chriskempson/base16-vim",
lazy = false,
priority = 1000,
},
{
"NvChad/nvim-colorizer.lua",
opts = function()
require("colorizer").setup({})
end,
},
{
"sainnhe/gruvbox-material",
lazy = true,
priority = 1000,
},
{
"ellisonleao/gruvbox.nvim",
lazy = true,
priority = 1000,
},
{
"sainnhe/sonokai",
lazy = true,
priority = 1000,
},
{
"dracula/vim",
lazy = true,
priority = 1000,
},
{
"folke/tokyonight.nvim",
lazy = true,
priority = 1000,
},
{
"echasnovski/mini.base16",
lazy = false,
priority = 1000,
},
{
"chriskempson/base16-vim",
lazy = false,
priority = 1000,
},
{
"NvChad/nvim-colorizer.lua",
opts = function()
require("colorizer").setup({})
end,
},
}

View File

@ -1,24 +1,25 @@
return {
-- {
-- "zbirenbaum/copilot.lua",
-- event = "VeryLazy",
-- build = ":Copilot auth",
-- opts = {
-- suggestion = {
-- enabled = true,
-- auto_trigger = true,
-- keymap = {
-- accept = "<C-c>l",
-- next = "<C-c>]",
-- prev = "<C-c>[",
-- dismiss = "<C-c>x",
-- },
-- },
-- panel = { enabled = true },
-- filetypes = {
-- markdown = true,
-- help = true,
-- },
-- },
-- }
{
"zbirenbaum/copilot.lua",
enabled = false,
event = "VeryLazy",
build = ":Copilot auth",
opts = {
suggestion = {
enabled = true,
auto_trigger = true,
keymap = {
accept = "<C-c>l",
next = "<C-c>]",
prev = "<C-c>[",
dismiss = "<C-c>x",
},
},
panel = { enabled = true },
filetypes = {
markdown = true,
help = true,
},
},
}
}

View File

@ -1,22 +1,22 @@
return {
{
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
opts = {
signs = {
add = { text = "a" },
change = { text = "c" },
delete = { text = "d" },
topdelete = { text = "td" },
changedelete = { text = "cd" },
untracked = { text = "u" },
},
on_attach = function(buffer)
local gs = package.loaded.gitsigns
{
"lewis6991/gitsigns.nvim",
event = "BufReadPre",
opts = {
signs = {
add = { text = "a" },
change = { text = "c" },
delete = { text = "d" },
topdelete = { text = "td" },
changedelete = { text = "cd" },
untracked = { text = "u" },
},
on_attach = function(buffer)
local gs = package.loaded.gitsigns
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end
local function map(mode, l, r, desc)
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
end
-- stylua: ignore start
map("n", "]h", gs.prev_hunk, "Next Hunk")
@ -31,11 +31,11 @@ return {
map("n", "<leader>ghd", gs.diffthis, "Diff This")
map("n", "<leader>ghD", function() gs.diffthis("~") end, "Diff This ~")
map({ "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>", "GitSigns Select Hunk")
end,
},
},
{
"f-person/git-blame.nvim",
event = "BufEnter",
},
end,
},
},
{
"f-person/git-blame.nvim",
event = "BufEnter",
},
}

View File

@ -1,16 +1,16 @@
return {
-- {
-- "ray-x/go.nvim",
-- requires = {
-- "ray-x/guihua.lua",
-- "neovim/nvim-lspconfig",
-- "nvim-treesitter/nvim-treesitter",
-- },
-- config = function()
-- require("go").setup()
-- end,
-- event = { "CmdlineEnter" },
-- ft = { "go", "gomod" },
-- build = ':lua require("go.install").update_all_sync()',
-- },
{
"ray-x/go.nvim",
requires = {
"ray-x/guihua.lua",
"neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("go").setup()
end,
event = { "CmdlineEnter" },
ft = { "go", "gomod" },
build = ':lua require("go.install").update_all_sync()',
},
}

View File

@ -3,37 +3,35 @@ local M = {}
M.autoformat = true
function M.toggle()
M.autoformat = not M.autoformat
vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save")
M.autoformat = not M.autoformat
vim.notify(M.autoformat and "Enabled format on save" or "Disabled format on save")
end
function M.format()
-- TODO: work out how to call conform it it has a formatter and default
-- to vim.lsp.buf.format()
-- TODO: work out how to call conform if it has a formatter and default
-- to vim.lsp.buf.format()
vim.lsp.buf.format()
vim.lsp.buf.format()
-- local ok, conform = pcall(require, "conform")
--
-- if ok then
-- conform.format()
-- else
-- vim.lsp.buf.format()
-- end
if require("lazy.core.config").plugins["conform.nvim"]._.loaded then
require("conform.nvim").format()
else
vim.lsp.buf.format()
end
end
function M.on_attach(client, buf)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormat." .. buf, {}),
buffer = buf,
callback = function()
if M.autoformat then
M.format()
end
end,
})
end
if client.supports_method("textDocument/formatting") then
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("LspFormat." .. buf, {}),
buffer = buf,
callback = function()
if M.autoformat then
M.format()
end
end,
})
end
end
return M

View File

@ -4,10 +4,20 @@ return {
"neovim/nvim-lspconfig",
event = "BufReadPre",
dependencies = {
{ "folke/neoconf.nvim", cmd = "Neoconf", config = true },
{
"folke/lazydev.nvim",
ft = "lua", -- only load on lua files
opts = {
library = {
-- See the configuration section for more details
-- Load luvit types when the `vim.uv` word is found
{ path = "${3rd}/luv/library", words = { "vim%.uv" } },
},
},
},
"mason.nvim",
"williamboman/mason-lspconfig.nvim",
"hrsh7th/cmp-nvim-lsp",
-- "hrsh7th/cmp-nvim-lsp",
},
opts = {
-- options for vim.diagnostic.config()
@ -109,7 +119,8 @@ return {
"force",
{},
vim.lsp.protocol.make_client_capabilities(),
require("cmp_nvim_lsp").default_capabilities(),
-- require("cmp_nvim_lsp").default_capabilities(),
require("blink.cmp").get_lsp_capabilities(),
opts.capabilities or {}
)

View File

@ -23,7 +23,6 @@ function M.on_attach(client, buffer)
local format = require("lazyvim.plugins.lsp.format").format
self:map("<leader>lf", format, { desc = "Format Document", has = "documentFormatting" })
self:map("<leader>lF", format, { desc = "Format Range", mode = "v", has = "documentRangeFormatting" })
self:map("<leader>lr", M.rename, { expr = true, desc = "Rename", has = "rename" })
if client.name == "tsserver" and pcall(require, "typescript") then

View File

@ -3,6 +3,7 @@ local util = require("lazyvim.utils")
return {
{
"nvim-neo-tree/neo-tree.nvim",
enabled = false,
branch = "v3.x",
cmd = "Neotree",
keys = {

View File

@ -1,130 +1,131 @@
return {
-- {
-- "kyazdani42/nvim-tree.lua",
-- cmd = "NvimTreeToggle",
-- config = function()
-- local nvim_tree = require("nvim-tree")
-- local icons = require("lazyvim.config.icons")
--
-- local function edit_or_open()
-- -- open as vsplit on current node
-- local action = "edit"
-- local node = lib.get_node_at_cursor()
--
-- -- Just copy what's done normally with vsplit
-- if node.link_to and not node.nodes then
-- require("nvim-tree.actions.node.open-file").fn(action, node.link_to)
-- view.close() -- Close the tree if file was opened
-- elseif node.nodes ~= nil then
-- lib.expand_or_collapse(node)
-- else
-- require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path)
-- view.close() -- Close the tree if file was opened
-- end
-- end
--
-- nvim_tree.setup({
-- hijack_directories = {
-- enable = false,
-- },
-- ignore_ft_on_setup = {
-- "alpha",
-- },
-- filters = {
-- custom = { ".git" },
-- exclude = { ".gitignore" },
-- },
-- hijack_cursor = false,
-- update_cwd = true,
-- renderer = {
-- add_trailing = false,
-- group_empty = false,
-- highlight_git = false,
-- highlight_opened_files = "none",
-- root_folder_modifier = ":t",
-- indent_markers = {
-- enable = false,
-- icons = {
-- corner = "└ ",
-- edge = "│ ",
-- none = " ",
-- },
-- },
-- icons = {
-- webdev_colors = true,
-- git_placement = "before",
-- padding = " ",
-- symlink_arrow = " ➛ ",
-- show = {
-- file = true,
-- folder = true,
-- folder_arrow = true,
-- git = true,
-- },
-- glyphs = {
-- default = "",
-- symlink = "",
-- folder = {
-- arrow_open = icons.ui.ArrowOpen,
-- arrow_closed = icons.ui.ArrowClosed,
-- default = "",
-- open = "",
-- empty = "",
-- empty_open = "",
-- symlink = "",
-- symlink_open = "",
-- },
-- git = {
-- unstaged = "",
-- staged = "S",
-- unmerged = "",
-- renamed = "➜",
-- untracked = "U",
-- deleted = "",
-- ignored = "◌",
-- },
-- },
-- },
-- },
-- diagnostics = {
-- enable = true,
-- icons = {
-- hint = icons.diagnostics.Hint,
-- info = icons.diagnostics.Information,
-- warning = icons.diagnostics.Warning,
-- error = icons.diagnostics.Error,
-- },
-- },
-- update_focused_file = {
-- enable = true,
-- update_cwd = true,
-- ignore_list = {},
-- },
-- git = {
-- enable = true,
-- ignore = true,
-- timeout = 500,
-- },
-- view = {
-- width = 30,
-- hide_root_folder = false,
-- side = "left",
-- number = false,
-- relativenumber = false,
-- mappings = {
-- custom_only = false,
-- list = {
-- { key = "l", action = "edit", action_cb = edit_or_open },
-- { key = "h", action = "close_node" },
-- },
-- },
-- },
-- actions = {
-- open_file = {
-- quit_on_open = true,
-- },
-- },
-- })
-- end,
-- },
{
"kyazdani42/nvim-tree.lua",
enabled = false,
cmd = "NvimTreeToggle",
config = function()
local nvim_tree = require("nvim-tree")
local icons = require("lazyvim.config.icons")
local function edit_or_open()
-- open as vsplit on current node
local action = "edit"
local node = lib.get_node_at_cursor()
-- Just copy what's done normally with vsplit
if node.link_to and not node.nodes then
require("nvim-tree.actions.node.open-file").fn(action, node.link_to)
view.close() -- Close the tree if file was opened
elseif node.nodes ~= nil then
lib.expand_or_collapse(node)
else
require("nvim-tree.actions.node.open-file").fn(action, node.absolute_path)
view.close() -- Close the tree if file was opened
end
end
nvim_tree.setup({
hijack_directories = {
enable = false,
},
ignore_ft_on_setup = {
"alpha",
},
filters = {
custom = { ".git" },
exclude = { ".gitignore" },
},
hijack_cursor = false,
update_cwd = true,
renderer = {
add_trailing = false,
group_empty = false,
highlight_git = false,
highlight_opened_files = "none",
root_folder_modifier = ":t",
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
none = " ",
},
},
icons = {
webdev_colors = true,
git_placement = "before",
padding = " ",
symlink_arrow = "",
show = {
file = true,
folder = true,
folder_arrow = true,
git = true,
},
glyphs = {
default = "",
symlink = "",
folder = {
arrow_open = icons.ui.ArrowOpen,
arrow_closed = icons.ui.ArrowClosed,
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = "",
},
git = {
unstaged = "",
staged = "S",
unmerged = "",
renamed = "",
untracked = "U",
deleted = "",
ignored = "",
},
},
},
},
diagnostics = {
enable = true,
icons = {
hint = icons.diagnostics.Hint,
info = icons.diagnostics.Information,
warning = icons.diagnostics.Warning,
error = icons.diagnostics.Error,
},
},
update_focused_file = {
enable = true,
update_cwd = true,
ignore_list = {},
},
git = {
enable = true,
ignore = true,
timeout = 500,
},
view = {
width = 30,
hide_root_folder = false,
side = "left",
number = false,
relativenumber = false,
mappings = {
custom_only = false,
list = {
{ key = "l", action = "edit", action_cb = edit_or_open },
{ key = "h", action = "close_node" },
},
},
},
actions = {
open_file = {
quit_on_open = true,
},
},
})
end,
},
}

View File

@ -1,12 +1,13 @@
return {
-- {
-- "ahmedkhalf/project.nvim",
-- lazy = false,
-- opts = {
-- manual_mode = true,
-- },
-- config = function(opts)
-- require("project_nvim").setup(opts)
-- end,
-- },
{
"ahmedkhalf/project.nvim",
enabled = false,
lazy = false,
opts = {
manual_mode = true,
},
config = function(opts)
require("project_nvim").setup(opts)
end,
},
}

View File

@ -1,11 +1,12 @@
return {
-- {
-- "windwp/nvim-spectre",
-- -- stylua: ignore
-- keys = {
-- { "<leader>rr", function() require("spectre").open() end, desc = "Replace in files" },
-- { "<leader>rw", function() require("spectre").open_visual({ select_word = true }) end, desc = "Relpace Word" },
-- { "<leader>rb", function() require("spectre").open_file_search() end, desc = "Relpace in Buffer" },
-- },
-- },
{
"windwp/nvim-spectre",
enabled = false,
-- stylua: ignore
keys = {
{ "<leader>rr", function() require("spectre").open() end, desc = "Replace in files" },
{ "<leader>rw", function() require("spectre").open_visual({ select_word = true }) end, desc = "Relpace Word" },
{ "<leader>rb", function() require("spectre").open_file_search() end, desc = "Relpace in Buffer" },
},
},
}

View File

@ -24,7 +24,6 @@ return {
{ "<leader>ht", "<cmd>Telescope builtin<cr>", desc = "Telescope" },
{ "<leader>sb", "<cmd>Telescope current_buffer_fuzzy_find<cr>", desc = "Telescope Buffer" },
{ "<leader>sc", "<cmd>Telescope command_history<cr>", desc = "Telescope Command History" },
{ "<leader>sG", util.telescope("live_grep"), desc = "Telescope Grep (root dir)" },
{ "<leader>sg", util.telescope("live_grep", { cwd = false }), desc = "Telescope Grep (cwd)" },
{ "<leader>sm", "<cmd>Telescope marks<cr>", desc = "Telescope Jump to Mark" },
{ "<leader>so", "<cmd>Telescope resume<cr>", desc = "Telescope Resume last search" },
@ -80,5 +79,8 @@ return {
},
},
},
config = function()
require "lazyvim.utils.telescope.multigrep".setup()
end,
},
}

View File

@ -2,6 +2,14 @@ return {
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
enable = true,
disable = function(lang, buf)
local max_filesize = 100 * 1024 -- 100 KB
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
if ok and stats and stats.size > max_filesize then
return true
end
end,
dependencies = {
"treesitter-context",
},

View File

@ -19,35 +19,36 @@ return {
{
"nvim-lua/popup.nvim",
},
-- {
-- "rcarriga/nvim-notify",
-- opts = {
-- -- Animation style (see below for details)
-- stages = "static",
--
-- -- Render function for notifications. See notify-render()
-- render = "default",
--
-- -- Default timeout for notifications
-- timeout = 2000,
--
-- -- For stages that change opacity this is treated as the highlight behind the window
-- -- Set this to either a highlight group or an RGB hex value e.g. "#000000"
-- background_colour = "Normal",
--
-- -- Minimum width for notification windows
-- minimum_width = 10,
--
-- -- Icons for the different levels
-- icons = {
-- ERROR = icons.diagnostics.Error,
-- WARN = icons.diagnostics.Warning,
-- INFO = icons.diagnostics.Information,
-- DEBUG = icons.ui.Bug,
-- TRACE = icons.ui.Pencil,
-- },
-- },
-- },
{
"rcarriga/nvim-notify",
enabled = false,
opts = {
-- Animation style (see below for details)
stages = "static",
-- Render function for notifications. See notify-render()
render = "default",
-- Default timeout for notifications
timeout = 2000,
-- For stages that change opacity this is treated as the highlight behind the window
-- Set this to either a highlight group or an RGB hex value e.g. "#000000"
background_colour = "Normal",
-- Minimum width for notification windows
minimum_width = 10,
-- Icons for the different levels
icons = {
ERROR = icons.diagnostics.Error,
WARN = icons.diagnostics.Warning,
INFO = icons.diagnostics.Information,
DEBUG = icons.ui.Bug,
TRACE = icons.ui.Pencil,
},
},
},
{
"echasnovski/mini.bufremove",
event = "VeryLazy",
@ -57,38 +58,39 @@ return {
{ "<leader>bD", function() require("mini.bufremove").delete(0, true) end, desc = "Delete Buffer (Force)" },
},
},
-- {
-- "ghillb/cybu.nvim",
-- event = "VeryLazy",
-- keys = {
-- { "<leader>bl", "<cmd>CybuNext<cr>", desc = "Next Buffer" },
-- { "<leader>bh", "<cmd>CybuPrev<cr>", desc = "Prev Buffer" },
-- },
-- opts = {
-- position = {
-- relative_to = "win", -- win, editor, cursor
-- anchor = "topright", -- topleft, topcenter, topright,
-- -- centerleft, center, centerright,
-- -- bottomleft, bottomcenter, bottomright
-- -- vertical_offset = 10, -- vertical offset from anchor in lines
-- -- horizontal_offset = 0, -- vertical offset from anchor in columns
-- -- max_win_height = 5, -- height of cybu window in lines
-- -- max_win_width = 0.5, -- integer for absolute in columns
-- -- float for relative to win/editor width
-- },
-- display_time = 1750, -- time the cybu window is displayed
-- style = {
-- separator = " ", -- string used as separator
-- prefix = "…", -- string used as prefix for truncated paths
-- padding = 1, -- left & right padding in number of spaces
-- hide_buffer_id = true,
-- devicons = {
-- enabled = true, -- enable or disable web dev icons
-- colored = true, -- enable color for web dev icons
-- },
-- },
-- },
-- },
{
"ghillb/cybu.nvim",
enabled = false,
event = "VeryLazy",
keys = {
{ "<leader>bl", "<cmd>CybuNext<cr>", desc = "Next Buffer" },
{ "<leader>bh", "<cmd>CybuPrev<cr>", desc = "Prev Buffer" },
},
opts = {
position = {
relative_to = "win", -- win, editor, cursor
anchor = "topright", -- topleft, topcenter, topright,
-- centerleft, center, centerright,
-- bottomleft, bottomcenter, bottomright
-- vertical_offset = 10, -- vertical offset from anchor in lines
-- horizontal_offset = 0, -- vertical offset from anchor in columns
-- max_win_height = 5, -- height of cybu window in lines
-- max_win_width = 0.5, -- integer for absolute in columns
-- float for relative to win/editor width
},
display_time = 1750, -- time the cybu window is displayed
style = {
separator = " ", -- string used as separator
prefix = "", -- string used as prefix for truncated paths
padding = 1, -- left & right padding in number of spaces
hide_buffer_id = true,
devicons = {
enabled = true, -- enable or disable web dev icons
colored = true, -- enable color for web dev icons
},
},
},
},
{
"mbbill/undotree",
cmd = { "UndotreeToggle" },
@ -103,17 +105,18 @@ return {
"lukas-reineke/indent-blankline.nvim",
opts = {},
},
-- {
-- "windwp/nvim-autopairs",
-- event = "VeryLazy",
-- opts = {
-- disable_filetype = { "TelescopePrompt", "spectre_panel" },
-- ignored_next_char = "[%w%.*]", -- don't place autopairs when cursor sits infront of any character.
-- },
-- config = function(_, opts)
-- require("nvim-autopairs").setup(opts)
-- end,
-- },
{
"windwp/nvim-autopairs",
enabled = false,
event = "VeryLazy",
opts = {
disable_filetype = { "TelescopePrompt", "spectre_panel" },
ignored_next_char = "[%w%.*]", -- don't place autopairs when cursor sits infront of any character.
},
config = function(_, opts)
require("nvim-autopairs").setup(opts)
end,
},
{
"preservim/vim-markdown",
},

View File

@ -138,9 +138,9 @@ return {
whichkey.add({
mode = { "n", "v" },
{ "<leader>l", group = "lsp" },
{ "<leader>ll", "<cmd>lopen<cr>", desc = "Open Location List" },
{ "<leader>lq", "<cmd>copen<cr>", desc = "Open Quickfix List" },
{ "<leader>lx", "<cmd>cclose<cr>", desc = "Close Quickfix List" },
{ "<leader>ll", "<cmd>lopen<cr>", desc = "Open Location List" },
{ "<leader>lq", "<cmd>copen<cr>", desc = "Open Quickfix List" },
{ "<leader>lx", function() vim.diagnostic.setqflist() end, desc = "Open Quickfix List" },
})
-- C = {

View File

@ -2,6 +2,10 @@ local M = {}
M.root_patterns = { ".git", "/lua" }
function M.setup()
require "lazyvim.utils.term"
end
---@param on_attach fun(client, buffer)
function M.on_attach(on_attach)
vim.api.nvim_create_autocmd("LspAttach", {