feat: replace nvim with nvf
This commit is contained in:
parent
7db16b1462
commit
9ed1af62e4
32 changed files with 978 additions and 1299 deletions
|
|
@ -1,15 +0,0 @@
|
|||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
desc = "Auto select virtualenv Nvim open",
|
||||
pattern = "*.py",
|
||||
callback = function()
|
||||
local venv = vim.fn.findfile("pyproject.toml", vim.fn.getcwd() .. ";")
|
||||
if venv ~= "" then
|
||||
require("venv-selector").retrieve_from_cache()
|
||||
end
|
||||
end,
|
||||
once = true,
|
||||
})
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
|
||||
function GetAvailableWindowsShell()
|
||||
local shellList = { "nu", "pwsh-preview", "pwsh", "powershell", "cmd" }
|
||||
local length = #shellList
|
||||
for i = 1, length do
|
||||
local commandToCheck = "where " .. shellList[i]
|
||||
local exitCode = os.execute(commandToCheck)
|
||||
if exitCode == 0 then
|
||||
return shellList[i]
|
||||
end
|
||||
end
|
||||
|
||||
return shellList[length - 1]
|
||||
end
|
||||
|
||||
if package.config:sub(1, 1) == "\\" then
|
||||
vim.o.shell = GetAvailableWindowsShell()
|
||||
end
|
||||
|
||||
vim.g.lazyvim_python_lsp = "pyright"
|
||||
vim.g.lazyvim_python_ruff = "ruff"
|
||||
vim.g.lazyvim_eslint_auto_format = true
|
||||
vim.o.background = "dark"
|
||||
|
||||
-- Tab settings
|
||||
vim.g.expandtab = true
|
||||
vim.g.softtabstop = 2
|
||||
vim.g.shiftwidth = 2
|
||||
|
||||
-- Markdown preview
|
||||
vim.g.mkdp_auto_close = 0
|
||||
vim.g.mkdp_combine_preview = 1
|
||||
vim.g.mkdp_echo_preview_url = 1
|
||||
vim.g.mkdp_open_to_the_world = 1
|
||||
vim.g.mkdp_port = "20088"
|
||||
|
||||
-- Use osc52 as clipboard provider
|
||||
local function paste()
|
||||
return { vim.fn.split(vim.fn.getreg(""), "\n"), vim.fn.getregtype("") }
|
||||
end
|
||||
vim.g.clipboard = {
|
||||
name = "OSC 52",
|
||||
copy = {
|
||||
["+"] = require("vim.ui.clipboard.osc52").copy("+"),
|
||||
["*"] = require("vim.ui.clipboard.osc52").copy("*"),
|
||||
},
|
||||
paste = {
|
||||
["+"] = paste,
|
||||
["*"] = paste,
|
||||
},
|
||||
}
|
||||
-- To ALWAYS use the clipboard for ALL operations
|
||||
-- (instead of interacting with the "+" and/or "*" registers explicitly):
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
|
||||
vim.opt.spelllang = { "en", "cjk" }
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
---@module "blink.cmp"
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
snippets = {
|
||||
expand = function(snippet, _)
|
||||
return LazyVim.cmp.expand(snippet)
|
||||
end,
|
||||
},
|
||||
completion = {
|
||||
menu = {
|
||||
border = "rounded",
|
||||
},
|
||||
documentation = {
|
||||
auto_show = true,
|
||||
auto_show_delay_ms = 200,
|
||||
window = {
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
flavour = "macchiato",
|
||||
background = {
|
||||
light = "latte",
|
||||
dark = "macchiato",
|
||||
},
|
||||
transparent_background = true,
|
||||
integrations = {
|
||||
aerial = true,
|
||||
alpha = true,
|
||||
cmp = true,
|
||||
dashboard = true,
|
||||
flash = true,
|
||||
gitsigns = true,
|
||||
headlines = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true },
|
||||
leap = true,
|
||||
lsp_trouble = true,
|
||||
mason = true,
|
||||
markdown = true,
|
||||
mini = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
underlines = {
|
||||
errors = { "undercurl" },
|
||||
hints = { "undercurl" },
|
||||
warnings = { "undercurl" },
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
neotree = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
semantic_tokens = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
which_key = true,
|
||||
},
|
||||
},
|
||||
priority = 1000,
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
name = "tokyonight",
|
||||
},
|
||||
{
|
||||
"embark-theme/vim",
|
||||
name = "embark",
|
||||
opts = {
|
||||
transparent_background = true,
|
||||
},
|
||||
},
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
name = "gruvbox",
|
||||
priority = 1000,
|
||||
},
|
||||
{
|
||||
"luisiacc/gruvbox-baby",
|
||||
name = "gruvbox-baby",
|
||||
},
|
||||
{
|
||||
"sainnhe/gruvbox-material",
|
||||
name = "gruvbox-material",
|
||||
},
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
json = { "prettierd", "prettier", stop_after_first = true },
|
||||
jsonc = { "prettierd", "prettier", stop_after_first = true },
|
||||
verilog = { "verible" },
|
||||
},
|
||||
formatters = {
|
||||
verible = {
|
||||
command = "verible-verilog-format",
|
||||
args = { "-" },
|
||||
range_args = function(self, ctx)
|
||||
return { "--lines", ctx.range.start[1] .. "-" .. ctx.range["end"][1] }
|
||||
end,
|
||||
stdin = true,
|
||||
cwd = require("conform.util").root_file({ ".git" }),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"3rd/image.nvim",
|
||||
opts = {
|
||||
backend = "kitty",
|
||||
processor = "magick_cli",
|
||||
integrations = {
|
||||
markdown = {
|
||||
enabled = true,
|
||||
clear_in_insert_mode = false,
|
||||
download_remote_images = true,
|
||||
only_render_image_at_cursor = false,
|
||||
floating_windows = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"kdheepak/lazygit.nvim",
|
||||
lazy = false,
|
||||
cmd = {
|
||||
"LazyGit",
|
||||
"LazyGitConfig",
|
||||
"LazyGitCurrentFile",
|
||||
"LazyGitFilter",
|
||||
"LazyGitFilterCurrentFile",
|
||||
},
|
||||
-- optional for floating window border decoration
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
-- setting the keybinding for LazyGit with 'keys' is recommended in
|
||||
-- order to load the plugin when the command is run for the first time
|
||||
keys = {
|
||||
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"brianhuster/live-preview.nvim",
|
||||
dependencies = {
|
||||
-- You can choose one of the following pickers
|
||||
"ibhagwan/fzf-lua",
|
||||
},
|
||||
cmd = "LivePreview",
|
||||
keys = { { "<leader>cp", "<cmd>LivePreview close<cr><cmd>LivePreview start<cr>", desc = "Live Preview" } },
|
||||
opts = true,
|
||||
enabled = true,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
local util = require("lspconfig.util")
|
||||
|
||||
return {
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "LazyFile",
|
||||
opts = {
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.uv.fs_stat(path .. "/.luarc.json") or vim.uv.fs_stat(path .. "/.luarc.jsonc") then
|
||||
return
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME,
|
||||
-- Depending on the usage, you might want to add additional paths here.
|
||||
"${3rd}/luv/library",
|
||||
-- "${3rd}/busted/library",
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
ui = {
|
||||
windows = {
|
||||
default_options = {
|
||||
border = "rounded",
|
||||
},
|
||||
},
|
||||
},
|
||||
servers = {
|
||||
-- biome = {
|
||||
-- root_dir = function(fname)
|
||||
-- return util.root_pattern("biome.json", "biome.jsonc")(fname)
|
||||
-- or util.find_package_json_ancestor(fname)
|
||||
-- or vim.fs.find("node_modules", { path = fname, upward = true })[1]
|
||||
-- or util.find_node_modules_ancestor(fname)
|
||||
-- or util.find_git_ancestor(fname)
|
||||
-- end,
|
||||
-- },
|
||||
nil_ls = false,
|
||||
nginx_language_server = {
|
||||
cmd = { "nginx-language-server" },
|
||||
filetypes = { "nginx" },
|
||||
rootPatterns = { "biome.json", "biome.jsonc" },
|
||||
},
|
||||
volar = {
|
||||
init_options = {
|
||||
vue = {
|
||||
hybridMode = true,
|
||||
},
|
||||
},
|
||||
settings = {
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
enumMemberValues = {
|
||||
enabled = true,
|
||||
},
|
||||
functionLikeReturnTypes = {
|
||||
enabled = true,
|
||||
},
|
||||
propertyDeclarationTypes = {
|
||||
enabled = true,
|
||||
},
|
||||
parameterTypes = {
|
||||
enabled = true,
|
||||
suppressWhenArgumentMatchesName = true,
|
||||
},
|
||||
variableTypes = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
vtsls = {},
|
||||
stylelint_lsp = {
|
||||
filetypes = { "css", "scss", "vue" },
|
||||
root_dir = util.root_pattern("packages.json", ".git"),
|
||||
debounce = 100,
|
||||
settings = {
|
||||
stylelintplus = {
|
||||
autoFixOnFormat = true,
|
||||
autoFixOnSave = true,
|
||||
},
|
||||
},
|
||||
on_attach = function(client)
|
||||
client.server_capabilities.document_formatting = false
|
||||
end,
|
||||
},
|
||||
svls = {
|
||||
root_dir = function(fname)
|
||||
return vim.fs.dirname(vim.fs.find(".git", { path = fname, upward = true })[1])
|
||||
end,
|
||||
cmd = { "verible-verilog-ls", "--rules_config_search" },
|
||||
filetypes = { "verilog", "systemverilog" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"folke/noice.nvim",
|
||||
opts = {
|
||||
presets = {
|
||||
lsp_doc_border = true,
|
||||
},
|
||||
lsp = {
|
||||
override = {
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
views = {
|
||||
hover = {
|
||||
border = {
|
||||
style = "rounded",
|
||||
},
|
||||
},
|
||||
confirm = {
|
||||
border = {
|
||||
style = "rounded",
|
||||
},
|
||||
},
|
||||
popup = {
|
||||
border = {
|
||||
style = "rounded",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"rcarriga/nvim-notify",
|
||||
opts = {
|
||||
stages = "slide",
|
||||
render = "wrapped-compact",
|
||||
timeout = 2000,
|
||||
top_down = false,
|
||||
fps = 40,
|
||||
background_colour = "#000000",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
local pattern = "[^:]+:(%d+):(%d+):(%w+):(.+)"
|
||||
local groups = { "lnum", "col", "code", "message" }
|
||||
|
||||
return {
|
||||
{
|
||||
"mfussenegger/nvim-lint",
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
-- verilog = { "verible" },
|
||||
},
|
||||
linters = {
|
||||
verible = {
|
||||
cmd = "verible-verilog-lint",
|
||||
stdin = false,
|
||||
args = { "--rules_config_search" },
|
||||
stream = nil,
|
||||
ignore_exitcode = false,
|
||||
env = nil,
|
||||
parser = require("lint.parser").from_pattern(pattern, groups),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
local handler = function(virtText, lnum, endLnum, width, truncate)
|
||||
local newVirtText = {}
|
||||
local suffix = (" %d "):format(endLnum - lnum)
|
||||
local sufWidth = vim.fn.strdisplaywidth(suffix)
|
||||
local targetWidth = width - sufWidth
|
||||
local curWidth = 0
|
||||
for _, chunk in ipairs(virtText) do
|
||||
local chunkText = chunk[1]
|
||||
local chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
if targetWidth > curWidth + chunkWidth then
|
||||
table.insert(newVirtText, chunk)
|
||||
else
|
||||
chunkText = truncate(chunkText, targetWidth - curWidth)
|
||||
local hlGroup = chunk[2]
|
||||
table.insert(newVirtText, { chunkText, hlGroup })
|
||||
chunkWidth = vim.fn.strdisplaywidth(chunkText)
|
||||
-- str width returned from truncate() may less than 2nd argument, need padding
|
||||
if curWidth + chunkWidth < targetWidth then
|
||||
suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth)
|
||||
end
|
||||
break
|
||||
end
|
||||
curWidth = curWidth + chunkWidth
|
||||
end
|
||||
table.insert(newVirtText, { suffix, "MoreMsg" })
|
||||
return newVirtText
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
"kevinhwang91/nvim-ufo",
|
||||
dependencies = { "kevinhwang91/promise-async" },
|
||||
opts = {
|
||||
provider_selector = function()
|
||||
return { "lsp", "indent" }
|
||||
end,
|
||||
fold_virt_text_handler = handler,
|
||||
filetype_exclude = { "help", "alpha", "dashboard", "neo-tree", "Trouble", "lazy", "mason" },
|
||||
},
|
||||
config = function(_, opts)
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = vim.api.nvim_create_augroup("local_detach_ufo", { clear = true }),
|
||||
pattern = opts.filetype_exclude,
|
||||
callback = function()
|
||||
require("ufo").detach()
|
||||
end,
|
||||
})
|
||||
|
||||
vim.o.foldcolumn = "1"
|
||||
vim.o.foldlevel = 99
|
||||
vim.o.foldlevelstart = 99
|
||||
vim.o.foldenable = true
|
||||
require("ufo").setup(opts)
|
||||
end,
|
||||
keys = {
|
||||
{
|
||||
"zR",
|
||||
mode = { "n" },
|
||||
function()
|
||||
require("ufo").openAllFolds()
|
||||
end,
|
||||
{ desc = "Open all folds" },
|
||||
},
|
||||
{
|
||||
"zM",
|
||||
mode = { "n" },
|
||||
function()
|
||||
require("ufo").closeAllFolds()
|
||||
end,
|
||||
{ desc = "Close all folds" },
|
||||
},
|
||||
{
|
||||
"zK",
|
||||
function()
|
||||
local winid = require("ufo").peekFoldedLinesUnderCursor()
|
||||
if not winid then
|
||||
vim.lsp.buf.hover()
|
||||
end
|
||||
end,
|
||||
{ desc = "Peek Fold" },
|
||||
},
|
||||
{
|
||||
"zr",
|
||||
mode = { "n" },
|
||||
function()
|
||||
require("ufo").openFoldsExceptKinds()
|
||||
end,
|
||||
{ desc = "Open fold" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"folke/snacks.nvim",
|
||||
opts = {
|
||||
explorer = {
|
||||
enabled = true,
|
||||
},
|
||||
image = {
|
||||
enabled = true,
|
||||
math = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
picker = {
|
||||
enabled = true,
|
||||
sources = {
|
||||
explorer = {
|
||||
layout = { layout = { position = "right" } },
|
||||
},
|
||||
files = {
|
||||
ignored = true,
|
||||
},
|
||||
git_files = {
|
||||
untracked = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
notifier = { enabled = true },
|
||||
dashboard = {
|
||||
enabled = true,
|
||||
width = 60,
|
||||
row = nil,
|
||||
col = nil,
|
||||
preset = {
|
||||
header = [[
|
||||
██████████ █████████ █████████ █████ █████ █████ █████ █████ █████
|
||||
░░███░░░░███ ███░░░░░███ ███░░░░░███░░███ ░░███ ░░███ ░░███ ░░███ ░░███
|
||||
░███ ░░███ ░███ ░███ ███ ░░░ ░███ ░███ ░░███ ███ ░░███ ███
|
||||
░███ ░███ ░███████████ ░███ ░███████████ ░░█████ ░░█████
|
||||
░███ ░███ ░███░░░░░███ ░███ ░███░░░░░███ ███░███ ░░███
|
||||
░███ ███ ░███ ░███ ░░███ ███ ░███ ░███ ███ ░░███ ░███
|
||||
██████████ █████ █████ ░░█████████ █████ █████ █████ █████ █████
|
||||
░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░]],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"lambdalisue/vim-suda",
|
||||
cmd = { "SudaWrite", "SudaRead" },
|
||||
keys = { { "<leader>bs", "<cmd>SudaWrite<cr>", desc = "Save Buffer as Root" } },
|
||||
},
|
||||
}
|
||||
|
|
@ -1,270 +0,0 @@
|
|||
return {
|
||||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
ft = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"typescript.tsx",
|
||||
},
|
||||
root = { "tsconfig.json", "package.json", "jsconfig.json" },
|
||||
})
|
||||
end,
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
--- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
|
||||
--- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
|
||||
tsserver = {
|
||||
enabled = false,
|
||||
},
|
||||
ts_ls = {
|
||||
enabled = false,
|
||||
},
|
||||
vtsls = {
|
||||
-- explicitly add default filetypes, so that we can extend
|
||||
-- them in related extras
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"typescript.tsx",
|
||||
},
|
||||
settings = {
|
||||
complete_function_calls = true,
|
||||
vtsls = {
|
||||
enableMoveToFileCodeAction = true,
|
||||
autoUseWorkspaceTsdk = true,
|
||||
experimental = {
|
||||
maxInlayHintLength = 30,
|
||||
completion = {
|
||||
enableServerSideFuzzyMatch = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
typescript = {
|
||||
updateImportsOnFileMove = { enabled = "always" },
|
||||
suggest = {
|
||||
completeFunctionCalls = true,
|
||||
},
|
||||
inlayHints = {
|
||||
enumMemberValues = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
parameterNames = { enabled = "literals" },
|
||||
parameterTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
variableTypes = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"gD",
|
||||
function()
|
||||
local params = vim.lsp.util.make_position_params()
|
||||
LazyVim.lsp.execute({
|
||||
command = "typescript.goToSourceDefinition",
|
||||
arguments = { params.textDocument.uri, params.position },
|
||||
open = true,
|
||||
})
|
||||
end,
|
||||
desc = "Goto Source Definition",
|
||||
},
|
||||
{
|
||||
"gR",
|
||||
function()
|
||||
LazyVim.lsp.execute({
|
||||
command = "typescript.findAllFileReferences",
|
||||
arguments = { vim.uri_from_bufnr(0) },
|
||||
open = true,
|
||||
})
|
||||
end,
|
||||
desc = "File References",
|
||||
},
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
{
|
||||
"<leader>cM",
|
||||
LazyVim.lsp.action["source.addMissingImports.ts"],
|
||||
desc = "Add missing imports",
|
||||
},
|
||||
{
|
||||
"<leader>cu",
|
||||
LazyVim.lsp.action["source.removeUnused.ts"],
|
||||
desc = "Remove unused imports",
|
||||
},
|
||||
{
|
||||
"<leader>cD",
|
||||
LazyVim.lsp.action["source.fixAll.ts"],
|
||||
desc = "Fix all diagnostics",
|
||||
},
|
||||
{
|
||||
"<leader>cV",
|
||||
function()
|
||||
LazyVim.lsp.execute({ command = "typescript.selectTypeScriptVersion" })
|
||||
end,
|
||||
desc = "Select TS workspace version",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
setup = {
|
||||
--- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
|
||||
--- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
|
||||
tsserver = function()
|
||||
-- disable tsserver
|
||||
return true
|
||||
end,
|
||||
ts_ls = function()
|
||||
-- disable tsserver
|
||||
return true
|
||||
end,
|
||||
vtsls = function(_, opts)
|
||||
LazyVim.lsp.on_attach(function(client, buffer)
|
||||
client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx)
|
||||
---@type string, string, lsp.Range
|
||||
local action, uri, range = unpack(command.arguments)
|
||||
|
||||
local function move(newf)
|
||||
client.request("workspace/executeCommand", {
|
||||
command = command.command,
|
||||
arguments = { action, uri, range, newf },
|
||||
})
|
||||
end
|
||||
|
||||
local fname = vim.uri_to_fname(uri)
|
||||
client.request("workspace/executeCommand", {
|
||||
command = "typescript.tsserverRequest",
|
||||
arguments = {
|
||||
"getMoveToRefactoringFileSuggestions",
|
||||
{
|
||||
file = fname,
|
||||
startLine = range.start.line + 1,
|
||||
startOffset = range.start.character + 1,
|
||||
endLine = range["end"].line + 1,
|
||||
endOffset = range["end"].character + 1,
|
||||
},
|
||||
},
|
||||
}, function(_, result)
|
||||
---@type string[]
|
||||
local files = result.body.files
|
||||
table.insert(files, 1, "Enter new path...")
|
||||
vim.ui.select(files, {
|
||||
prompt = "Select move destination:",
|
||||
format_item = function(f)
|
||||
return vim.fn.fnamemodify(f, ":~:.")
|
||||
end,
|
||||
}, function(f)
|
||||
if f and f:find("^Enter new path") then
|
||||
vim.ui.input({
|
||||
prompt = "Enter move destination:",
|
||||
default = vim.fn.fnamemodify(fname, ":h") .. "/",
|
||||
completion = "file",
|
||||
}, function(newf)
|
||||
return newf and move(newf)
|
||||
end)
|
||||
elseif f then
|
||||
move(f)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end, "vtsls")
|
||||
-- copy typescript settings to javascript
|
||||
opts.settings.javascript =
|
||||
vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {})
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
if not dap.adapters["pwa-node"] then
|
||||
require("dap").adapters["pwa-node"] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "js-debug",
|
||||
args = {
|
||||
"${port}",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
if not dap.adapters["node"] then
|
||||
dap.adapters["node"] = function(cb, config)
|
||||
if config.type == "node" then
|
||||
config.type = "pwa-node"
|
||||
end
|
||||
local nativeAdapter = dap.adapters["pwa-node"]
|
||||
if type(nativeAdapter) == "function" then
|
||||
nativeAdapter(cb, config)
|
||||
else
|
||||
cb(nativeAdapter)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
|
||||
|
||||
local vscode = require("dap.ext.vscode")
|
||||
vscode.type_to_filetypes["node"] = js_filetypes
|
||||
vscode.type_to_filetypes["pwa-node"] = js_filetypes
|
||||
|
||||
for _, language in ipairs(js_filetypes) do
|
||||
if not dap.configurations[language] then
|
||||
dap.configurations[language] = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}",
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
-- Filetype icons
|
||||
{
|
||||
"echasnovski/mini.icons",
|
||||
opts = {
|
||||
file = {
|
||||
[".eslintrc.js"] = { glyph = "", hl = "MiniIconsYellow" },
|
||||
[".node-version"] = { glyph = "", hl = "MiniIconsGreen" },
|
||||
[".prettierrc"] = { glyph = "", hl = "MiniIconsPurple" },
|
||||
[".yarnrc.yml"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
["eslint.config.js"] = { glyph = "", hl = "MiniIconsYellow" },
|
||||
["package.json"] = { glyph = "", hl = "MiniIconsGreen" },
|
||||
["tsconfig.json"] = { glyph = "", hl = "MiniIconsAzure" },
|
||||
["tsconfig.build.json"] = { glyph = "", hl = "MiniIconsAzure" },
|
||||
["yarn.lock"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
config = function() end,
|
||||
},
|
||||
{
|
||||
"linux-cultist/venv-selector.nvim",
|
||||
dependencies = {
|
||||
"neovim/nvim-lspconfig",
|
||||
"mfussenegger/nvim-dap",
|
||||
"mfussenegger/nvim-dap-python", --optional
|
||||
{ "nvim-telescope/telescope.nvim", branch = "0.1.x", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
},
|
||||
lazy = false,
|
||||
branch = "regexp", -- This is the regexp branch, use this for the new version
|
||||
config = function()
|
||||
require("venv-selector").setup()
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>cv", "<cmd>VenvSelect<cr>" },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"elkowar/yuck.vim",
|
||||
},
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
Loading…
Add table
Add a link
Reference in a new issue