[nvim] harpoon and other efficiency stuff

This commit is contained in:
Afonso Franco 2024-04-27 16:02:41 +01:00
parent fb27678dd5
commit b57f38bb9a
Signed by: afonso
SSH key fingerprint: SHA256:aiLbdlPwXKJS5wMnghdtod0SPy8imZjlVvCyUX9DJNk
7 changed files with 151 additions and 147 deletions

View file

@ -1,6 +1,7 @@
{ {
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" }, "LuaSnip": { "branch": "master", "commit": "be7be2ca7f55bb881a7ffc16b2efa5af034ab06b" },
"catppuccin": { "branch": "main", "commit": "07679af1af4f446655682ee2557b5840ac551504" }, "ale": { "branch": "master", "commit": "6db58b33795430a6165f27c7f796c420c0e098e4" },
"catppuccin": { "branch": "main", "commit": "a1439ad7c584efb3d0ce14ccb835967f030450fe" },
"cinnamon.nvim": { "branch": "master", "commit": "559fe02fae00ffd78377e9c242b2faa25a428592" }, "cinnamon.nvim": { "branch": "master", "commit": "559fe02fae00ffd78377e9c242b2faa25a428592" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
@ -9,49 +10,54 @@
"cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" }, "cmp-nvim-lua": { "branch": "main", "commit": "f12408bdb54c39c23e67cab726264c10db33ada8" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" }, "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "f9523f75134614fc0eff29c2377ed36603a1b0aa" }, "conform.nvim": { "branch": "master", "commit": "820eec990d5f332d30cf939954c8672a43a0459e" },
"copilot.lua": { "branch": "master", "commit": "f7612f5af4a7d7615babf43ab1e67a2d790c13a6" },
"dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" }, "dressing.nvim": { "branch": "master", "commit": "18e5beb3845f085b6a33c24112b37988f3f93c06" },
"fidget.nvim": { "branch": "main", "commit": "933db4596e4bab1b09b6d48a10e21819e4cc458f" }, "fidget.nvim": { "branch": "main", "commit": "1ba38e4cbb24683973e00c2e36f53ae64da38ef5" },
"friendly-snippets": { "branch": "main", "commit": "dcd4a586439a1c81357d5b9d26319ae218cc9479" }, "friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
"gruvbox-material": { "branch": "master", "commit": "c7c95a97702038e83c73e207f937263d4e7a2be8" }, "fzf": { "branch": "master", "commit": "d8bfb6712d514fd6715135fd0e60df188831b566" },
"gruvbox-material": { "branch": "master", "commit": "80331fbbec9ba18590a17bc6b7d277d96c05c2b6" },
"harpoon": { "branch": "harpoon2", "commit": "0378a6c428a0bed6a2781d459d7943843f374bce" },
"impatient.nvim": { "branch": "main", "commit": "47302af74be7b79f002773011f0d8e85679a7618" }, "impatient.nvim": { "branch": "main", "commit": "47302af74be7b79f002773011f0d8e85679a7618" },
"instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" }, "instant.nvim": { "branch": "master", "commit": "294b6d08143b3db8f9db7f606829270149e1a786" },
"jq.nvim": { "branch": "master", "commit": "b9879798f25a9318894456dc7464af0904c08958" }, "jq.nvim": { "branch": "master", "commit": "b9879798f25a9318894456dc7464af0904c08958" },
"lazy.nvim": { "branch": "main", "commit": "08954f723bf2d442ea020551e3acc956f4dc6dc7" }, "keylab.nvim": { "branch": "main", "commit": "9686b09253b5dde40e18554d189deb1b0c47f437" },
"lazy.nvim": { "branch": "main", "commit": "31ddbea7c10b6920c9077b66c97951ca8682d5c8" },
"lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" }, "lspkind.nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
"ltex-extra.nvim": { "branch": "master", "commit": "42dd3572cb09b52a137e91e515f2dff5eb631b1e" }, "ltex-extra.nvim": { "branch": "master", "commit": "4296c2c7aefbca721d02a011366a1de30598046c" },
"lualine.nvim": { "branch": "master", "commit": "b5e8bb642138f787a2c1c5aedc2a78cb2cebbd67" }, "lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "9dfcf2036c223920826140f0151d929a43f9eceb" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "44509689b9bf3984d729cc264aacb31cb7f41668" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" }, "mason-nvim-dap.nvim": { "branch": "main", "commit": "67210c0e775adec55de9826b038e8b62de554afc" },
"mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" }, "mason.nvim": { "branch": "main", "commit": "751b1fcbf3d3b783fcf8d48865264a9bcd8f9b10" },
"nvim-autopairs": { "branch": "master", "commit": "dbfc1c34bed415906395db8303c71039b3a3ffb4" }, "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" },
"nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" }, "nvim-bqf": { "branch": "main", "commit": "52703d7adc3be3f7c09eea9a80c5b8caa615fb25" },
"nvim-cmp": { "branch": "main", "commit": "ce16de5665c766f39c271705b17fff06f7bcb84f" },
"nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" }, "nvim-colorizer.lua": { "branch": "master", "commit": "85855b38011114929f4058efc97af1059ab3e41d" },
"nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" }, "nvim-dap": { "branch": "master", "commit": "405df1dcc2e395ab5173a9c3d00e03942c023074" },
"nvim-dap-go": { "branch": "main", "commit": "36abe1d320cb61bfdf094d4e0fe815ef58f2302a" },
"nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" }, "nvim-dap-ui": { "branch": "master", "commit": "edfa93f60b189e5952c016eee262d0685d838450" },
"nvim-ghost.nvim": { "branch": "main", "commit": "a1ca0b2dac59881066d7ac9373cf64d59ba29d6a" }, "nvim-ghost.nvim": { "branch": "main", "commit": "a1ca0b2dac59881066d7ac9373cf64d59ba29d6a" },
"nvim-lspconfig": { "branch": "master", "commit": "6e5c78ebc9936ca74add66bda22c566f951b6ee5" }, "nvim-lspconfig": { "branch": "master", "commit": "9266dc26862d8f3556c2ca77602e811472b4c5b8" },
"nvim-nio": { "branch": "master", "commit": "33c62b3eadd8154169e42144de16ba4db6784bec" }, "nvim-nio": { "branch": "master", "commit": "5800f585def265d52f1d8848133217c800bcb25d" },
"nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" }, "nvim-tmux-navigation": { "branch": "main", "commit": "4898c98702954439233fdaf764c39636681e2861" },
"nvim-treesitter": { "branch": "master", "commit": "1c3fb9eac2a04230e4af23715fa2c190cbeacd70" }, "nvim-treesitter": { "branch": "master", "commit": "2a95ff14764af20d32ec1edb27e11c38a84b9478" },
"nvim-treesitter-context": { "branch": "master", "commit": "f19766163c18515fb4d3c12d572bf9cba6cdb990" }, "nvim-treesitter-context": { "branch": "master", "commit": "ba05c6b753130d96b284d3e8ba8f54c28c0fb6d1" },
"nvim-web-devicons": { "branch": "master", "commit": "3ee60deaa539360518eaab93a6c701fe9f4d82ef" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "23b820146956b3b681c19e10d3a8bc0cbd9a1d4c" },
"nvim-web-devicons": { "branch": "master", "commit": "b3468391470034353f0e5110c70babb5c62967d3" },
"oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" }, "oil.nvim": { "branch": "master", "commit": "e462a3446505185adf063566f5007771b69027a1" },
"pastify.nvim": { "branch": "main", "commit": "47317b9bb7bf5fb7dfd994a6eb9bec8f00628dc0" }, "pastify.nvim": { "branch": "main", "commit": "47317b9bb7bf5fb7dfd994a6eb9bec8f00628dc0" },
"plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" }, "plenary.nvim": { "branch": "master", "commit": "8aad4396840be7fc42896e3011751b7609ca4119" },
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" }, "presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" }, "telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
"tla.nvim": { "branch": "master", "commit": "e419c75e805ab6d9967c7325bf35734c372d3d4b" }, "tla.nvim": { "branch": "master", "commit": "e419c75e805ab6d9967c7325bf35734c372d3d4b" },
"todo-comments.nvim": { "branch": "main", "commit": "833d8dd8b07eeda37a09e99460f72a02616935cb" }, "todo-comments.nvim": { "branch": "main", "commit": "a7e39ae9e74f2c8c6dc4eea6d40c3971ae84752d" },
"typst.vim": { "branch": "main", "commit": "86e4fa8dcddd032f9fdbf04602417a8baac8fed3" },
"undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" }, "undotree": { "branch": "master", "commit": "aa93a7e5890dbbebbc064cd22260721a6db1a196" },
"vim-alloy": { "branch": "master", "commit": "5bd57c4890be39e221dd3e1f6735457dce454bbd" }, "vim-alloy": { "branch": "master", "commit": "5bd57c4890be39e221dd3e1f6735457dce454bbd" },
"vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" }, "vim-be-good": { "branch": "master", "commit": "4fa57b7957715c91326fcead58c1fa898b9b3625" },
"vim-commentary": { "branch": "master", "commit": "f67e3e67ea516755005e6cccb178bc8439c6d402" },
"vim-jukit": { "branch": "master", "commit": "73214c9a8abc4b6aa7a6266b5bc2ddbf8b3e3c00" }, "vim-jukit": { "branch": "master", "commit": "73214c9a8abc4b6aa7a6266b5bc2ddbf8b3e3c00" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vim-tpipeline": { "branch": "master", "commit": "649f079a0bee19565978b82b672d831c6641d952" }, "vim-tpipeline": { "branch": "master", "commit": "5dd3832bd6e239feccb11cadca583cdcf9d5bda1" },
"vimtex": { "branch": "master", "commit": "73605f8b7655301ea47a2c355500ab4984f41b91" }, "vimtex": { "branch": "master", "commit": "ac0a41b297a70c101df89bc9c8d43341ba00fd4f" },
"zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" } "zen-mode.nvim": { "branch": "main", "commit": "78557d972b4bfbb7488e17b5703d25164ae64e6a" }
} }

