From 2c152c5ef3877026148e8f66f9182c80e013e424 Mon Sep 17 00:00:00 2001 From: Thomas Ruoff Date: Wed, 26 Jun 2024 21:52:49 +0200 Subject: [PATCH] wip --- lua/autocmd.lua | 17 +++++++++++++++++ lua/plugins/common.lua | 1 - lua/plugins/git.lua | 2 +- lua/plugins/harpoon.lua | 38 ++++++++++++++++++++++++++++++++++++++ lua/plugins/lsp.lua | 1 + lua/plugins/orgmode.lua | 9 +++++---- lua/plugins/telescope.lua | 1 + 7 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 lua/plugins/harpoon.lua diff --git a/lua/autocmd.lua b/lua/autocmd.lua index 927b61a..7745864 100644 --- a/lua/autocmd.lua +++ b/lua/autocmd.lua @@ -5,3 +5,20 @@ vim.api.nvim_create_autocmd('TextYankPost', { vim.highlight.on_yank() end, }) + +vim.api.nvim_create_autocmd('FileType', { + pattern = { + 'checkhealth', + 'fugitive*', + 'git', + 'help', + 'lspinfo', + 'netrw', + 'notify', + 'qf', + 'query', + }, + callback = function() + vim.keymap.set('n', 'q', vim.cmd.close, { desc = 'Close the current buffer', buffer = true }) + end, +}) diff --git a/lua/plugins/common.lua b/lua/plugins/common.lua index bd722b3..1f9f0db 100644 --- a/lua/plugins/common.lua +++ b/lua/plugins/common.lua @@ -31,7 +31,6 @@ return { -- require('mini.colors').setup() end, }, - { 'folke/which-key.nvim', event = 'VimEnter', diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua index 9581810..01c6f91 100644 --- a/lua/plugins/git.lua +++ b/lua/plugins/git.lua @@ -2,7 +2,7 @@ return { { 'tpope/vim-fugitive', keys = { - { 'gs', 'Git', desc = '[s]tatus' }, + { 'gs', 'vert Git', desc = '[s]tatus' }, }, }, { diff --git a/lua/plugins/harpoon.lua b/lua/plugins/harpoon.lua new file mode 100644 index 0000000..cafd710 --- /dev/null +++ b/lua/plugins/harpoon.lua @@ -0,0 +1,38 @@ +return { + 'ThePrimeagen/harpoon', + branch = 'harpoon2', + dependencies = { 'nvim-lua/plenary.nvim' }, + config = function() + local harpoon = require 'harpoon' + + harpoon:setup() + + vim.keymap.set('n', 'ha', function() + harpoon:list():add() + end, { desc = '[a]dd' }) + vim.keymap.set('n', 'hh', function() + harpoon.ui:toggle_quick_menu(harpoon:list()) + end, { desc = '[q]uick menu' }) + + vim.keymap.set('n', '', function() + harpoon:list():select(1) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(2) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(3) + end) + vim.keymap.set('n', '', function() + harpoon:list():select(4) + end) + + -- Toggle previous & next buffers stored within Harpoon list + vim.keymap.set('n', '', function() + harpoon:list():prev() + end) + vim.keymap.set('n', '', function() + harpoon:list():next() + end) + end, +} diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua index d185d0b..2ec3d47 100644 --- a/lua/plugins/lsp.lua +++ b/lua/plugins/lsp.lua @@ -139,6 +139,7 @@ return { lua = { 'stylua' }, javascript = { { 'eslint_d', 'prettier' } }, javascriptreact = { { 'eslint_d', 'prettier' } }, + json = { { 'eslint_d', 'prettier' } }, typescript = { { 'eslint_d', 'prettier' } }, typescriptreact = { { 'eslint_d', 'prettier' } }, ['_'] = { 'trim_whitespace' }, diff --git a/lua/plugins/orgmode.lua b/lua/plugins/orgmode.lua index f2d54da..995bce2 100644 --- a/lua/plugins/orgmode.lua +++ b/lua/plugins/orgmode.lua @@ -7,13 +7,14 @@ return { require('orgmode').setup { org_agenda_files = '~/org/**/*', org_default_notes_file = '~/org/refile.org', + org_todo_keywords = { 'TODO', 'WAITING', '|', 'DONE', 'DELEGATED' }, } -- NOTE: If you are using nvim-treesitter with `ensure_installed = "all"` option -- add `org` to ignore_install - -- require('nvim-treesitter.configs').setup({ - -- ensure_installed = 'all', - -- ignore_install = { 'org' }, - -- }) + require('nvim-treesitter.configs').setup { + ensure_installed = 'all', + ignore_install = { 'org' }, + } end, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index a9fc7bf..a223088 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -85,6 +85,7 @@ return { -- Fuzzy Finder (files, lsp, etc) vim.keymap.set('n', '*', builtin.grep_string, { desc = '[F]ind current [W]ord' }) vim.keymap.set('n', '/', builtin.live_grep, { desc = '[F]ind by [G]rep' }) vim.keymap.set('n', 'fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' }) + vim.keymap.set('n', 'fb', builtin.buffers, { desc = '[F]ind [B]uffer' }) vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'fo', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' })