chore: clean up and reformat
feat: remove unused bindings
This commit is contained in:
parent
27b5fa5676
commit
105d6cf2ea
11 changed files with 322 additions and 334 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
-- Remove trailing whitespace on save
|
||||||
-- vim.api.nvim_create_autocmd({"BufWritePre"}, {
|
-- vim.api.nvim_create_autocmd({"BufWritePre"}, {
|
||||||
-- group = vim.api.nvim_create_augroup("Default", {}),
|
-- group = vim.api.nvim_create_augroup("Default", {}),
|
||||||
-- pattern = "*",
|
-- pattern = "*",
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ vim.keymap.set("n", "<C-j>", "<cmd>cnext<CR>zz")
|
||||||
vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
|
vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
|
||||||
|
|
||||||
-- Copy to system clipboard
|
-- Copy to system clipboard
|
||||||
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
|
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||||
|
|
||||||
-- Escape terminal mode
|
-- Escape terminal mode
|
||||||
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
|
vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
|
||||||
|
|
@ -20,11 +20,7 @@ vim.keymap.set("t", "<Esc>", "<C-\\><C-n>")
|
||||||
vim.keymap.set("n", "<leader>bd", "<cmd>bd<CR>")
|
vim.keymap.set("n", "<leader>bd", "<cmd>bd<CR>")
|
||||||
|
|
||||||
-- Thanks to Mr. Primeagen
|
-- Thanks to Mr. Primeagen
|
||||||
vim.keymap.set({"n", "v"}, "<C-f>", "<cmd>silent !tmux neww tmux-sessionizer<CR>")
|
vim.keymap.set({ "n", "v" }, "<C-f>", "<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>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||||
|
|
||||||
-- Typing too fast...
|
|
||||||
vim.keymap.set("n", "q:", ":q<CR>")
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ vim.opt.incsearch = true
|
||||||
|
|
||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
|
|
||||||
|
vim.opt.guicursor = "n-v-i-c-ci-ve-sm:block,r-cr-o:hor20"
|
||||||
|
|
||||||
vim.opt.scrolloff = 8
|
vim.opt.scrolloff = 8
|
||||||
vim.opt.sidescrolloff = 16
|
vim.opt.sidescrolloff = 16
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,17 @@
|
||||||
-- Boostrap Lazy.nvim
|
-- Boostrap Lazy.nvim
|
||||||
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({
|
||||||
"git",
|
"git",
|
||||||
"clone",
|
"clone",
|
||||||
"--filter=blob:none",
|
"--filter=blob:none",
|
||||||
"https://github.com/folke/lazy.nvim.git",
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
"--branch=stable", -- latest stable release
|
"--branch=stable", -- latest stable release
|
||||||
lazypath,
|
lazypath,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
require("lazy").setup({{ import = "plugins" }})
|
require("lazy").setup({ { import = "plugins" } })
|
||||||
|
|
||||||
vim.cmd([[colorscheme peel-enhanced]])
|
vim.cmd([[colorscheme peel-enhanced]])
|
||||||
|
|
|
||||||
|
|
@ -1,67 +1,67 @@
|
||||||
return {
|
return {
|
||||||
-- Autocomplete
|
-- Autocomplete
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
version = false,
|
version = false,
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer",
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
},
|
},
|
||||||
opts = function()
|
opts = function()
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
local defaults = require("cmp.config.default")()
|
local defaults = require("cmp.config.default")()
|
||||||
local cmp_format = require("lsp-zero").cmp_format()
|
local cmp_format = require("lsp-zero").cmp_format()
|
||||||
return {
|
return {
|
||||||
completion = {
|
completion = {
|
||||||
completeopt = "menu,menuone,noinsert",
|
completeopt = "menu,menuone,noinsert",
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-Space>"] = cmp.mapping.complete(),
|
["<C-Space>"] = cmp.mapping.complete(),
|
||||||
["<C-e>"] = cmp.mapping.abort(),
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
["<S-CR>"] = cmp.mapping.confirm({
|
["<S-CR>"] = cmp.mapping.confirm({
|
||||||
behavior = cmp.ConfirmBehavior.Replace,
|
behavior = cmp.ConfirmBehavior.Replace,
|
||||||
select = true,
|
select = true,
|
||||||
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
}), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
["<C-CR>"] = function(fallback)
|
["<C-CR>"] = function(fallback)
|
||||||
cmp.abort()
|
cmp.abort()
|
||||||
fallback()
|
fallback()
|
||||||
end,
|
end,
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
{ name = "path" },
|
{ name = "path" },
|
||||||
}, {
|
}, {
|
||||||
{ name = "buffer" },
|
{ name = "buffer" },
|
||||||
}),
|
}),
|
||||||
sorting = defaults.sorting,
|
sorting = defaults.sorting,
|
||||||
formatting = cmp_format,
|
formatting = cmp_format,
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("cmp").setup(opts)
|
require("cmp").setup(opts)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
-- Copilot
|
-- Copilot
|
||||||
{ 'github/copilot.vim' },
|
{ "github/copilot.vim" },
|
||||||
-- Comment
|
-- Comment
|
||||||
{
|
{
|
||||||
'numToStr/Comment.nvim',
|
"numToStr/Comment.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
-- add any options here
|
-- add any options here
|
||||||
},
|
},
|
||||||
lazy = false,
|
lazy = false,
|
||||||
config = function ()
|
config = function()
|
||||||
require("Comment").setup()
|
require("Comment").setup()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
-- Surround
|
-- Surround
|
||||||
{ 'tpope/vim-surround', event = "BufRead", },
|
{ "tpope/vim-surround", event = "BufRead", },
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,33 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"folke/which-key.nvim",
|
"folke/which-key.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
opts = { },
|
opts = {},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>wk', '<cmd>WhichKey<CR>', desc = 'Show key mappings' },
|
{ '<leader>wk', '<cmd>WhichKey<CR>', desc = 'Show key mappings' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"folke/trouble.nvim",
|
"folke/trouble.nvim",
|
||||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||||
opts = {},
|
opts = {},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>xx', '<cmd>TroubleToggle workspace_diagnostics<CR>', desc = 'Trouble Workspace Diagnostics' },
|
{ "<leader>xx", "<cmd>TroubleToggle workspace_diagnostics<CR>", desc = "Trouble Workspace Diagnostics" },
|
||||||
{ '<leader>xd', '<cmd>TroubleToggle document_diagnostics<CR>', desc = 'Trouble Document Diagnostics' },
|
{ "<leader>xd", "<cmd>TroubleToggle document_diagnostics<CR>", desc = "Trouble Document Diagnostics" },
|
||||||
{ '<leader>xl', '<cmd>TroubleToggle loclist<CR>', desc = 'Trouble Loclist' },
|
{ "<leader>xl", "<cmd>TroubleToggle loclist<CR>", desc = "Trouble Loclist" },
|
||||||
{ '<leader>xq', '<cmd>TroubleToggle quickfix<CR>', desc = 'Trouble Quickfix' },
|
{ "<leader>xq", "<cmd>TroubleToggle quickfix<CR>", desc = "Trouble Quickfix" },
|
||||||
{ '<leader>xt', '<cmd>TroubleToggle lsp_references<CR>', desc = 'Trouble LSP References' },
|
{ "<leader>xt", "<cmd>TroubleToggle lsp_references<CR>", desc = "Trouble LSP References" },
|
||||||
{ '<leader>xj', function() require("trouble").next({skip_groups = true, jump = true}) end, desc = 'Trouble Next' },
|
{ "<leader>xj", function() require("trouble").next({ skip_groups = true, jump = true }) end, desc = "Trouble Next" },
|
||||||
{ '<leader>xk', function() require("trouble").previous({skip_groups = true, jump = true}) end, desc = 'Trouble Previous' },
|
{ "<leader>xk", function() require("trouble").previous({ skip_groups = true, jump = true }) end, desc = "Trouble Previous" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ 'wsdjeg/vim-fetch', event = "VeryLazy" },
|
{ "wsdjeg/vim-fetch", event = "VeryLazy" },
|
||||||
{ 'nvim-tree/nvim-web-devicons' },
|
{ "nvim-tree/nvim-web-devicons" },
|
||||||
{
|
{
|
||||||
'eandrju/cellular-automaton.nvim',
|
"eandrju/cellular-automaton.nvim",
|
||||||
event = "VeryLazy",
|
event = "VeryLazy",
|
||||||
keys = {
|
keys = {
|
||||||
{ '<leader>mr', '<cmd>CellularAutomaton make_it_rain<CR>', desc = 'Make it rain' },
|
{ "<leader>mr", "<cmd>CellularAutomaton make_it_rain<CR>", desc = "Make it rain" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,59 +1,50 @@
|
||||||
return {
|
return {
|
||||||
-- Fugitive
|
-- Fugitive
|
||||||
{
|
{
|
||||||
"tpope/vim-fugitive",
|
"tpope/vim-fugitive",
|
||||||
event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" },
|
event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" },
|
||||||
config = function()
|
config = function()
|
||||||
local function map(mode, l, r, desc)
|
local function map(mode, l, r, desc)
|
||||||
vim.keymap.set(mode, l, r, { silent = true, noremap = true, desc = desc })
|
vim.keymap.set(mode, l, r, { silent = true, noremap = true, desc = desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
map("n", "<leader>gs", "<cmd>Git<CR>", "Git Status")
|
map("n", "<leader>gd", "<cmd>Gvdiffsplit!<CR>", "Git Diff")
|
||||||
map("n", "<leader>gd", "<cmd>Gvdiffsplit!<CR>", "Git Diff")
|
map("n", "<leader>gl", "<cmd>Git blame -w -C -C -C<CR>", "Git Blame")
|
||||||
map("n", "<leader>gbl", "<cmd>Git blame<CR>", "Git Blame")
|
map("n", "<leader>gS", "<cmd>Git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)<CR>",
|
||||||
map("n", "<leader>gc", "<cmd>Git commit<CR>", "Git Commit")
|
"Git Push Set Upstream")
|
||||||
map("n", "<leader>gC", "<cmd>Git commit --amend<CR>", "Git Commit Amend")
|
map("n", "<leader>gbs", "<cmd>Git bisect start<CR>", "Git Bisect Start")
|
||||||
map("n", "<leader>gp", "<cmd>Git push<CR>", "Git Push")
|
map("n", "<leader>gbg", "<cmd>Git bisect good<CR>", "Git Bisect Good")
|
||||||
map("n", "<leader>gS", "<cmd>Git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)<CR>", "Git Push Set Upstream")
|
map("n", "<leader>gbb", "<cmd>Git bisect bad<CR>", "Git Bisect Bad")
|
||||||
map("n", "<leader>gbs", "<cmd>Git bisect start<CR>", "Git Bisect Start")
|
map("n", "<leader>gbr", "<cmd>Git bisect reset<CR>", "Git Bisect Reset")
|
||||||
map("n", "<leader>gbg", "<cmd>Git bisect good<CR>", "Git Bisect Good")
|
end
|
||||||
map("n", "<leader>gbb", "<cmd>Git bisect bad<CR>", "Git Bisect Bad")
|
},
|
||||||
map("n", "<leader>gbr", "<cmd>Git bisect reset<CR>", "Git Bisect Reset")
|
-- Gitsigns
|
||||||
end
|
{
|
||||||
},
|
"lewis6991/gitsigns.nvim",
|
||||||
-- Gitsigns
|
event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" },
|
||||||
{
|
opts = {
|
||||||
"lewis6991/gitsigns.nvim",
|
signs = {
|
||||||
event = { "BufReadPost", "BufNewFile", "BufWritePre", "VeryLazy" },
|
add = { text = "▎" },
|
||||||
opts = {
|
change = { text = "▎" },
|
||||||
signs = {
|
delete = { text = "" },
|
||||||
add = { text = "▎" },
|
topdelete = { text = "" },
|
||||||
change = { text = "▎" },
|
changedelete = { text = "▎" },
|
||||||
delete = { text = "" },
|
untracked = { text = "▎" },
|
||||||
topdelete = { text = "" },
|
},
|
||||||
changedelete = { text = "▎" },
|
on_attach = function(buffer)
|
||||||
untracked = { text = "▎" },
|
local gs = package.loaded.gitsigns
|
||||||
},
|
|
||||||
on_attach = function(buffer)
|
|
||||||
local gs = package.loaded.gitsigns
|
|
||||||
|
|
||||||
local function map(mode, l, r, desc)
|
local function map(mode, l, r, desc)
|
||||||
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
|
vim.keymap.set(mode, l, r, { buffer = buffer, desc = desc })
|
||||||
end
|
end
|
||||||
|
|
||||||
map("n", "]h", gs.next_hunk, "Next Hunk")
|
map("n", "]h", gs.next_hunk, "Next Hunk")
|
||||||
map("n", "[h", gs.prev_hunk, "Prev Hunk")
|
map("n", "[h", gs.prev_hunk, "Prev Hunk")
|
||||||
map({ "n", "v" }, "<leader>ghs", "<cmd>Gitsigns stage_hunk<CR>", "Stage Hunk")
|
map({ "n", "v" }, "<leader>ghr", "<cmd>Gitsigns reset_hunk<CR>", "Reset Hunk")
|
||||||
map({ "n", "v" }, "<leader>ghr", "<cmd>Gitsigns reset_hunk<CR>", "Reset Hunk")
|
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
|
||||||
map("n", "<leader>ghS", gs.stage_buffer, "Stage Buffer")
|
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
|
||||||
map("n", "<leader>ghu", gs.undo_stage_hunk, "Undo Stage Hunk")
|
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
|
||||||
map("n", "<leader>ghR", gs.reset_buffer, "Reset Buffer")
|
end,
|
||||||
map("n", "<leader>ghp", gs.preview_hunk, "Preview Hunk")
|
},
|
||||||
map("n", "<leader>ghb", function() gs.blame_line({ full = true }) end, "Blame Line")
|
},
|
||||||
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,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,30 @@
|
||||||
return {
|
return {
|
||||||
-- LSP
|
-- LSP
|
||||||
{
|
{
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
"VonHeikemen/lsp-zero.nvim",
|
||||||
config = function()
|
config = function()
|
||||||
require("plugins.lsp.config")
|
require("plugins.lsp.config")
|
||||||
end,
|
end,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "neovim/nvim-lspconfig" },
|
{ "neovim/nvim-lspconfig" },
|
||||||
{ "williamboman/mason-lspconfig.nvim" },
|
{ "williamboman/mason-lspconfig.nvim" },
|
||||||
{ "folke/neodev.nvim" },
|
{ "folke/neodev.nvim" },
|
||||||
{ "hrsh7th/nvim-cmp" },
|
{ "hrsh7th/nvim-cmp" },
|
||||||
{ "hrsh7th/cmp-buffer" },
|
{ "hrsh7th/cmp-buffer" },
|
||||||
{ "hrsh7th/cmp-path" },
|
{ "hrsh7th/cmp-path" },
|
||||||
{ "saadparwaiz1/cmp_luasnip" },
|
{ "saadparwaiz1/cmp_luasnip" },
|
||||||
{ "hrsh7th/cmp-nvim-lsp" },
|
{ "hrsh7th/cmp-nvim-lsp" },
|
||||||
{ "hrsh7th/cmp-nvim-lua" },
|
{ "hrsh7th/cmp-nvim-lua" },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
-- Mason
|
-- Mason
|
||||||
{
|
{
|
||||||
"williamboman/mason.nvim",
|
"williamboman/mason.nvim",
|
||||||
cmd = "Mason",
|
cmd = "Mason",
|
||||||
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
|
keys = { { "<leader>cm", "<cmd>Mason<cr>", desc = "Mason" } },
|
||||||
build = ":MasonUpdate",
|
build = ":MasonUpdate",
|
||||||
config = function (_, opts)
|
config = function(_, opts)
|
||||||
require("mason").setup(opts)
|
require("mason").setup(opts)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,69 +1,69 @@
|
||||||
local lsp_zero = require('lsp-zero')
|
local lsp_zero = require("lsp-zero")
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require("lspconfig")
|
||||||
|
|
||||||
lspconfig.lua_ls.setup({
|
lspconfig.lua_ls.setup({
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
globals = { 'vim' },
|
globals = { "vim" },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
lspconfig.eslint.setup({
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
|
buffer = bufnr,
|
||||||
|
command = "EslintFixAll",
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
lsp_zero.set_sign_icons({
|
lsp_zero.set_sign_icons({
|
||||||
error = '✘',
|
error = "✘",
|
||||||
warn = '▲',
|
warn = "▲",
|
||||||
hint = '⚑',
|
hint = "⚑",
|
||||||
info = ''
|
info = ""
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = true,
|
virtual_text = true,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
float = {
|
float = {
|
||||||
style = 'minimal',
|
style = "minimal",
|
||||||
border = 'none',
|
border = "none",
|
||||||
source = 'always',
|
source = "always",
|
||||||
header = '',
|
header = "",
|
||||||
prefix = '',
|
prefix = "",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
lsp_zero.on_attach(function(_, bufnr)
|
lsp_zero.on_attach(function(_, bufnr)
|
||||||
local opts = { buffer = bufnr, remap = false }
|
local opts = { buffer = bufnr, remap = false }
|
||||||
lsp_zero.default_keymaps({buffer = bufnr})
|
lsp_zero.default_keymaps({ buffer = bufnr })
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||||
pattern = { '*.tsx', '*.ts', '*.jsx', '*.js', '*.vue', '*.cjs', '*.mjs', '*.json', '*.css', '*.scss', '*.less', '*.yml', '*.svelte' },
|
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||||
command = 'silent! EslintFixAll',
|
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||||
group = vim.api.nvim_create_augroup('EslintAutocmdsFormatting', {}),
|
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||||
})
|
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>rr", function() vim.lsp.buf.references() end, opts)
|
||||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
||||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
vim.keymap.set("n", "<leader>D", function() vim.lsp.buf.type_definition() end, opts)
|
||||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
|
||||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
|
||||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>ca", function() vim.lsp.buf.code_action() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rr", function() vim.lsp.buf.references() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>rn", function() vim.lsp.buf.rename() end, opts)
|
|
||||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>ls", function() vim.lsp.buf.signature_help() end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>D", function() vim.lsp.buf.type_definition() end, opts)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
require('mason-lspconfig').setup({
|
require("mason-lspconfig").setup({
|
||||||
handlers = {
|
handlers = {
|
||||||
lsp_zero.default_setup,
|
lsp_zero.default_setup,
|
||||||
},
|
},
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'lua_ls',
|
"lua_ls",
|
||||||
'html',
|
"html",
|
||||||
'eslint',
|
"eslint",
|
||||||
'gopls',
|
"gopls",
|
||||||
'rust_analyzer',
|
"rust_analyzer",
|
||||||
'zls',
|
"zls",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,28 @@
|
||||||
return {
|
return {
|
||||||
'nvim-telescope/telescope.nvim',
|
"nvim-telescope/telescope.nvim",
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
version = false,
|
version = false,
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
{ 'nvim-lua/plenary.nvim' },
|
{ "nvim-lua/plenary.nvim" },
|
||||||
},
|
},
|
||||||
extensions = {
|
extensions = {
|
||||||
fzf = {
|
fzf = {
|
||||||
fuzzy = true, -- false will only do exact matching
|
fuzzy = true, -- false will only do exact matching
|
||||||
override_generic_sorter = true, -- override the generic sorter
|
override_generic_sorter = true, -- override the generic sorter
|
||||||
override_file_sorter = true, -- override the file sorter
|
override_file_sorter = true, -- override the file sorter
|
||||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ '<C-p>', "<cmd>Telescope find_files<CR>", desc = 'Find files' },
|
{ "<C-p>", "<cmd>Telescope find_files<CR>", desc = "Find files" },
|
||||||
{ '<leader>ps', "<cmd>Telescope live_grep<CR>", desc = 'Live Grep' },
|
{ "<leader>ps", "<cmd>Telescope live_grep<CR>", desc = "Live Grep" },
|
||||||
{ '<leader>vh', "<cmd>Telescope help_tags<CR>", desc = 'Help Tags' },
|
{
|
||||||
{
|
"<leader>fa",
|
||||||
'<leader>fa',
|
function() require("telescope.builtin").find_files({ follow = true, no_ignore = true, hidden = true }) end,
|
||||||
function() require("telescope.builtin").find_files({ follow = true, no_ignore = true, hidden = true }) end,
|
desc = "Find all files"
|
||||||
desc = 'Find all files'
|
},
|
||||||
},
|
{ "<leader>fb", "<cmd>Telescope buffers<CR>", desc = "Find buffer" },
|
||||||
{ '<leader>fb', "<cmd>Telescope buffers<CR>", desc = 'Find buffer' },
|
{ "<leader>fc", "<cmd>Telescope git_commits<CR>", desc = "Find commits" },
|
||||||
{ '<leader>fc', "<cmd>Telescope git_commits<CR>", desc = 'Find commits' },
|
},
|
||||||
{ '<leader>fg', "<cmd>Telescope git_status<CR>", desc = 'Find git status' },
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,63 +1,63 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
version = false,
|
version = false,
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
event = { "BufReadPost", "BufWritePost", "BufNewFile", "VeryLazy" },
|
event = { "BufReadPost", "BufWritePost", "BufNewFile", "VeryLazy" },
|
||||||
init = function(plugin)
|
init = function(plugin)
|
||||||
require("lazy.core.loader").add_to_rtp(plugin)
|
require("lazy.core.loader").add_to_rtp(plugin)
|
||||||
require("nvim-treesitter.query_predicates")
|
require("nvim-treesitter.query_predicates")
|
||||||
end,
|
end,
|
||||||
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
||||||
keys = {
|
keys = {
|
||||||
{ "<c-space>", desc = "Increment selection" },
|
{ "<c-space>", desc = "Increment selection" },
|
||||||
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
{ "<bs>", desc = "Decrement selection", mode = "x" },
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
additional_vim_regex_highlighting = { "php", "twig" },
|
additional_vim_regex_highlighting = { "php", "twig" },
|
||||||
},
|
},
|
||||||
auto_install = true,
|
auto_install = true,
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
ensure_installed = { "lua", "vim", "vimdoc", "typescript", "javascript", "go", "c", "cpp", "rust", "zig", "html", "css" },
|
ensure_installed = { "lua", "vim", "vimdoc", "typescript", "javascript", "go", "c", "cpp", "rust", "zig", "html", "css" },
|
||||||
incremental_selection = {
|
incremental_selection = {
|
||||||
enable = true,
|
enable = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
init_selection = "<C-space>",
|
init_selection = "<C-space>",
|
||||||
node_incremental = "<C-space>",
|
node_incremental = "<C-space>",
|
||||||
scope_incremental = false,
|
scope_incremental = false,
|
||||||
node_decremental = "<bs>",
|
node_decremental = "<bs>",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require("nvim-treesitter.configs").setup(opts)
|
require("nvim-treesitter.configs").setup(opts)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Show context of the current function
|
-- Show context of the current function
|
||||||
{
|
{
|
||||||
"nvim-treesitter/nvim-treesitter-context",
|
"nvim-treesitter/nvim-treesitter-context",
|
||||||
event = { "BufReadPost", "BufWritePost", "BufNewFile" },
|
event = { "BufReadPost", "BufWritePost", "BufNewFile" },
|
||||||
enabled = true,
|
enabled = true,
|
||||||
opts = { mode = "cursor", max_lines = 3 },
|
opts = { mode = "cursor", max_lines = 3 },
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>ut",
|
"<leader>ut",
|
||||||
function()
|
function()
|
||||||
local tsc = require("treesitter-context")
|
local tsc = require("treesitter-context")
|
||||||
tsc.toggle()
|
tsc.toggle()
|
||||||
end,
|
end,
|
||||||
desc = "Toggle Treesitter Context",
|
desc = "Toggle Treesitter Context",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Automatically add closing tags for HTML and JSX
|
-- Automatically add closing tags for HTML and JSX
|
||||||
{
|
{
|
||||||
"windwp/nvim-ts-autotag",
|
"windwp/nvim-ts-autotag",
|
||||||
event = { "BufReadPost", "BufWritePost", "BufNewFile" },
|
event = { "BufReadPost", "BufWritePost", "BufNewFile" },
|
||||||
opts = {},
|
opts = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue