Add buffer deletion command and update source keymap, configure lsp_lines, null-ls, and trouble plugins
This commit is contained in:
parent
b7294ba9c5
commit
b366efced2
|
@ -10,6 +10,8 @@ function keymap(mode, lhs, rhs, opts)
|
||||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.cmd [[command ClearBufferExceptCurrent silent! execute "%bd|e#|bd#"]]
|
||||||
|
|
||||||
-- Navigate buffers
|
-- Navigate buffers
|
||||||
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
||||||
keymap("n", "<S-h>", ":bprevious<CR>", opts)
|
keymap("n", "<S-h>", ":bprevious<CR>", opts)
|
||||||
|
@ -36,19 +38,15 @@ keymap('n', 'n', "nzzzv")
|
||||||
keymap('n', 'N', "Nzzzv")
|
keymap('n', 'N', "Nzzzv")
|
||||||
|
|
||||||
-- replace without copy current selected
|
-- replace without copy current selected
|
||||||
keymap('x', '<leader>p', "\"_dp")
|
-- keymap('x', '<leader>p', "\"_dp")
|
||||||
|
keymap("x", "<leader>p", [["_dP]])
|
||||||
|
|
||||||
|
|
||||||
-- yank to system clipboard
|
-- yank to system clipboard
|
||||||
keymap('n', '<leader>y', "\"+y", { desc = "[Y]ank to clipboard" })
|
keymap('n', '<leader>y', "\"+y", { desc = "[Y]ank to clipboard" })
|
||||||
keymap('v', '<leader>y', "\"+y", { desc = "[Y]ank to clipboard" })
|
keymap('v', '<leader>y', "\"+y", { desc = "[Y]ank to clipboard" })
|
||||||
keymap('n', '<leader>Y', "\"+Y", { desc = "[Y]ank to clipboard" })
|
keymap('n', '<leader>Y', "\"+Y", { desc = "[Y]ank to clipboard" })
|
||||||
|
|
||||||
-- Quickfix
|
|
||||||
-- keymap('n', "<C-k>", "<cmd>cnext<CR>zz")
|
|
||||||
-- keymap('n', "<C-j>", "<cmd>cprev<CR>zz")
|
|
||||||
-- keymap('n', "<leader>k", "<cmd>lnext<CR>zz")
|
|
||||||
-- keymap('n', "<leader>j", "<cmd>lprev<CR>zz")
|
|
||||||
|
|
||||||
-- Open folder in workspace in tmux session
|
-- Open folder in workspace in tmux session
|
||||||
keymap("n", "<leader>op", "<cmd>silent !tmux neww tmux-sessionizer<CR>", { desc = "[O]pen [P]roject" })
|
keymap("n", "<leader>op", "<cmd>silent !tmux neww tmux-sessionizer<CR>", { desc = "[O]pen [P]roject" })
|
||||||
|
|
||||||
|
@ -66,7 +64,11 @@ keymap("n", "<leader>bd", ":Bdelete<CR>", { desc = "[B]uffer [D]elete" })
|
||||||
keymap("n", "<leader>bw", ":Bwipeout<CR>", { desc = "[B]uffer [W]ipeout" })
|
keymap("n", "<leader>bw", ":Bwipeout<CR>", { desc = "[B]uffer [W]ipeout" })
|
||||||
|
|
||||||
-- Delete buffer except current
|
-- Delete buffer except current
|
||||||
keymap("n", "<leader>be", ":%bd|e#|bd#<CR>", { silent = true, desc = "[B]uffer Delete [E]xcept" })
|
-- keymap("n", "<leader>be", ":%bd|e#|bd#<CR>", { silent = true, desc = "[B]uffer Delete [E]xcept" })
|
||||||
|
keymap("n", "<leader>be", ":ClearBufferExceptCurrent<CR>", { silent = true, desc = "[B]uffer Delete [E]xcept" })
|
||||||
|
|
||||||
-- Vim Be Good
|
-- Vim Be Good
|
||||||
keymap("n", "<leader>vbg", ":VimBeGood<CR>", { desc = "[V]im [B]e [G]ood" })
|
keymap("n", "<leader>vbg", ":VimBeGood<CR>", { desc = "[V]im [B]e [G]ood" })
|
||||||
|
|
||||||
|
-- Update source
|
||||||
|
keymap("n", "<leader><leader>", ":so<CR>")
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false,
|
||||||
|
-- virtual_lines = {
|
||||||
|
-- only_current_line = true
|
||||||
|
-- }
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- vim.keymap.set(
|
||||||
|
-- "",
|
||||||
|
-- "<Leader>ll",
|
||||||
|
-- require("lsp_lines").toggle,
|
||||||
|
-- { desc = "Toggle lsp_lines" }
|
||||||
|
-- )
|
|
@ -0,0 +1,39 @@
|
||||||
|
local keymap = vim.keymap.set
|
||||||
|
local trouble = require("trouble")
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
||||||
|
callback = function()
|
||||||
|
vim.diagnostic.setqflist({ open = false })
|
||||||
|
vim.diagnostic.setloclist({ open = false })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
function QuickFixToggle()
|
||||||
|
if trouble.is_open() then
|
||||||
|
trouble.close()
|
||||||
|
else
|
||||||
|
trouble.open({
|
||||||
|
mode = "quickfix"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function LocationListToggle()
|
||||||
|
if trouble.is_open() then
|
||||||
|
trouble.close()
|
||||||
|
else
|
||||||
|
trouble.open({
|
||||||
|
mode = "loclist"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Quickfix
|
||||||
|
keymap("n", "<leader>qq", ":lua QuickFixToggle()<CR>", { desc = "[Q]uickfix [Q]uick" })
|
||||||
|
keymap("n", "<leader>qn", "<cmd>cnext<CR>zz", { desc = "[Q]uick [N]ext" })
|
||||||
|
keymap("n", "<leader>qp", "<cmd>cprev<CR>zz", { desc = "[Q]uick [P]revious" })
|
||||||
|
|
||||||
|
-- Location List
|
||||||
|
keymap("n", "<leader>ll", ":lua LocationListToggle()<CR>", { desc = "[L]ocation [L]ist" })
|
||||||
|
keymap("n", "<leader>ln", "<cmd>lnext<CR>zz", { desc = "[L]ocation [N]ext" })
|
||||||
|
keymap("n", "<leader>lp", "<cmd>lprev<CR>zz", { desc = "[L]ocation [P]revious" })
|
44
init.lua
44
init.lua
|
@ -35,7 +35,6 @@ I hope you enjoy your Neovim journey,
|
||||||
|
|
||||||
P.S. You can delete this when you're done too. It's your config now :)
|
P.S. You can delete this when you're done too. It's your config now :)
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
-- See `:help mapleader`
|
-- See `:help mapleader`
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||||
|
@ -79,7 +78,8 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- NOTE: This is where your plugins related to LSP can be installed.
|
-- NOTE: This is where your plugins related to LSP can be installed.
|
||||||
-- The configuration is done below. Search for lspconfig to find it below.
|
-- The configuration is done below. Search for lspconfig to find it below.
|
||||||
{ -- LSP Configuration & Plugins
|
{
|
||||||
|
-- LSP Configuration & Plugins
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Automatically install LSPs to stdpath for neovim
|
-- Automatically install LSPs to stdpath for neovim
|
||||||
|
@ -95,14 +95,16 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Autocompletion
|
{
|
||||||
|
-- Autocompletion
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
dependencies = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Useful plugin to show you pending keybinds.
|
-- Useful plugin to show you pending keybinds.
|
||||||
{ 'folke/which-key.nvim', opts = {} },
|
{ 'folke/which-key.nvim', opts = {} },
|
||||||
{ -- Adds git releated signs to the gutter, as well as utilities for managing changes
|
{
|
||||||
|
-- Adds git releated signs to the gutter, as well as utilities for managing changes
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
-- See `:help gitsigns.txt`
|
-- See `:help gitsigns.txt`
|
||||||
|
@ -115,29 +117,36 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- { -- Theme inspired by Atom
|
||||||
{ -- Theme inspired by Atom
|
-- 'navarasu/onedark.nvim',
|
||||||
'navarasu/onedark.nvim',
|
-- priority = 1000,
|
||||||
priority = 1000,
|
-- config = function()
|
||||||
|
-- vim.cmd.colorscheme 'onedark'
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
{
|
||||||
|
'folke/tokyonight.nvim', -- Theme
|
||||||
config = function()
|
config = function()
|
||||||
vim.cmd.colorscheme 'onedark'
|
vim.cmd [[colorscheme tokyonight-night]]
|
||||||
end,
|
end
|
||||||
},
|
},
|
||||||
|
{
|
||||||
{ -- Set lualine as statusline
|
-- Set lualine as statusline
|
||||||
'nvim-lualine/lualine.nvim',
|
'nvim-lualine/lualine.nvim',
|
||||||
-- See `:help lualine.txt`
|
-- See `:help lualine.txt`
|
||||||
opts = {
|
opts = {
|
||||||
options = {
|
options = {
|
||||||
icons_enabled = false,
|
icons_enabled = false,
|
||||||
theme = 'onedark',
|
-- theme = 'onedark',
|
||||||
|
theme = 'tokyonight',
|
||||||
component_separators = '|',
|
component_separators = '|',
|
||||||
section_separators = '',
|
section_separators = '',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Add indentation guides even on blank lines
|
{
|
||||||
|
-- Add indentation guides even on blank lines
|
||||||
'lukas-reineke/indent-blankline.nvim',
|
'lukas-reineke/indent-blankline.nvim',
|
||||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||||
-- See `:help indent_blankline.txt`
|
-- See `:help indent_blankline.txt`
|
||||||
|
@ -166,7 +175,8 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- Highlight, edit, and navigate code
|
{
|
||||||
|
-- Highlight, edit, and navigate code
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
|
@ -358,7 +368,7 @@ require('nvim-treesitter.configs').setup {
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = "Go to previous diagnostic message" })
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = "Go to next diagnostic message" })
|
||||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = "Open floating diagnostic message" })
|
||||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = "Open diagnostics list" })
|
||||||
|
|
||||||
-- LSP settings.
|
-- LSP settings.
|
||||||
-- This function gets run when an LSP connects to a particular buffer.
|
-- This function gets run when an LSP connects to a particular buffer.
|
||||||
|
@ -389,7 +399,7 @@ local on_attach = function(_, bufnr)
|
||||||
|
|
||||||
-- See `:help K` for why this keymap
|
-- See `:help K` for why this keymap
|
||||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||||
-- nmap('<C-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
nmap('<C-K>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||||
|
|
||||||
-- Lesser used LSP functionality
|
-- Lesser used LSP functionality
|
||||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
'akinsho/bufferline.nvim',
|
'akinsho/bufferline.nvim',
|
||||||
config = function ()
|
config = function()
|
||||||
require("bufferline").setup {
|
require("bufferline").setup {
|
||||||
options = {
|
options = {
|
||||||
indicator = { style = "icon", icon = "▎"},
|
indicator = { style = "icon", icon = "▎" },
|
||||||
diagnostics = 'nvim_lsp', -- | "nvim_lsp" | "coc",
|
diagnostics = 'nvim_lsp', -- | "nvim_lsp" | "coc",
|
||||||
diagnostics_update_in_insert = false,
|
diagnostics_update_in_insert = false,
|
||||||
offsets = { { filetype = "NvimTree", text = "", padding = 1 } },
|
offsets = { { filetype = "NvimTree", text = "File Explorer", padding = 1 } },
|
||||||
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
separator_style = "thin", -- | "thick" | "thin" | { 'any', 'any' },
|
||||||
always_show_bufferline = true,
|
always_show_bufferline = true,
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
return {
|
||||||
|
"https://git.sr.ht/~whynothugo/lsp_lines.nvim",
|
||||||
|
config = function()
|
||||||
|
require('lsp_lines').setup()
|
||||||
|
end
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
return {
|
||||||
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
|
config = function()
|
||||||
|
local null_ls = require("null-ls")
|
||||||
|
null_ls.setup({
|
||||||
|
source = {
|
||||||
|
null_ls.builtins.diagnostics.eslint,
|
||||||
|
null_ls.builtins.completion.spell,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
return {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-tree/nvim-web-devicons"
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("trouble").setup {
|
||||||
|
}
|
||||||
|
end
|
||||||
|
}
|
Loading…
Reference in New Issue