View file

@ -25,8 +25,8 @@ vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4 vim.opt.shiftwidth = 4
vim.opt.expandtab = true vim.opt.expandtab = true
--quickfix keybinds --quickfix keybinds
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz") vim.keymap.set("n", "<C-k>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz") vim.keymap.set("n", "<C-j>", "<cmd>cnext<CR>zz")
--buffer keybinds --buffer keybinds
vim.keymap.set("n", "<A-h>", "<cmd>bp<CR>") vim.keymap.set("n", "<A-h>", "<cmd>bp<CR>")
vim.keymap.set("n", "<A-l>", "<cmd>bn<CR>") vim.keymap.set("n", "<A-l>", "<cmd>bn<CR>")
@ -46,4 +46,4 @@ vim.g.jukit_pdf_viewer = 'zathura'
vim.g.jukit_mappings = 0 vim.g.jukit_mappings = 0
--Format Options --Format Options
vim.opt.formatoptions:remove("ro") vim.opt.formatoptions:remove("ro")
--Sign gutter always on

View file

@ -19,38 +19,6 @@ if not lspkind_status_ok then
return return
end end
-- 󰃐 󰆩 󰙅 󰛡  󰅲 some other good icons
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 = "󰊄",
Copilot = "",
DB = "󰆼",
}
-- find more here: https://www.nerdfonts.com/cheat-sheet
cmp.setup({ cmp.setup({
snippet = { snippet = {
expand = function(args) expand = function(args)
@ -71,38 +39,25 @@ cmp.setup({
{ "i", "c" } { "i", "c" }
), ),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
-- Accept currently selected item. If none selected, do nothing. ["<C-l>"] = cmp.mapping(function()
["<C-k>"] = cmp.mapping(function(fallback) if luasnip.expand_or_jumpable() then
if luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump() luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end end
end), end),
["<C-j>"] = cmp.mapping(function(fallback) ["<C-h>"] = cmp.mapping(function()
if luasnip.jumpable(-1) then if luasnip.jumpable(-1) then
luasnip.jump(-1) luasnip.jump(-1)
else
fallback()
end end
end), end),
}, },
formatting = { formatting = {
fields = { "kind", "abbr", "menu" }, fields = { "kind", "abbr", "menu" },
format = lspkind.cmp_format({ format = lspkind.cmp_format({
mode = "symbol_text", -- show only symbol annotations mode = "symbol_text",
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) maxwidth = 50,
-- can also be a function to dynamically calculate max width such as ellipsis_char = "...",
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end, show_labelDetails = true,
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function(entry, vim_item) before = function(entry, vim_item)
vim_item.menu = ({ vim_item.menu = ({
nvim_lsp = "[LSP]", nvim_lsp = "[LSP]",
@ -113,11 +68,16 @@ cmp.setup({
end, end,
}), }),
}, },
preselect = cmp.PreselectMode.None,
sorting = { sorting = {
priority_weight = 2,
comparators = { comparators = {
cmp.config.compare.exact,
cmp.config.compare.offset, cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.kind,
cmp.config.compare.recently_used, cmp.config.compare.recently_used,
cmp.config.compare.locality,
--Make entries that start with underline appear after --Make entries that start with underline appear after
function(entry1, entry2) function(entry1, entry2)
@ -134,8 +94,8 @@ cmp.setup({
}, },
}, },
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lua" }, { name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" }, { name = "luasnip" },
{ name = "path" }, { name = "path" },
}, { }, {

View file

@ -29,6 +29,15 @@ lazy.setup({
end, end,
}, },
{
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("plugins.harpoon")
end
},
"vimpostor/vim-tpipeline", "vimpostor/vim-tpipeline",
{ {
@ -61,7 +70,15 @@ lazy.setup({
"folke/todo-comments.nvim", "folke/todo-comments.nvim",
event = "VeryLazy", event = "VeryLazy",
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = { "nvim-lua/plenary.nvim" },
opts = {}, opts = {
vim.keymap.set("n", "]t", function()
require("todo-comments").jump_next()
end, { desc = "Next todo comment" }),
vim.keymap.set("n", "[t", function()
require("todo-comments").jump_prev()
end, { desc = "Previous todo comment" })
},
}, },
{ {
@ -181,6 +198,11 @@ lazy.setup({
end, end,
}, },
{
'leoluz/nvim-dap-go',
opts = {}
},
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
config = function() config = function()
@ -196,61 +218,12 @@ lazy.setup({
require("plugins.lspconfig") require("plugins.lspconfig")
end, end,
}, },
--Better quick fix
{ {
"folke/trouble.nvim", 'kevinhwang91/nvim-bqf',
branch = "dev", ft = 'qf'
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
opts = {
modes = {
mydiags = {
mode = "diagnostics", -- inherit from diagnostics mode
filter = {
any = {
buf = 0, -- current buffer
{
severity = vim.diagnostic.severity.ERROR, -- errors only
-- limit to files in the current project
function(item)
return item.filename:find(vim.loop.cwd(), 1, true)
end,
},
},
},
}
}
}
}, },
'junegunn/fzf',
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
@ -293,12 +266,14 @@ lazy.setup({
-- Syntax Highlighting -- Syntax Highlighting
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
dependencies = {
'nvim-treesitter/nvim-treesitter-textobjects'
},
config = function() config = function()
require("plugins.treesitter") require("plugins.treesitter")
end, end,
}, },
"kaarmu/typst.vim",
--Sticky headers --Sticky headers
{ {
@ -315,7 +290,11 @@ lazy.setup({
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
tag = "0.1.4", tag = "0.1.4",
-- or , branch = '0.1.x', -- or , branch = '0.1.x',
dependencies = { "nvim-lua/plenary.nvim" }, dependencies = {
"nvim-lua/plenary.nvim",
'nvim-telescope/telescope-ui-select.nvim',
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }
},
config = function() config = function()
require("plugins.telescope") require("plugins.telescope")
end, end,

View file

@ -12,6 +12,8 @@ vim.api.nvim_create_autocmd("LspAttach", {
callback = function(ev) callback = function(ev)
-- Enable completion triggered by <c-x><c-o> -- Enable completion triggered by <c-x><c-o>
vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc" vim.bo[ev.buf].omnifunc = "v:lua.vim.lsp.omnifunc"
vim.opt_local.signcolumn=numbers
local telescope = require("telescope.builtin") local telescope = require("telescope.builtin")
local conform = require("conform") local conform = require("conform")
@ -28,13 +30,13 @@ vim.api.nvim_create_autocmd("LspAttach", {
vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, bufopts) vim.keymap.set("n", "<space>q", vim.diagnostic.setloclist, bufopts)
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts) vim.keymap.set("n", "gD", vim.lsp.buf.declaration, bufopts)
vim.keymap.set("n", "gd", telescope.lsp_definitions, bufopts) vim.keymap.set("n", "gd", telescope.lsp_definitions, bufopts)
vim.keymap.set("n", "gr", telescope.lsp_references, bufopts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts) vim.keymap.set("n", "K", vim.lsp.buf.hover, bufopts)
vim.keymap.set("n", "gi", telescope.lsp_implementations, bufopts) vim.keymap.set("n", "gi", telescope.lsp_implementations, bufopts)
vim.keymap.set("n", "<C-k>", vim.lsp.buf.signature_help, bufopts) vim.keymap.set("n", "<space>k", vim.lsp.buf.signature_help, bufopts)
vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts) vim.keymap.set("n", "<space>D", vim.lsp.buf.type_definition, bufopts)
vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts) vim.keymap.set("n", "<space>rn", vim.lsp.buf.rename, bufopts)
vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts) vim.keymap.set("n", "<space>ca", vim.lsp.buf.code_action, bufopts)
vim.keymap.set("n", "gr", telescope.lsp_references, bufopts)
vim.keymap.set("n", "<space>ge", function() vim.diagnostic.goto_next() end, bufopts) vim.keymap.set("n", "<space>ge", function() vim.diagnostic.goto_next() end, bufopts)
vim.keymap.set("n", "<space>gE", function() vim.diagnostic.goto_prev() end, bufopts) vim.keymap.set("n", "<space>gE", function() vim.diagnostic.goto_prev() end, bufopts)
vim.keymap.set("n", "<space>fo", function() conform.format({ lsp_fallback = true }) end, bufopts) vim.keymap.set("n", "<space>fo", function() conform.format({ lsp_fallback = true }) end, bufopts)
@ -54,7 +56,7 @@ mason_lspconfig.setup_handlers({
capabilities = capabilities, capabilities = capabilities,
}) })
end, end,
["gopls"] = function () ["gopls"] = function()
lspconfig["gopls"].setup({ lspconfig["gopls"].setup({
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
@ -79,11 +81,17 @@ mason_lspconfig.setup_handlers({
capabilities = capabilities, capabilities = capabilities,
settings = { settings = {
Lua = { Lua = {
library = { runtime = {
unpack(vim.api.nvim_get_runtime_file('', true)) -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
version = "LuaJIT",
}, },
diagnostics = { diagnostics = {
globals = { 'vim' }, -- Get the language server to recognize the `vim` global
globals = { "vim" },
},
workspace = {
-- Make the server aware of Neovim runtime files
library = vim.api.nvim_get_runtime_file("", true),
}, },
hint = { enable = true } hint = { enable = true }
}, },

View file

@ -1,5 +1,41 @@
local telescope = require('telescope')
local actions = require("telescope.actions")
telescope.setup {
defaults = {
layout_strategy = "horizontal",
mappings = {
i = {
["<esc>"] = actions.close,
},
},
},
pickers = {
find_files = {
previewer = false,
layout_strategy = "vertical",
layout_config = {
height = 0.7,
width = 0.5
},
},
live_grep = {
only_sort_text = true,
previewer = true,
}
},
extensions = {
["ui-select"] = {
require("telescope.themes").get_cursor {}
}
}
}
telescope.load_extension('fzf')
telescope.load_extension("ui-select")
local builtin = require('telescope.builtin') local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {}) vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {}) vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {}) vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fs', builtin.treesitter, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {}) vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})

View file

@ -4,11 +4,6 @@ if not present then
end end
require('nvim-treesitter.install').update({ with_sync = true }) require('nvim-treesitter.install').update({ with_sync = true })
local present, orgmode = pcall(require, "orgmode")
if present then
require('orgmode').setup_ts_grammar()
end
local options = { local options = {
@ -22,6 +17,26 @@ local options = {
indent = { indent = {
enable = true, enable = true,
}, },
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["af"] = "@function.outer",
["if"] = "@function.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
},
selection_modes = {
['@block.outer'] = 'v', -- charwise
['@block.inner'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
},
include_surrounding_whitespace = true,
},
},
} }
treesitter.setup(options) treesitter.setup(options)