diff --git a/init.lua b/init.lua index 3b56063..1017c0b 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,5 @@ +vim.loader.enable() + require('config.options') require('config.autocmds') require('config.keymaps') diff --git a/lazy-lock.json b/lazy-lock.json index 9f4ae32..22eff8b 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -9,8 +9,7 @@ "dashboard-nvim": { "branch": "master", "commit": "63df28409d940f9cac0a925df09d3dc369db9841" }, "dressing.nvim": { "branch": "master", "commit": "fe3071330a0720ce3695ac915820c8134b22d1b0" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, - "friendly-snippets": { "branch": "main", "commit": "43727c2ff84240e55d4069ec3e6158d74cb534b6" }, - "git.nvim": { "branch": "main", "commit": "741696687486f25f8b73d9e4c76ab2ede9998f39" }, + "friendly-snippets": { "branch": "main", "commit": "53d3df271d031c405255e99410628c26a8f0d2b0" }, "gitsigns.nvim": { "branch": "main", "commit": "5fc573f2d2a49aec74dd6dc977e8b137429d1897" }, "indentmini.nvim": { "branch": "main", "commit": "a58129ae424fd6d8e0e2e7f6ce06c0443101e370" }, "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, @@ -22,11 +21,13 @@ "mini.surround": { "branch": "main", "commit": "af8129efcabe95fc08a233e9f91569829bed031f" }, "neodev.nvim": { "branch": "main", "commit": "f972d7e6cd21b691199565cfe3e6487e774a4e8f" }, "neogen": { "branch": "main", "commit": "70127baaff25611deaf1a29d801fc054ad9d2dc1" }, - "none-ls.nvim": { "branch": "main", "commit": "358dd357a753f81412397b8a4cc01a2f41a1b594" }, + "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, + "none-ls.nvim": { "branch": "main", "commit": "fc0f6013ced00fbd61a1ee079427ad445eea0e4b" }, + "nui.nvim": { "branch": "main", "commit": "257dccc43b4badc735978f0791d216f7d665b75a" }, "nvim-cmp": { "branch": "main", "commit": "0b751f6beef40fd47375eaf53d3057e0bfa317e4" }, - "nvim-lspconfig": { "branch": "master", "commit": "e4a56adbc51c55964253dce4505cec55c82c1c04" }, + "nvim-lspconfig": { "branch": "master", "commit": "daaf00a77805e113acf8ccc02dd8c3403d691683" }, "nvim-tree.lua": { "branch": "master", "commit": "086bf310bd19a7103ee7d761eb59f89f3dd23e21" }, - "nvim-treesitter": { "branch": "master", "commit": "b056e4227b1c5d3ecfe96941352364c0c10668df" }, + "nvim-treesitter": { "branch": "master", "commit": "ba588ee0cf9df885f3f8698ae671330d82b4bdec" }, "nvim-treesitter-textobjects": { "branch": "master", "commit": "dbcd9388e3b119a87c785e10a00d62876077d23d" }, "nvim-ts-autotag": { "branch": "main", "commit": "6be1192965df35f94b8ea6d323354f7dc7a557e4" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "b8ff464f2afc2000f6c72fa331a8fc090cb46b39" }, @@ -36,9 +37,9 @@ "playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" }, "plenary.nvim": { "branch": "master", "commit": "366b0837486f60ae0e7550c15de8ff66d057c4cd" }, "schemastore.nvim": { "branch": "main", "commit": "54a4ea14b70cd3fc9db8217bb4ac9e1f78bfa390" }, - "solarized-osaka.nvim": { "branch": "main", "commit": "aeaefec4465deb3ec36f094578e880726c8f8e24" }, + "solarized-osaka.nvim": { "branch": "main", "commit": "a823d09b062852194ae15365392bc16274e38fc8" }, "telescope-file-browser.nvim": { "branch": "master", "commit": "d7c453396a043c265bef1227920628e7b811ff30" }, "telescope-fzf-native.nvim": { "branch": "main", "commit": "6c921ca12321edaa773e324ef64ea301a1d0da62" }, - "telescope.nvim": { "branch": "master", "commit": "e4c62dedd760d339bea5b8325c2d918d87476d00" }, + "telescope.nvim": { "branch": "master", "commit": "84c5a71d825b6687a55aed6f41e98b92fd8e5454" }, "vim-illuminate": { "branch": "master", "commit": "3bd2ab64b5d63b29e05691e624927e5ebbf0fb86" } } \ No newline at end of file diff --git a/lua/config/init.lua b/lua/config/init.lua index 9d692db..4c50763 100644 --- a/lua/config/init.lua +++ b/lua/config/init.lua @@ -1,5 +1,3 @@ -vim.loader.enable() - local M = { icons = { diagnostics = { diff --git a/lua/plugins/colorscheme.lua b/lua/plugins/colorscheme.lua index 54b2d62..6b29d10 100644 --- a/lua/plugins/colorscheme.lua +++ b/lua/plugins/colorscheme.lua @@ -9,6 +9,7 @@ return { config = function(_, opts) require('solarized-osaka').setup(opts) vim.cmd('colorscheme solarized-osaka') + vim.cmd.highlight('default link IndentLine Comment') end, }, } diff --git a/lua/plugins/editor.lua b/lua/plugins/editor.lua index 1ec2b6c..15be11e 100644 --- a/lua/plugins/editor.lua +++ b/lua/plugins/editor.lua @@ -1,4 +1,235 @@ +local Util = require('util') + return { + { + 'folke/flash.nvim', + event = 'VeryLazy', + ---@type Flash.Config + opts = {}, + -- stylua: ignore + keys = { + { " s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" }, + { "S", mode = { "n", "o", "x" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" }, + }, + }, + + { + 'nvim-telescope/telescope.nvim', + cmd = 'Telescope', + version = false, + dependencies = { + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + config = function() + Util.on_load('telescope.nvim', function() + require('telescope').load_extension('fzf') + end) + end, + }, + 'nvim-telescope/telescope-file-browser.nvim', + }, + keys = { + { + '', + function() + local builtin = require('telescope.builtin') + builtin.find_files({ + no_ignore = false, + hidden = true, + }) + end, + desc = 'Lists files in your current working directory, respects .gitignore', + }, + { + 'r', + function() + local builtin = require('telescope.builtin') + builtin.live_grep() + end, + desc = 'Search for a string in your current working directory and get results live as you type, respects .gitignore', + }, + { + 's', + function() + local builtin = require('telescope.builtin') + builtin.current_buffer_fuzzy_find({ fuzzy = false, case_mode = 'ignore_case' }) + end, + desc = 'Search from current buffer', + }, + { + 'b', + function() + local builtin = require('telescope.builtin') + builtin.buffers() + end, + desc = 'Lists open buffers', + }, + { + 't', + function() + local builtin = require('telescope.builtin') + builtin.help_tags() + end, + desc = 'Lists available help tags and opens a new window with the relevant help info on ', + }, + { + '\\\\', + function() + local builtin = require('telescope.builtin') + builtin.resume() + end, + desc = 'Resume the previous telescope picker', + }, + { + 'dl', + function() + local builtin = require('telescope.builtin') + builtin.diagnostics({ bufnr = 0 }) + end, + desc = 'Lists Diagnostics for all open buffers or a specific buffer', + }, + { + '?', + function() + local builtin = require('telescope.builtin') + builtin.oldfiles() + end, + desc = 'Lists recently opened files', + }, + { + 'S', + function() + local builtin = require('telescope.builtin') + builtin.treesitter() + end, + desc = 'Lists Function names, variables, from Treesitter', + }, + { + 'sf', + function() + local telescope = require('telescope') + + local function telescope_buffer_dir() + return vim.fn.expand('%:p:h') + end + + telescope.extensions.file_browser.file_browser({ + path = '%:p:h', + cwd = telescope_buffer_dir(), + respect_gitignore = false, + hidden = true, + grouped = true, + previewer = false, + initial_mode = 'normal', + layout_config = { height = 40 }, + }) + end, + desc = 'Open File Browser with the path of the current buffer', + }, + }, + config = function(_, opts) + local telescope = require('telescope') + local actions = require('telescope.actions') + local fb_actions = require('telescope').extensions.file_browser.actions + + opts.defaults = { + prompt_prefix = ' ', + selection_caret = ' ', + -- open files in the first window that is an actual file. + -- use the current window if no other window is available. + get_selection_window = function() + local wins = vim.api.nvim_list_wins() + table.insert(wins, 1, vim.api.nvim_get_current_win()) + for _, win in ipairs(wins) do + local buf = vim.api.nvim_win_get_buf(win) + if vim.bo[buf].buftype == '' then + return win + end + end + return 0 + end, + wrap_results = true, + layout_strategy = 'horizontal', + layout_config = { prompt_position = 'top' }, + sorting_strategy = 'ascending', + winblend = 0, + mappings = { + i = { + [''] = open_with_trouble, + [''] = open_selected_with_trouble, + [''] = find_files_no_ignore, + [''] = find_files_with_hidden, + [''] = actions.cycle_history_next, + [''] = actions.cycle_history_prev, + [''] = actions.preview_scrolling_down, + [''] = actions.preview_scrolling_up, + }, + n = { + ['q'] = actions.close, + }, + }, + } + opts.pickers = { + diagnostics = { + theme = 'ivy', + initial_mode = 'normal', + layout_config = { + preview_cutoff = 9999, + }, + }, + } + opts.extensions = { + file_browser = { + theme = 'dropdown', + -- disables netrw and use telescope-file-browser in its place + hijack_netrw = true, + mappings = { + -- your custom insert mode mappings + ['n'] = { + -- your custom normal mode mappings + ['N'] = fb_actions.create, + ['h'] = fb_actions.goto_parent_dir, + ['/'] = function() + vim.cmd('startinsert') + end, + [''] = function(prompt_bufnr) + for i = 1, 10 do + actions.move_selection_previous(prompt_bufnr) + end + end, + [''] = function(prompt_bufnr) + for i = 1, 10 do + actions.move_selection_next(prompt_bufnr) + end + end, + [''] = actions.preview_scrolling_up, + [''] = actions.preview_scrolling_down, + }, + }, + }, + } + telescope.setup(opts) + require('telescope').load_extension('fzf') + require('telescope').load_extension('file_browser') + end, + }, + + { + 'lewis6991/gitsigns.nvim', + event = 'VeryLazy', + opts = { + signs = { + add = { text = '┃' }, + change = { text = '┃' }, + delete = { text = '_' }, + topdelete = { text = '‾' }, + changedelete = { text = '~' }, + untracked = { text = '┃' }, + }, + }, + }, + -- Automatically highlights other instances of the word under your cursor. -- This works with LSP, Treesitter, and regexp matching to find the other -- instances. diff --git a/lua/plugins/flash.lua b/lua/plugins/flash.lua deleted file mode 100644 index 838787b..0000000 --- a/lua/plugins/flash.lua +++ /dev/null @@ -1,48 +0,0 @@ -return { - 'folke/flash.nvim', - event = 'VeryLazy', - ---@type Flash.Config - opts = {}, - keys = { - { - ' s', - mode = { 'n', 'x', 'o' }, - function() - require('flash').jump() - end, - desc = 'Flash', - }, - { - 'S', - mode = { 'n', 'o', 'x' }, - function() - require('flash').treesitter() - end, - desc = 'Flash Treesitter', - }, - { - 'r', - mode = 'o', - function() - require('flash').remote() - end, - desc = 'Remote Flash', - }, - { - 'R', - mode = { 'o', 'x' }, - function() - require('flash').treesitter_search() - end, - desc = 'Flash Treesitter Search', - }, - { - '', - mode = { 'c' }, - function() - require('flash').toggle() - end, - desc = 'Toggle Flash Search', - }, - }, -} diff --git a/lua/plugins/git.lua b/lua/plugins/git.lua deleted file mode 100644 index 5bf0440..0000000 --- a/lua/plugins/git.lua +++ /dev/null @@ -1,30 +0,0 @@ -return { - { - 'dinhhuy258/git.nvim', - event = 'VeryLazy', - opts = function() - return { - keymaps = { - -- Open blame window - blame = 'gb', - -- Open file/folder in git repository - browse = 'go', - }, - } - end, - }, - { - 'lewis6991/gitsigns.nvim', - event = 'VeryLazy', - opts = { - signs = { - add = { text = '┃' }, - change = { text = '┃' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - untracked = { text = '┃' }, - }, - }, - }, -} diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua deleted file mode 100644 index 1536a17..0000000 --- a/lua/plugins/telescope.lua +++ /dev/null @@ -1,203 +0,0 @@ -local Util = require('util') - -return { - 'nvim-telescope/telescope.nvim', - cmd = 'Telescope', - version = false, - dependencies = { - { - 'nvim-telescope/telescope-fzf-native.nvim', - build = 'make', - config = function() - Util.on_load('telescope.nvim', function() - require('telescope').load_extension('fzf') - end) - end, - }, - 'nvim-telescope/telescope-file-browser.nvim', - }, - keys = { - { - '', - function() - local builtin = require('telescope.builtin') - builtin.find_files({ - no_ignore = false, - hidden = true, - }) - end, - desc = 'Lists files in your current working directory, respects .gitignore', - }, - { - 'r', - function() - local builtin = require('telescope.builtin') - builtin.live_grep() - end, - desc = 'Search for a string in your current working directory and get results live as you type, respects .gitignore', - }, - { - 's', - function() - local builtin = require('telescope.builtin') - builtin.current_buffer_fuzzy_find({ fuzzy = false, case_mode = 'ignore_case' }) - end, - desc = 'Search from current buffer', - }, - { - 'b', - function() - local builtin = require('telescope.builtin') - builtin.buffers() - end, - desc = 'Lists open buffers', - }, - { - 't', - function() - local builtin = require('telescope.builtin') - builtin.help_tags() - end, - desc = 'Lists available help tags and opens a new window with the relevant help info on ', - }, - { - '\\\\', - function() - local builtin = require('telescope.builtin') - builtin.resume() - end, - desc = 'Resume the previous telescope picker', - }, - { - 'dl', - function() - local builtin = require('telescope.builtin') - builtin.diagnostics() - end, - desc = 'Lists Diagnostics for all open buffers or a specific buffer', - }, - { - '?', - function() - local builtin = require('telescope.builtin') - builtin.oldfiles() - end, - desc = 'Lists recently opened files', - }, - { - 'S', - function() - local builtin = require('telescope.builtin') - builtin.treesitter() - end, - desc = 'Lists Function names, variables, from Treesitter', - }, - { - 'sf', - function() - local telescope = require('telescope') - - local function telescope_buffer_dir() - return vim.fn.expand('%:p:h') - end - - telescope.extensions.file_browser.file_browser({ - path = '%:p:h', - cwd = telescope_buffer_dir(), - respect_gitignore = false, - hidden = true, - grouped = true, - previewer = false, - initial_mode = 'normal', - layout_config = { height = 40 }, - }) - end, - desc = 'Open File Browser with the path of the current buffer', - }, - }, - config = function(_, opts) - local telescope = require('telescope') - local actions = require('telescope.actions') - local fb_actions = require('telescope').extensions.file_browser.actions - - opts.defaults = { - prompt_prefix = ' ', - selection_caret = ' ', - -- open files in the first window that is an actual file. - -- use the current window if no other window is available. - get_selection_window = function() - local wins = vim.api.nvim_list_wins() - table.insert(wins, 1, vim.api.nvim_get_current_win()) - for _, win in ipairs(wins) do - local buf = vim.api.nvim_win_get_buf(win) - if vim.bo[buf].buftype == '' then - return win - end - end - return 0 - end, - wrap_results = true, - layout_strategy = 'horizontal', - layout_config = { prompt_position = 'top' }, - sorting_strategy = 'ascending', - winblend = 0, - mappings = { - i = { - [''] = open_with_trouble, - [''] = open_selected_with_trouble, - [''] = find_files_no_ignore, - [''] = find_files_with_hidden, - [''] = actions.cycle_history_next, - [''] = actions.cycle_history_prev, - [''] = actions.preview_scrolling_down, - [''] = actions.preview_scrolling_up, - }, - n = { - ['q'] = actions.close, - }, - }, - } - opts.pickers = { - diagnostics = { - theme = 'ivy', - initial_mode = 'normal', - layout_config = { - preview_cutoff = 9999, - }, - }, - } - opts.extensions = { - file_browser = { - theme = 'dropdown', - -- disables netrw and use telescope-file-browser in its place - hijack_netrw = true, - mappings = { - -- your custom insert mode mappings - ['n'] = { - -- your custom normal mode mappings - ['N'] = fb_actions.create, - ['h'] = fb_actions.goto_parent_dir, - ['/'] = function() - vim.cmd('startinsert') - end, - [''] = function(prompt_bufnr) - for i = 1, 10 do - actions.move_selection_previous(prompt_bufnr) - end - end, - [''] = function(prompt_bufnr) - for i = 1, 10 do - actions.move_selection_next(prompt_bufnr) - end - end, - [''] = actions.preview_scrolling_up, - [''] = actions.preview_scrolling_down, - }, - }, - }, - } - telescope.setup(opts) - require('telescope').load_extension('fzf') - require('telescope').load_extension('file_browser') - end, -} diff --git a/lua/plugins/ui.lua b/lua/plugins/ui.lua index 7fb5a7c..931fa53 100644 --- a/lua/plugins/ui.lua +++ b/lua/plugins/ui.lua @@ -125,11 +125,56 @@ return { require('indentmini').setup({ char = '|', }) - -- use comment color - vim.cmd.highlight('default link IndentLine Comment') end, }, + -- Highly experimental plugin that completely replaces the UI for messages, cmdline and the popupmenu. + { + 'folke/noice.nvim', + event = 'VeryLazy', + opts = { + lsp = { + override = { + ['vim.lsp.util.convert_input_to_markdown_lines'] = true, + ['vim.lsp.util.stylize_markdown'] = true, + ['cmp.entry.get_documentation'] = true, + }, + }, + routes = { + { + filter = { + event = 'msg_show', + any = { + { find = '%d+L, %d+B' }, + { find = '; after #%d+' }, + { find = '; before #%d+' }, + }, + }, + view = 'mini', + }, + }, + presets = { + bottom_search = true, + command_palette = true, + long_message_to_split = true, + inc_rename = true, + }, + }, + -- stylua: ignore + keys = { + { "", function() require("noice").redirect(vim.fn.getcmdline()) end, mode = "c", desc = "Redirect Cmdline" }, + { "snl", function() require("noice").cmd("last") end, desc = "Noice Last Message" }, + { "snh", function() require("noice").cmd("history") end, desc = "Noice History" }, + { "sna", function() require("noice").cmd("all") end, desc = "Noice All" }, + { "snd", function() require("noice").cmd("dismiss") end, desc = "Dismiss All" }, + { "", function() if not require("noice.lsp").scroll(4) then return "" end end, silent = true, expr = true, desc = "Scroll forward", mode = { "i", "n", "s" } }, + { "", function() if not require("noice.lsp").scroll(-4) then return "" end end, silent = true, expr = true, desc = "Scroll backward", mode = { "i", "n", "s" } }, + }, + }, + + -- ui components + { 'MunifTanjim/nui.nvim', lazy = true }, + -- icons { 'nvim-tree/nvim-web-devicons', lazy = true },