diff --git a/init.lua b/init.lua index f623a9dc..ce673961 100644 --- a/init.lua +++ b/init.lua @@ -436,6 +436,7 @@ require('lazy').setup({ vim.keymap.set('n', 'fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', 'f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) vim.keymap.set('n', '', builtin.buffers, { desc = '[ ] Find existing buffers' }) + -- vim.api.nvim_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', { noremap = true, silent = true }) -- Slightly advanced example of overriding default behavior and theme vim.keymap.set('n', '/', function() @@ -534,7 +535,12 @@ require('lazy').setup({ mode = mode or 'n' vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) end - + vim.api.nvim_create_autocmd({ 'LspAttach' }, { + callback = function() + -- Map 'gd' to go to definition using Telescope's LSP definitions picker + vim.keymap.set('n', 'gd', require('telescope.builtin').lsp_definitions, { buffer = 0, desc = 'Go to definition' }) + end, + }) -- Rename the variable under your cursor. -- Most Language Servers support renaming across files, etc. map('grn', vim.lsp.buf.rename, '[R]e[n]ame') @@ -681,19 +687,7 @@ require('lazy').setup({ -- https://github.com/pmizio/typescript-tools.nvim -- -- But for many setups, the LSP (`ts_ls`) will work just fine - ts_ls = { - init_options = { - plugins = { - { - name = '@vue/typescript-plugin', - location = '', - languages = { 'vue' }, - }, - }, - }, - filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' }, - }, - + ts_ls = {}, -- lua_ls = { @@ -745,8 +739,8 @@ require('lazy').setup({ end, }, } - local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server' + local vue_language_server_path = vim.fn.expand '$MASON/packages' .. '/vue-language-server' .. '/node_modules/@vue/language-server' local vue_plugin = { name = '@vue/typescript-plugin', location = vue_language_server_path, @@ -825,7 +819,7 @@ require('lazy').setup({ -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. - local disable_filetypes = { c = true, cpp = true } + local disable_filetypes = { c = true, cpp = true, vue = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else @@ -920,6 +914,11 @@ require('lazy').setup({ -- By default, you may press `` to show the documentation. -- Optionally, set `auto_show = true` to show the documentation after a delay. documentation = { auto_show = false, auto_show_delay_ms = 500 }, + menu = { + border = 'rounded', + -- Show completion menu at cursor position + direction_priority = { 's', 'n' }, + }, }, sources = { diff --git a/lua/arnoldlei/remap.lua b/lua/arnoldlei/remap.lua index a1670942..eccc412d 100644 --- a/lua/arnoldlei/remap.lua +++ b/lua/arnoldlei/remap.lua @@ -1,7 +1,6 @@ vim.g.mapleader = ' ' -vim.keymap.set('n', 'pv', vim.cmd.Ex) vim.keymap.set('n', '-', 'Oil', { desc = 'Open parent directory' }) --- vim.keymap.set("n", "pv", "Oil", { desc = "Open parent directory" }) +vim.keymap.set('n', 'pv', 'Oil', { desc = 'Open parent directory' }) -- Window splits vim.keymap.set('n', '|', 'vsplit', { desc = 'Split window vertically' }) @@ -54,3 +53,7 @@ vim.keymap.set('n', 'sf', ':source $HOME/.config/nvim/init.lua ', { 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/gitblame.lua b/lua/custom/plugins/gitblame.lua new file mode 100644 index 00000000..97a16202 --- /dev/null +++ b/lua/custom/plugins/gitblame.lua @@ -0,0 +1,17 @@ +return { + 'f-person/git-blame.nvim', + -- load the plugin at startup + event = 'VeryLazy', + -- Because of the keys part, you will be lazy loading this plugin. + -- The plugin will only load once one of the keys is used. + -- If you want to load the plugin at startup, add something like event = "VeryLazy", + -- or lazy = false. One of both options will work. + opts = { + -- your configuration comes here + -- for example + enabled = true, -- if you want to enable the plugin + message_template = ' • <>', -- template for the blame message, check the Message template section for more options + date_format = '%m-%d-%Y %H:%M:%S', -- template for the date, check Date format section for more options + virtual_text_column = 1, -- virtual text start column, check Start virtual text at column section for more options + }, +} diff --git a/lua/custom/plugins/oil.lua b/lua/custom/plugins/oil.lua index 8f5d6ff5..8a8b577b 100644 --- a/lua/custom/plugins/oil.lua +++ b/lua/custom/plugins/oil.lua @@ -2,9 +2,38 @@ return { 'stevearc/oil.nvim', ---@module 'oil' ---@type oil.SetupOpts - opts = {}, + opts = { + view_options = { + -- Show files and directories that start with "." + show_hidden = true, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + local m = name:match '^%.' + return m ~= nil + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + -- Sort file names with numbers in a more intuitive order for humans. + -- Can be "fast", true, or false. "fast" will turn it off for large directories. + natural_order = 'fast', + -- Sort file and directory names case insensitive + case_insensitive = false, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { 'type', 'asc' }, + { 'name', 'asc' }, + }, + -- Customize the highlight group for the file name + highlight_filename = function(entry, is_hidden, is_link_target, is_link_orphan) + return nil + end, + }, + }, -- Optional dependencies - dependencies = { { "nvim-mini/mini.icons", opts = {} } }, + dependencies = { { 'nvim-mini/mini.icons', opts = {} } }, -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. lazy = false,