diff --git a/init.lua b/init.lua index 498e72b8..3c923baa 100644 --- a/init.lua +++ b/init.lua @@ -419,15 +419,38 @@ require('lazy').setup({ pickers = { find_files = { hidden = true, + -- Include .env.local files even if they're gitignored + find_command = { + 'rg', '--files', '--hidden', '--no-ignore-vcs', + '--glob', '!.git/*', + '--glob', '!node_modules/*', + '--glob', '!.next/*', + '--glob', '!dist/*', + '--glob', '!build/*', + }, }, live_grep = { additional_args = function() - return { '--hidden' } + return { + '--hidden', '--no-ignore-vcs', + '--glob', '!.git/*', + '--glob', '!node_modules/*', + '--glob', '!.next/*', + '--glob', '!dist/*', + '--glob', '!build/*', + } end, }, grep_string = { additional_args = function() - return { '--hidden' } + return { + '--hidden', '--no-ignore-vcs', + '--glob', '!.git/*', + '--glob', '!node_modules/*', + '--glob', '!.next/*', + '--glob', '!dist/*', + '--glob', '!build/*', + } end, }, }, @@ -1032,10 +1055,13 @@ require('lazy').setup({ { -- Highlight, edit, and navigate code 'nvim-treesitter/nvim-treesitter', build = ':TSUpdate', + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, main = 'nvim-treesitter.configs', -- Sets main module to use for opts -- [[ Configure Treesitter ]] See `:help nvim-treesitter` opts = { - ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' }, + ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'vue', 'javascript', 'typescript', 'css' }, -- Autoinstall languages that are not installed auto_install = true, highlight = { @@ -1046,6 +1072,44 @@ require('lazy').setup({ additional_vim_regex_highlighting = { 'ruby' }, }, indent = { enable = true, disable = { 'ruby' } }, + textobjects = { + select = { + enable = true, + lookahead = true, -- Automatically jump forward to textobj + keymaps = { + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + }, + }, + move = { + enable = true, + set_jumps = true, -- Add to jumplist + goto_next_start = { + [']m'] = '@function.outer', + [']c'] = '@class.outer', + [']a'] = '@parameter.inner', + }, + goto_next_end = { + [']M'] = '@function.outer', + [']C'] = '@class.outer', + [']A'] = '@parameter.inner', + }, + goto_previous_start = { + ['[m'] = '@function.outer', + ['[c'] = '@class.outer', + ['[a'] = '@parameter.inner', + }, + goto_previous_end = { + ['[M'] = '@function.outer', + ['[C'] = '@class.outer', + ['[A'] = '@parameter.inner', + }, + }, + }, }, -- There are additional nvim-treesitter modules that you can use to interact -- with nvim-treesitter. You should go explore a few and see what interests you: diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index cfcac33d..653be3d3 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -50,6 +50,10 @@ vim.keymap.set('n', 'mr', 'CellularAutomaton make_it_rain') vim.keymap.set('n', 'sf', ':source $HOME/.config/nvim/init.lua ', { desc = 'Source Neovim config' }) +vim.keymap.set('n', '', function() + vim.cmd 'so' +end) + -- Jump to beginning/end of method vim.keymap.set('n', '[m', '[m', { desc = 'Jump to beginning of method' }) vim.keymap.set('n', ']m', ']m', { desc = 'Jump to end of method' }) diff --git a/lua/custom/plugins/harpoon.lua b/lua/custom/plugins/harpoon.lua index 160b490f..c605ba9a 100644 --- a/lua/custom/plugins/harpoon.lua +++ b/lua/custom/plugins/harpoon.lua @@ -34,12 +34,11 @@ return { harpoon:list():select(4) end, { desc = 'Harpoon: Go to file 4' }) - -- Navigate to previous & next buffers in the list - vim.keymap.set('n', '', function() + vim.keymap.set('n', 'hp', function() harpoon:list():prev() end, { desc = 'Harpoon: Previous buffer' }) - vim.keymap.set('n', '', function() + vim.keymap.set('n', 'hn', function() harpoon:list():next() end, { desc = 'Harpoon: Next buffer' }) end,