added vue.js support

This commit is contained in:
Arnold Lei 2025-10-08 17:58:44 -06:00
parent e8e3ee3769
commit afafe9735c
4 changed files with 68 additions and 20 deletions

View File

@ -436,6 +436,7 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' }) vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' })
vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' }) vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' }) vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
-- vim.api.nvim_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', { noremap = true, silent = true })
-- Slightly advanced example of overriding default behavior and theme -- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function() vim.keymap.set('n', '<leader>/', function()
@ -534,7 +535,12 @@ require('lazy').setup({
mode = mode or 'n' mode = mode or 'n'
vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc }) vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end 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. -- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc. -- Most Language Servers support renaming across files, etc.
map('grn', vim.lsp.buf.rename, '[R]e[n]ame') map('grn', vim.lsp.buf.rename, '[R]e[n]ame')
@ -681,19 +687,7 @@ require('lazy').setup({
-- https://github.com/pmizio/typescript-tools.nvim -- https://github.com/pmizio/typescript-tools.nvim
-- --
-- But for many setups, the LSP (`ts_ls`) will work just fine -- But for many setups, the LSP (`ts_ls`) will work just fine
ts_ls = { ts_ls = {},
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = '',
languages = { 'vue' },
},
},
},
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
},
-- --
lua_ls = { lua_ls = {
@ -745,8 +739,8 @@ require('lazy').setup({
end, 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 = { local vue_plugin = {
name = '@vue/typescript-plugin', name = '@vue/typescript-plugin',
location = vue_language_server_path, location = vue_language_server_path,
@ -825,7 +819,7 @@ require('lazy').setup({
-- Disable "format_on_save lsp_fallback" for languages that don't -- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional -- have a well standardized coding style. You can add additional
-- languages here or re-enable it for the disabled ones. -- 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 if disable_filetypes[vim.bo[bufnr].filetype] then
return nil return nil
else else
@ -920,6 +914,11 @@ require('lazy').setup({
-- By default, you may press `<c-space>` to show the documentation. -- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay. -- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 }, documentation = { auto_show = false, auto_show_delay_ms = 500 },
menu = {
border = 'rounded',
-- Show completion menu at cursor position
direction_priority = { 's', 'n' },
},
}, },
sources = { sources = {

View File

@ -1,7 +1,6 @@
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.keymap.set('n', '<leader>pv', vim.cmd.Ex)
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' }) vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
-- vim.keymap.set("n", "<leader>pv", "<CMD>Oil<CR>", { desc = "Open parent directory" }) vim.keymap.set('n', '<leader>pv', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
-- Window splits -- Window splits
vim.keymap.set('n', '|', '<cmd>vsplit<CR>', { desc = 'Split window vertically' }) vim.keymap.set('n', '|', '<cmd>vsplit<CR>', { desc = 'Split window vertically' })
@ -54,3 +53,7 @@ vim.keymap.set('n', '<leader>sf', ':source $HOME/.config/nvim/init.lua <CR>', {
vim.keymap.set('n', '<leader><leader>', function() vim.keymap.set('n', '<leader><leader>', function()
vim.cmd 'so' vim.cmd 'so'
end) 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' })

View File

@ -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 = ' <summary> • <date> • <author> • <<sha>>', -- 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
},
}

View File

@ -2,9 +2,38 @@ return {
'stevearc/oil.nvim', 'stevearc/oil.nvim',
---@module 'oil' ---@module 'oil'
---@type oil.SetupOpts ---@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 -- 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 -- 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 loading is not recommended because it is very tricky to make it work correctly in all situations.
lazy = false, lazy = false,