update init and add harpoon

This commit is contained in:
2026-10-08 10:09:21 -04:00
parent ba2d04ce00
commit 560a493191
2 changed files with 97 additions and 26 deletions
+39 -26
View File
@@ -174,6 +174,11 @@ vim.opt.expandtab = true
-- See `:help hlsearch` -- See `:help hlsearch`
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>') vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
vim.keymap.set('n', 'q:', '<nop>')
vim.keymap.set('n', 'q/', '<nop>')
vim.keymap.set('n', 'q?', '<nop>')
vim.keymap.set('c', '<C-f>', '<nop>')
-- Diagnostic keymaps -- Diagnostic keymaps
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' }) vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
@@ -363,7 +368,7 @@ require('lazy').setup({
{ -- Fuzzy Finder (files, lsp, etc) { -- Fuzzy Finder (files, lsp, etc)
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
event = 'VimEnter', event = 'VimEnter',
branch = '0.1.x', branch = 'master',
dependencies = { dependencies = {
'nvim-lua/plenary.nvim', 'nvim-lua/plenary.nvim',
{ -- If encountering errors, see telescope-fzf-native README for installation instructions { -- If encountering errors, see telescope-fzf-native README for installation instructions
@@ -676,6 +681,9 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/ -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = { local servers = {
clangd = {}, clangd = {},
verible = {
cmd = { 'verible-verilog-ls', '--rules_config_search' },
},
-- gopls = {}, -- gopls = {},
-- pyright = {}, -- pyright = {},
-- rust_analyzer = {}, -- rust_analyzer = {},
@@ -718,7 +726,7 @@ require('lazy').setup({
return nil return nil
end end
local xml_path = vim.fn.stdpath('cache') .. '/jdtls-formatter-' .. vim.fn.sha256(props_path) .. '.xml' local xml_path = vim.fn.stdpath 'cache' .. '/jdtls-formatter-' .. vim.fn.sha256(props_path) .. '.xml'
local xml_stat = fs.fs_stat(xml_path) local xml_stat = fs.fs_stat(xml_path)
if not xml_stat or xml_stat.mtime.sec < stat.mtime.sec then if not xml_stat or xml_stat.mtime.sec < stat.mtime.sec then
local lines = { local lines = {
@@ -727,8 +735,8 @@ require('lazy').setup({
'<profile kind="CodeFormatterProfile" name="GTCS1332" version="21">', '<profile kind="CodeFormatterProfile" name="GTCS1332" version="21">',
} }
for line in io.lines(props_path) do for line in io.lines(props_path) do
local key, value = line:match('^%s*([^=%s]+)%s*=%s*(.-)%s*$') local key, value = line:match '^%s*([^=%s]+)%s*=%s*(.-)%s*$'
if key and not key:match('^#') then if key and not key:match '^#' then
value = value:gsub('&', '&amp;'):gsub('"', '&quot;'):gsub('<', '&lt;'):gsub('>', '&gt;') value = value:gsub('&', '&amp;'):gsub('"', '&quot;'):gsub('<', '&lt;'):gsub('>', '&gt;')
table.insert(lines, string.format('<setting id="%s" value="%s"/>', key, value)) table.insert(lines, string.format('<setting id="%s" value="%s"/>', key, value))
end end
@@ -1028,29 +1036,34 @@ require('lazy').setup({
}, },
{ -- Highlight, edit, and navigate code { -- Highlight, edit, and navigate code
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
branch = 'main',
lazy = false,
build = ':TSUpdate', build = ':TSUpdate',
main = 'nvim-treesitter.configs', -- Sets main module to use for opts config = function()
-- [[ Configure Treesitter ]] See `:help nvim-treesitter` local ts = require 'nvim-treesitter'
opts = { ts.setup()
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, ts.install { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }
-- Autoinstall languages that are not installed
auto_install = true, vim.api.nvim_create_autocmd('FileType', {
highlight = { callback = function(args)
enable = true, local lang = vim.treesitter.language.get_lang(args.match)
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules. if not lang then
-- If you are experiencing weird indenting issues, add the language to return
-- the list of additional_vim_regex_highlighting and disabled languages for indent. end
additional_vim_regex_highlighting = { 'ruby' }, if not pcall(vim.treesitter.start, args.buf, lang) then
disable = { 'latex' }, if vim.tbl_contains(ts.get_available(), lang) then
}, ts.install(lang):await(function()
indent = { enable = true, disable = { 'ruby' } }, if vim.api.nvim_buf_is_valid(args.buf) then
}, pcall(vim.treesitter.start, args.buf, lang)
-- There are additional nvim-treesitter modules that you can use to interact end
-- with nvim-treesitter. You should go explore a few and see what interests you: end)
-- end
-- - Incremental selection: Included, see `:help nvim-treesitter-incremental-selection-mod` return
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context end
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects vim.bo[args.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
end,
})
end,
}, },
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
+58
View File
@@ -0,0 +1,58 @@
return {
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope.nvim' },
config = function()
local harpoon = require 'harpoon'
harpoon:setup()
local conf = require('telescope.config').values
local function toggle_telescope(harpoon_files)
local file_paths = {}
local index_map = {}
for i = 1, harpoon_files:length() do
local item = harpoon_files:get(i)
if item then
table.insert(file_paths, item.value)
table.insert(index_map, i)
end
end
require('telescope.pickers')
.new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table {
results = file_paths,
},
previewer = conf.file_previewer {},
sorter = conf.generic_sorter {},
attach_mappings = function(prompt_bufnr, map)
local actions = require 'telescope.actions'
local action_state = require 'telescope.actions.state'
local function delete_mark()
local selection = action_state.get_selected_entry()
harpoon:list():remove_at(index_map[selection.index])
actions.close(prompt_bufnr)
toggle_telescope(harpoon:list())
end
map('i', '<C-d>', delete_mark)
map('n', '<C-d>', delete_mark)
return true
end,
})
:find()
end
vim.keymap.set('n', '<leader>a', function() harpoon:list():add() end, { desc = 'Harpoon Add File' })
vim.keymap.set('n', '<leader>rm', function() harpoon:list():remove() end, { desc = 'Harpoon Remove Current File' })
vim.keymap.set('n', '<C-e>', function() toggle_telescope(harpoon:list()) end, { desc = 'Harpoon Quick Menu (Telescope)' })
vim.keymap.set('n', '<C-h>', function() harpoon:list():select(1) end, { desc = 'Harpoon to File 1' })
vim.keymap.set('n', '<C-t>', function() harpoon:list():select(2) end, { desc = 'Harpoon to File 2' })
vim.keymap.set('n', '<C-n>', function() harpoon:list():select(3) end, { desc = 'Harpoon to File 3' })
vim.keymap.set('n', '<C-s>', function() harpoon:list():select(4) end, { desc = 'Harpoon to File 4' })
vim.keymap.set('n', '<C-S-P>', function() harpoon:list():prev() end, { desc = 'Harpoon Prev' })
vim.keymap.set('n', '<C-S-N>', function() harpoon:list():next() end, { desc = 'Harpoon Next' })
end,
}