nvim-upgrade (#4)
Reviewed-on: #4 Co-authored-by: Tomas Mirchev <contact@tomastm.com> Co-committed-by: Tomas Mirchev <contact@tomastm.com>
This commit was merged in pull request #4.
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
return { -- Autoformat
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
cmd = { "ConformInfo" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_format = "fallback" })
|
||||
end,
|
||||
mode = "",
|
||||
desc = "[F]ormat buffer",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
local lsp_format_opt
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
lsp_format_opt = "never"
|
||||
else
|
||||
lsp_format_opt = "fallback"
|
||||
end
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_format = lsp_format_opt,
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
sh = { "shfmt" },
|
||||
swift = { "swift_format" },
|
||||
python = { "isort", "black", stop_after_first = true },
|
||||
javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||
javascriptreact = { "prettierd", "prettier", stop_after_first = true },
|
||||
typescript = { "prettierd", "prettier", stop_after_first = true },
|
||||
typescriptreact = { "prettierd", "prettier", stop_after_first = true },
|
||||
},
|
||||
formatters = {
|
||||
shfmt = {
|
||||
prepend_args = { "-i", "4", "-ci" }, -- 4 spaces, indent cases
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
-- Optional dependency
|
||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||
config = function()
|
||||
require('nvim-autopairs').setup {}
|
||||
-- If you want to automatically add `(` after selecting a function or method
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
return {
|
||||
"windwp/nvim-ts-autotag",
|
||||
opts = {
|
||||
autotag = {
|
||||
enable = true,
|
||||
enable_close = true,
|
||||
enable_rename = true,
|
||||
enable_close_on_slash = true,
|
||||
},
|
||||
},
|
||||
}
|
||||
26
config/linux-dev/nvim/lua/plugins/colorscheme.lua
Normal file
26
config/linux-dev/nvim/lua/plugins/colorscheme.lua
Normal file
@@ -0,0 +1,26 @@
|
||||
return {
|
||||
'triimdev/invero.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
dev = true,
|
||||
config = function()
|
||||
vim.api.nvim_create_user_command('ReloadInvero', function()
|
||||
require('invero').invalidate_cache()
|
||||
vim.cmd('Lazy reload invero.nvim')
|
||||
end, {})
|
||||
|
||||
require('invero').setup({
|
||||
highlights = function(c, tool)
|
||||
c.bg_float = tool(152)
|
||||
return {
|
||||
WinSeparator = { fg = c.outline, bg = c.base },
|
||||
StatusLine = { fg = c.outline, bg = c.base },
|
||||
StatusLineNC = { fg = c.text, bg = c.base, bold = true },
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
||||
vim.o.background = 'light'
|
||||
vim.cmd.colorscheme('invero')
|
||||
end,
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
cmp.setup({
|
||||
window = {
|
||||
completion = {
|
||||
border = "single",
|
||||
-- or border = true for default border
|
||||
},
|
||||
documentation = {
|
||||
border = "single",
|
||||
},
|
||||
},
|
||||
completion = { completeopt = "menu,menuone,noselect" }, -- This ensures nothing is auto-selected
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- from language server
|
||||
{ name = "buffer" }, -- from current buffer
|
||||
{ name = "path" }, -- for file paths
|
||||
}),
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-e>"] = cmp.mapping.abort(), -- This closes the completion menu
|
||||
|
||||
["<C-u>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() and cmp.get_selected_entry() then
|
||||
cmp.scroll_docs(-4)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-d>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() and cmp.get_selected_entry() then
|
||||
cmp.scroll_docs(4)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
}),
|
||||
})
|
||||
end,
|
||||
}
|
||||
148
config/linux-dev/nvim/lua/plugins/filetree.lua
Normal file
148
config/linux-dev/nvim/lua/plugins/filetree.lua
Normal file
@@ -0,0 +1,148 @@
|
||||
local function my_on_attach(bufnr)
|
||||
local api = require('nvim-tree.api')
|
||||
local opts = { buffer = bufnr }
|
||||
|
||||
-- basics: copy/cut/paste/create/rename/remove
|
||||
vim.keymap.set('n', 'c', api.fs.copy.node, opts)
|
||||
vim.keymap.set('n', 'x', api.fs.cut, opts)
|
||||
vim.keymap.set('n', 'p', api.fs.paste, opts)
|
||||
vim.keymap.set('n', 'a', api.fs.create, opts)
|
||||
vim.keymap.set('n', 'r', api.fs.rename, opts)
|
||||
vim.keymap.set('n', 'R', api.fs.rename_basename, opts)
|
||||
vim.keymap.set('n', 'd', api.fs.remove, opts)
|
||||
|
||||
-- bulk mark and delete/move
|
||||
vim.keymap.set('n', 's', api.marks.toggle, opts)
|
||||
vim.keymap.set('n', 'S', api.marks.clear, opts)
|
||||
vim.keymap.set('n', 'bd', api.marks.bulk.delete, opts)
|
||||
vim.keymap.set('n', 'bm', api.marks.bulk.move, opts)
|
||||
|
||||
-- copy filename/path
|
||||
vim.keymap.set('n', 'y', api.fs.copy.filename, opts)
|
||||
vim.keymap.set('n', 'Y', api.fs.copy.relative_path, opts)
|
||||
vim.keymap.set('n', 'gy', api.fs.copy.absolute_path, opts)
|
||||
vim.keymap.set('n', 'ge', api.fs.copy.basename, opts)
|
||||
|
||||
-- expand/collapse
|
||||
vim.keymap.set('n', 'e', api.tree.expand_all, opts)
|
||||
vim.keymap.set('n', 'E', api.tree.collapse_all, opts)
|
||||
|
||||
-- filter
|
||||
vim.keymap.set('n', 'f', api.live_filter.start, opts)
|
||||
vim.keymap.set('n', 'F', api.live_filter.clear, opts)
|
||||
|
||||
-- navigate
|
||||
vim.keymap.set('n', 'J', api.node.navigate.sibling.last, opts)
|
||||
vim.keymap.set('n', 'K', api.node.navigate.sibling.first, opts)
|
||||
vim.keymap.set('n', 'P', api.node.navigate.parent, opts)
|
||||
|
||||
-- open
|
||||
vim.keymap.set('n', '<CR>', api.node.open.edit, opts)
|
||||
vim.keymap.set('n', 'o', api.node.open.edit, opts)
|
||||
vim.keymap.set('n', 'O', api.node.open.no_window_picker, opts)
|
||||
|
||||
-- miscellaneous
|
||||
vim.keymap.set('n', 'K', api.node.show_info_popup, opts)
|
||||
vim.keymap.set('n', 'U', api.tree.reload, opts)
|
||||
end
|
||||
|
||||
return {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
version = '*',
|
||||
dev = true,
|
||||
opts = {
|
||||
on_attach = my_on_attach,
|
||||
view = { signcolumn = 'no' },
|
||||
actions = { file_popup = { open_win_config = { border = 'rounded' } } },
|
||||
renderer = {
|
||||
root_folder_label = false,
|
||||
-- root_folder_label = function(path)
|
||||
-- return '-- ' .. vim.fn.fnamemodify(path, ':t') .. ' --'
|
||||
-- end,
|
||||
special_files = {},
|
||||
|
||||
highlight_hidden = 'all',
|
||||
highlight_clipboard = 'all',
|
||||
|
||||
indent_markers = {
|
||||
enable = true,
|
||||
inline_arrows = false,
|
||||
icons = { corner = '│', none = '│', bottom = ' ' },
|
||||
},
|
||||
icons = {
|
||||
bookmarks_placement = 'after',
|
||||
git_placement = 'after',
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = false, -- KEEP FALSE
|
||||
git = true,
|
||||
modified = false,
|
||||
hidden = false,
|
||||
diagnostics = false,
|
||||
bookmarks = true,
|
||||
},
|
||||
glyphs = {
|
||||
-- default = '•',
|
||||
default = ' ',
|
||||
symlink = '',
|
||||
bookmark = '',
|
||||
modified = '●',
|
||||
hidden = '',
|
||||
folder = {
|
||||
arrow_closed = '',
|
||||
arrow_open = '',
|
||||
default = '▸',
|
||||
open = '▾',
|
||||
empty = '',
|
||||
empty_open = '',
|
||||
symlink = '',
|
||||
symlink_open = '',
|
||||
},
|
||||
|
||||
git = {
|
||||
unstaged = '◇', -- '✗',
|
||||
staged = '',
|
||||
unmerged = '',
|
||||
renamed = '',
|
||||
untracked = '',
|
||||
deleted = '', -- '',
|
||||
ignored = '',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
hijack_cursor = true,
|
||||
prefer_startup_root = true,
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = { enable = true, ignore_list = {} },
|
||||
exclude = false,
|
||||
},
|
||||
modified = { enable = true, show_on_dirs = true, show_on_open_dirs = true },
|
||||
filters = {
|
||||
enable = true,
|
||||
git_ignored = true,
|
||||
dotfiles = false,
|
||||
git_clean = false,
|
||||
no_buffer = false,
|
||||
no_bookmark = false,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true,
|
||||
debounce_delay = 50,
|
||||
ignore_dirs = {
|
||||
'/.git',
|
||||
'/.DS_Store',
|
||||
'/build',
|
||||
'/dist',
|
||||
'/public',
|
||||
'/node_modules',
|
||||
'/target',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
opts = {
|
||||
menu = {
|
||||
width = vim.api.nvim_win_get_width(0) - 4,
|
||||
},
|
||||
settings = {
|
||||
save_on_toggle = true,
|
||||
},
|
||||
},
|
||||
keys = function()
|
||||
local keys = {
|
||||
{
|
||||
"<leader>H",
|
||||
function()
|
||||
require("harpoon"):list():add()
|
||||
end,
|
||||
desc = "Harpoon File",
|
||||
},
|
||||
{
|
||||
"<leader>h",
|
||||
function()
|
||||
local harpoon = require("harpoon")
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end,
|
||||
desc = "Harpoon Quick Menu",
|
||||
},
|
||||
}
|
||||
|
||||
for i = 1, 5 do
|
||||
table.insert(keys, {
|
||||
"<C-" .. i .. ">",
|
||||
function()
|
||||
require("harpoon"):list():select(i)
|
||||
end,
|
||||
desc = "Harpoon to File " .. i,
|
||||
})
|
||||
end
|
||||
return keys
|
||||
end,
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
local remap = require("utils.remap")
|
||||
|
||||
vim.diagnostic.config({
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
source = true,
|
||||
},
|
||||
float = {
|
||||
border = "rounded",
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
|
||||
border = "rounded",
|
||||
})
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
border = "rounded",
|
||||
})
|
||||
|
||||
return {
|
||||
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim", version = "1.8.0", config = true },
|
||||
{ "williamboman/mason-lspconfig.nvim", version = "1.31.0"},
|
||||
{ "j-hui/fidget.nvim", opts = {} }, -- side fidget showing status
|
||||
"hrsh7th/cmp-nvim-lsp", -- completion
|
||||
"b0o/schemastore.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("mason").setup({
|
||||
ui = {
|
||||
border = "rounded",
|
||||
backdrop = 0
|
||||
},
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup()
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
|
||||
require("lspconfig.ui.windows").default_options = {
|
||||
border = "rounded",
|
||||
}
|
||||
|
||||
lspconfig.ts_ls.setup({
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
preferences = {
|
||||
includeCompletionsWithSnippetText = true,
|
||||
jsxAttributeCompletionStyle = "auto",
|
||||
},
|
||||
},
|
||||
on_attach = function(client, bufnr)
|
||||
-- Mappings
|
||||
local opts = { buffer = bufnr }
|
||||
remap.nmap("gd", vim.lsp.buf.definition, opts)
|
||||
remap.nmap("gr", vim.lsp.buf.references, opts)
|
||||
|
||||
remap.nmap("K", vim.lsp.buf.hover, opts)
|
||||
|
||||
remap.nmap("<leader>rn", vim.lsp.buf.rename, opts)
|
||||
remap.nmap("<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
remap.nmap("<leader>ri", function()
|
||||
local diagnostics = vim.diagnostic.get(0)
|
||||
|
||||
-- Filter for TypeScript's unused import diagnostics (code 6133)
|
||||
local unused_imports_diagnostics = {}
|
||||
for _, diagnostic in ipairs(diagnostics) do
|
||||
if diagnostic.code == 6133 and diagnostic.source == "typescript" then
|
||||
table.insert(unused_imports_diagnostics, diagnostic)
|
||||
end
|
||||
end
|
||||
|
||||
vim.lsp.buf.code_action({
|
||||
context = {
|
||||
diagnostics = unused_imports_diagnostics,
|
||||
only = { "source.removeUnusedImports" },
|
||||
},
|
||||
})
|
||||
end, { desc = "Remove unused imports" })
|
||||
|
||||
remap.nmap("[d", vim.diagnostic.goto_prev, opts)
|
||||
remap.nmap("]d", vim.diagnostic.goto_next, opts)
|
||||
remap.nmap("<leader>d", vim.diagnostic.open_float, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
lspconfig.eslint.setup({})
|
||||
lspconfig.html.setup({})
|
||||
lspconfig.cssls.setup({})
|
||||
lspconfig.jsonls.setup({
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require("schemastore").json.schemas(),
|
||||
validate = { enable = true },
|
||||
allowComments = true,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -1,212 +0,0 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ "<Leader>et", ":NvimTreeToggle<CR>", desc = "Explorer Toggle", silent = true },
|
||||
{
|
||||
"<Leader>ei",
|
||||
function()
|
||||
require("nvim-tree.api").node.show_info_popup()
|
||||
end,
|
||||
desc = "NvimTree: Info",
|
||||
mode = "n",
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
local function my_on_attach(bufnr)
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
|
||||
api.config.mappings.default_on_attach(bufnr)
|
||||
vim.keymap.set("n", "<Leader>et", api.tree.toggle, opts("Open or close the tree"))
|
||||
vim.keymap.set("n", "<Leader>ei", api.node.show_info_popup, opts("Show info popup"))
|
||||
vim.keymap.set("n", "?", api.tree.toggle_help, opts("Help"))
|
||||
|
||||
vim.keymap.del("n", "<C-k>", { buffer = bufnr })
|
||||
end
|
||||
|
||||
require("nvim-tree").setup({
|
||||
on_attach = my_on_attach,
|
||||
hijack_cursor = true,
|
||||
disable_netrw = true,
|
||||
hijack_netrw = true,
|
||||
hijack_unnamed_buffer_when_opening = true,
|
||||
root_dirs = { ".git", "package.json" },
|
||||
prefer_startup_root = true,
|
||||
sync_root_with_cwd = true,
|
||||
reload_on_bufenter = true,
|
||||
respect_buf_cwd = true,
|
||||
view = {
|
||||
centralize_selection = false,
|
||||
cursorline = true,
|
||||
cursorlineopt = "both",
|
||||
debounce_delay = 15,
|
||||
side = "left",
|
||||
preserve_window_proportions = false,
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
signcolumn = "no",
|
||||
width = 30,
|
||||
},
|
||||
renderer = {
|
||||
add_trailing = false,
|
||||
group_empty = false,
|
||||
full_name = false,
|
||||
root_folder_label = false,
|
||||
-- special_files = { "Cargo.toml", "Makefile", "README.md", "readme.md" },
|
||||
special_files = {}, -- keep to overwrite defaults
|
||||
symlink_destination = true,
|
||||
icons = {
|
||||
padding = "",
|
||||
glyphs = {
|
||||
folder = {
|
||||
arrow_closed = "+",
|
||||
arrow_open = "-",
|
||||
},
|
||||
},
|
||||
show = {
|
||||
file = false,
|
||||
folder = false,
|
||||
folder_arrow = true,
|
||||
git = false,
|
||||
modified = false,
|
||||
hidden = false,
|
||||
diagnostics = false,
|
||||
bookmarks = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
hijack_directories = {
|
||||
enable = true,
|
||||
auto_open = true,
|
||||
},
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
update_root = {
|
||||
enable = true,
|
||||
ignore_list = {},
|
||||
},
|
||||
exclude = false,
|
||||
},
|
||||
filters = {
|
||||
enable = true,
|
||||
git_ignored = true,
|
||||
dotfiles = false,
|
||||
git_clean = false,
|
||||
no_buffer = false,
|
||||
no_bookmark = false,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
live_filter = {
|
||||
prefix = "[FILTER]: ",
|
||||
always_show_folders = true,
|
||||
},
|
||||
filesystem_watchers = {
|
||||
enable = true,
|
||||
debounce_delay = 50,
|
||||
ignore_dirs = {
|
||||
-- C / C++
|
||||
"/.ccls-cache",
|
||||
"/build",
|
||||
"/out",
|
||||
"/cmake-build-*",
|
||||
|
||||
-- Node.js / Web
|
||||
"/node_modules",
|
||||
"/dist",
|
||||
"/.next",
|
||||
"/.nuxt",
|
||||
"/coverage",
|
||||
"/storybook-static",
|
||||
|
||||
-- Rust
|
||||
"/target",
|
||||
|
||||
-- Java / JVM
|
||||
"/target", -- (Maven)
|
||||
"/build", -- (Gradle)
|
||||
"/out", -- (IDEA / javac)
|
||||
|
||||
-- Python
|
||||
"/.venv",
|
||||
"/venv",
|
||||
"/__pycache__",
|
||||
"/.mypy_cache",
|
||||
"/.pytest_cache",
|
||||
|
||||
-- Go
|
||||
"/bin",
|
||||
"/pkg",
|
||||
|
||||
-- General
|
||||
"/tmp",
|
||||
"/.cache",
|
||||
"/.idea",
|
||||
"/.vscode",
|
||||
"/logs",
|
||||
},
|
||||
},
|
||||
trash = {
|
||||
cmd = "gio trash",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
-- return {
|
||||
-- "nvim-neo-tree/neo-tree.nvim",
|
||||
-- version = "*",
|
||||
-- dependencies = {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- "nvim-tree/nvim-web-devicons",
|
||||
-- "MunifTanjim/nui.nvim",
|
||||
-- },
|
||||
-- cmd = "Neotree",
|
||||
-- keys = {
|
||||
-- { "<Leader>et", ":Neotree position=left toggle<CR>", desc = "Explorer Toggle", silent = true },
|
||||
-- { "<Leader>E", ":Neotree focus<CR>", desc = "Explorer Focus", silent = true },
|
||||
-- { "<Leader>ef", ":Neotree float<CR>", desc = "Explorer Float", silent = true },
|
||||
-- { "<Leader>eb", ":Neotree buffers<CR>", desc = "Explorer Buffers", silent = true },
|
||||
-- { "<Leader>eg", ":Neotree git_status<CR>", desc = "Explorer Git", silent = true },
|
||||
-- },
|
||||
-- opts = {
|
||||
-- event_handlers = {
|
||||
-- {
|
||||
-- event = require("neo-tree.ui.events").NEO_TREE_WINDOW_AFTER_OPEN,
|
||||
-- handler = function(args)
|
||||
-- if args and args.winid and vim.api.nvim_win_is_valid(args.winid) then
|
||||
-- vim.api.nvim_win_set_option(args.winid, "colorcolumn", "")
|
||||
-- vim.api.nvim_win_set_option(args.winid, "signcolumn", "no")
|
||||
-- end
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- popup_border_style = "single",
|
||||
-- window = {
|
||||
-- mappings = {
|
||||
-- ["<Leader>e"] = "close_window",
|
||||
-- },
|
||||
-- },
|
||||
-- default_component_configs = {
|
||||
-- icon = { enabled = false },
|
||||
-- git_status = { symbols = {}, align = "none" },
|
||||
-- name = { trailing_slash = true }
|
||||
-- },
|
||||
-- enable_git_status = false,
|
||||
-- enable_diagnostics = false,
|
||||
-- filesystem = {
|
||||
-- follow_current_file = {
|
||||
-- enabled = true, -- Enable this feature
|
||||
-- leave_dirs_open = true, -- Leave directories open when following
|
||||
-- },
|
||||
-- filtered_items = {
|
||||
-- visible = true,
|
||||
-- }
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
127
config/linux-dev/nvim/lua/plugins/syntax.lua
Normal file
127
config/linux-dev/nvim/lua/plugins/syntax.lua
Normal file
@@ -0,0 +1,127 @@
|
||||
vim.keymap.set('n', '<leader>d', vim.diagnostic.open_float, { noremap = true, silent = true })
|
||||
|
||||
vim.diagnostic.config({
|
||||
update_in_insert = false,
|
||||
virtual_text = {
|
||||
prefix = '', -- remove annoying ▎ etc
|
||||
format = function(diagnostic)
|
||||
if diagnostic.source then
|
||||
return string.format('[%s] %s', diagnostic.source, diagnostic.message)
|
||||
end
|
||||
return diagnostic.message
|
||||
end,
|
||||
},
|
||||
float = {
|
||||
border = 'rounded',
|
||||
source = true, -- show source in floating window too
|
||||
},
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
vim.lsp.enable({ 'lua_ls' })
|
||||
vim.lsp.enable({ 'json_ls' })
|
||||
|
||||
return {
|
||||
{ 'mason-org/mason.nvim', config = true },
|
||||
{ 'windwp/nvim-ts-autotag', config = true },
|
||||
{ 'windwp/nvim-autopairs', event = 'InsertEnter', config = true },
|
||||
|
||||
-- { 'saghen/blink.cmp', version = '1.*' },
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
main = 'nvim-treesitter.configs',
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
incremental_selection = { enable = true },
|
||||
textobjects = { enable = true },
|
||||
ensure_installed = {
|
||||
-- Documentation
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
-- Data
|
||||
'gitcommit',
|
||||
'gitignore',
|
||||
'dockerfile',
|
||||
'diff',
|
||||
'json',
|
||||
'jsonc',
|
||||
-- Scripting
|
||||
'bash',
|
||||
'lua',
|
||||
'sql',
|
||||
-- Programming
|
||||
'c',
|
||||
'cpp',
|
||||
'go',
|
||||
'rust',
|
||||
'python',
|
||||
-- Web
|
||||
'html',
|
||||
'css',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'tsx',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'mfussenegger/nvim-lint',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
opts = {
|
||||
linters_by_ft = {
|
||||
lua = { 'luacheck' },
|
||||
python = { 'ruff' },
|
||||
javascript = { 'eslint_d' },
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local lint = require('lint')
|
||||
lint.linters_by_ft = opts.linters_by_ft
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = vim.api.nvim_create_augroup('lint_autocmd', { clear = true }),
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
opts = {
|
||||
-- Automatically format on save
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_format = 'fallback', -- Use LSP when no formatter is configured
|
||||
},
|
||||
|
||||
-- Formatters per filetype
|
||||
default_format_opts = { stop_after_first = true },
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
sh = { 'shfmt' },
|
||||
swift = { 'swift_format' },
|
||||
python = { 'isort', 'black' },
|
||||
javascript = { 'prettierd', 'prettier' },
|
||||
javascriptreact = { 'prettierd', 'prettier' },
|
||||
typescript = { 'prettierd', 'prettier' },
|
||||
typescriptreact = { 'prettierd', 'prettier' },
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require('conform').setup(opts)
|
||||
|
||||
-- Create a command to format manually
|
||||
vim.api.nvim_create_user_command('Format', function()
|
||||
require('conform').format({
|
||||
async = true,
|
||||
lsp_format = 'fallback',
|
||||
})
|
||||
end, { desc = 'Format current buffer' })
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
local remap = require("utils.remap")
|
||||
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "make",
|
||||
cond = function()
|
||||
return vim.fn.executable("make") == 1
|
||||
end,
|
||||
},
|
||||
{ "nvim-telescope/telescope-ui-select.nvim" },
|
||||
-- { "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
layout_strategy = "vertical",
|
||||
layout_config = {
|
||||
width = { 0.95, max = 100 },
|
||||
height = 0.95,
|
||||
preview_cutoff = 1,
|
||||
preview_height = 0.7,
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
["d"] = "delete_buffer",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
remap.nmap("<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
remap.nmap("<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
remap.nmap("<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
remap.nmap("<leader>ss", builtin.current_buffer_fuzzy_find, { desc = "[S]earch [C]urrent file" })
|
||||
remap.nmap("<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
remap.nmap("<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
remap.nmap("<leader>sr", builtin.lsp_references, { desc = "[S]earch [R]references" })
|
||||
remap.nmap("<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
-- remap.nmap("<leader>ss", builtin.git_status, { desc = "[S]earch Git [S]tatus" })
|
||||
remap.nmap("<leader><leader>", builtin.buffers, { desc = "Find existing [B]uffers" })
|
||||
end,
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = "TSUpdate",
|
||||
main = "nvim-treesitter.configs",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"diff",
|
||||
"lua",
|
||||
"html",
|
||||
"css",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"tsx",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
},
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = { enable = true },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
-- Add MDX filetype detection
|
||||
vim.filetype.add({
|
||||
extension = {
|
||||
mdx = "markdown.mdx",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user