diff --git a/after/plugin/defaults.lua b/after/plugin/defaults.lua index 3617dbbd..2ecd1d89 100644 --- a/after/plugin/defaults.lua +++ b/after/plugin/defaults.lua @@ -13,6 +13,8 @@ set.splitright = true set.tabstop = 2 set.textwidth = 80 +vim.o.inccommand = "nosplit" + -- prev/next tab vim.keymap.set('n', 'H', 'gT', { desc = 'Tab Left' }) vim.keymap.set('n', 'L', 'gt', { desc = 'Tab Right' }) @@ -25,7 +27,9 @@ vim.keymap.set('i', '', ':m .-2==gi', { noremap = true, desc = 'Bu vim.keymap.set('v', '', ":m '<-2gv=gv", { noremap = true, desc = 'Bubble Down' }) vim.keymap.set('v', '', ":m '>+1gv=gv", { noremap = true, desc = 'Bubble Up' }) -vim.o.inccommand = "nosplit" +-- additional telescope triggers +vim.keymap.set('n', '', require('telescope.builtin').find_files, { desc = '[S]earch [F]iles' }) +vim.keymap.set('n', '', require('telescope.builtin').live_grep, { desc = '[S]earch by [G]rep' }) vim.diagnostic.config({ severity_sort = true, diff --git a/init.lua b/init.lua index da018a0c..a5641305 100644 --- a/init.lua +++ b/init.lua @@ -171,7 +171,7 @@ require('lazy').setup({ -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart -- These are some example plugins that I've included in the kickstart repository. -- Uncomment any of the lines below to enable them. - -- require 'kickstart.plugins.autoformat', + require 'kickstart.plugins.autoformat', -- require 'kickstart.plugins.debug', -- NOTE: The import below automatically adds your own plugins, configuration, etc from `lua/custom/plugins/*.lua` @@ -249,12 +249,15 @@ vim.api.nvim_create_autocmd('TextYankPost', { -- [[ Configure Telescope ]] -- See `:help telescope` and `:help telescope.setup()` +local actions = require "telescope.actions" require('telescope').setup { defaults = { mappings = { i = { [''] = false, [''] = false, + [""] = actions.move_selection_next, + [""] = actions.move_selection_previous, }, }, }, diff --git a/lua/custom/plugins/init.lua b/lua/custom/plugins/init.lua index 10e10a9a..c4ffb2cb 100644 --- a/lua/custom/plugins/init.lua +++ b/lua/custom/plugins/init.lua @@ -74,9 +74,36 @@ return { dependencies = { "justinmk/vim-dirvish", }, }, + { + "folke/trouble.nvim", + cond = false, + requires = "nvim-tree/nvim-web-devicons", + config = function() + require("trouble").setup {} + vim.keymap.set("n", "xx", "TroubleToggle", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xw", "TroubleToggle workspace_diagnostics", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xd", "TroubleToggle document_diagnostics", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xl", "TroubleToggle loclist", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "xq", "TroubleToggle quickfix", + { silent = true, noremap = true } + ) + vim.keymap.set("n", "gR", "TroubleToggle lsp_references", + { silent = true, noremap = true } + ) + end + }, + { "jose-elias-alvarez/null-ls.nvim", - lazy = true, + -- cond = false, dependencies = { "nvim-lua/plenary.nvim" }, config = function() -- @see: https://github.com/jay-babu/mason-null-ls.nvim @@ -84,7 +111,13 @@ return { local null_ls = require("null-ls") null_ls.setup({ sources = { + null_ls.builtins.code_actions.eslint_d, + null_ls.builtins.diagnostics.codespell, + -- null_ls.builtins.diagnostics.cspell, + -- null_ls.builtins.diagnostics.editorconfig_checker, + null_ls.builtins.diagnostics.eslint_d, null_ls.builtins.formatting.lua_format, + -- null_ls.builtins.formatting.prettier_eslint, null_ls.builtins.formatting.prettierd, }, }) diff --git a/lua/custom/plugins/reveal.lua b/lua/custom/plugins/reveal.lua index b50cb8dc..2edcd1e8 100644 --- a/lua/custom/plugins/reveal.lua +++ b/lua/custom/plugins/reveal.lua @@ -1,21 +1,19 @@ --- RevealInFinder --- --------------------------------------------------------------------------- +vim.api.nvim_create_user_command('Reveal', + function() + -- local sysname = vim.loop.os_uname().sysname -vim.cmd([[ - function! s:RevealInFinder() - if filereadable(expand("%")) - let l:command = "xdg-open -R %" - elseif getftype(expand("%:p:h")) == "dir" - let l:command = "xdg-open %:p:h" - else - let l:command = "xdg-open ." - endif - execute ":silent! !" . l:command - redraw! - endfunction + local currentBuffer = vim.api.nvim_get_current_buf() + local bufName = vim.api.nvim_buf_get_name(currentBuffer) + local ftype = vim.fn.getftype(bufName) - command! Reveal call RevealInFinder() -]]) + if ftype == "dir" then + os.execute("xdg-open " .. bufName) + else + os.execute("xdg-open " .. vim.fn.expand("%:p:h")) + end + end, + {} +) vim.keymap.set('n', 'R', ":Reveal", { noremap = true, desc = '[R]eveal with xdg-open' })