apply josean patches 2
This commit is contained in:
@@ -1,36 +1,36 @@
|
|||||||
return {
|
return {
|
||||||
"goolord/alpha-nvim",
|
"goolord/alpha-nvim",
|
||||||
event = "VimEnter",
|
event = "VimEnter",
|
||||||
config = function()
|
config = function()
|
||||||
local alpha = require("alpha")
|
local alpha = require("alpha")
|
||||||
local dashboard = require("alpha.themes.dashboard")
|
local dashboard = require("alpha.themes.dashboard")
|
||||||
|
|
||||||
-- Set header
|
-- Set header
|
||||||
dashboard.section.header.val = {
|
dashboard.section.header.val = {
|
||||||
" ",
|
" ",
|
||||||
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
|
" ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ",
|
||||||
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
|
" ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ",
|
||||||
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
|
" ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ",
|
||||||
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
|
" ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ",
|
||||||
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
" ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ",
|
||||||
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
" ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ",
|
||||||
" ",
|
" ",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Set menu
|
-- Set menu
|
||||||
dashboard.section.buttons.val = {
|
dashboard.section.buttons.val = {
|
||||||
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
|
dashboard.button("e", " > New File", "<cmd>ene<CR>"),
|
||||||
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
|
dashboard.button("SPC ee", " > Toggle file explorer", "<cmd>NvimTreeToggle<CR>"),
|
||||||
dashboard.button("SPC ff", " > Find File", "<cmd>Telescope find_files<CR>"),
|
dashboard.button("SPC ff", " > Find File", "<cmd>Telescope find_files<CR>"),
|
||||||
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
|
dashboard.button("SPC fs", " > Find Word", "<cmd>Telescope live_grep<CR>"),
|
||||||
dashboard.button("SPC wr", " > Restore Session For Current Directory", "<cmd>SessionRestore<CR>"),
|
dashboard.button("SPC wr", " > Restore Session For Current Directory", "<cmd>AutoSession restore<CR>"),
|
||||||
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
|
dashboard.button("q", " > Quit NVIM", "<cmd>qa<CR>"),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Send config to alpha
|
-- Send config to alpha
|
||||||
alpha.setup(dashboard.opts)
|
alpha.setup(dashboard.opts)
|
||||||
|
|
||||||
-- Disable folding on alpha buffer
|
-- Disable folding on alpha buffer
|
||||||
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
|
vim.cmd([[autocmd FileType alpha setlocal nofoldenable]])
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
return {
|
return {
|
||||||
"rmagatti/auto-session",
|
"rmagatti/auto-session",
|
||||||
config = function()
|
config = function()
|
||||||
local auto_session = require("auto-session")
|
local auto_session = require("auto-session")
|
||||||
|
|
||||||
auto_session.setup({
|
auto_session.setup({
|
||||||
auto_restore_enabled = false,
|
auto_restore_enabled = false,
|
||||||
auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" },
|
auto_session_suppress_dirs = { "~/", "~/Dev/", "~/Downloads", "~/Documents", "~/Desktop/" },
|
||||||
})
|
})
|
||||||
|
|
||||||
local keymap = vim.keymap
|
local keymap = vim.keymap
|
||||||
|
|
||||||
keymap.set("n", "<leader>wr", "<cmd>SessionRestore<CR>", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory
|
keymap.set("n", "<leader>wr", "<cmd>AutoSession restore<CR>", { desc = "Restore session for cwd" }) -- restore last workspace session for current directory
|
||||||
keymap.set("n", "<leader>ws", "<cmd>SessionSave<CR>", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory
|
keymap.set("n", "<leader>ws", "<cmd>AutoSession save<CR>", { desc = "Save session for auto session root dir" }) -- save workspace session for current working directory
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,39 @@
|
|||||||
return {
|
return {
|
||||||
"stevearc/conform.nvim",
|
"stevearc/conform.nvim",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local conform = require("conform")
|
local conform = require("conform")
|
||||||
|
|
||||||
conform.setup({
|
conform.setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
javascript = { "prettier" },
|
javascript = { "prettier" },
|
||||||
typescript = { "prettier" },
|
typescript = { "prettier" },
|
||||||
javascriptreact = { "prettier" },
|
javascriptreact = { "prettier" },
|
||||||
typescriptreact = { "prettier" },
|
typescriptreact = { "prettier" },
|
||||||
svelte = { "prettier" },
|
svelte = { "prettier" },
|
||||||
css = { "prettier" },
|
css = { "prettier" },
|
||||||
html = { "prettier" },
|
html = { "prettier" },
|
||||||
json = { "prettier" },
|
json = { "prettier" },
|
||||||
yaml = { "prettier" },
|
yaml = { "prettier" },
|
||||||
markdown = { "prettier" },
|
markdown = { "prettier" },
|
||||||
graphql = { "prettier" },
|
graphql = { "prettier" },
|
||||||
liquid = { "prettier" },
|
liquid = { "prettier" },
|
||||||
lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
python = { "isort", "black" },
|
python = { "isort", "black" },
|
||||||
},
|
},
|
||||||
format_on_save = {
|
format_on_save = {
|
||||||
lsp_fallback = true,
|
lsp_fallback = true,
|
||||||
async = false,
|
async = false,
|
||||||
timeout_ms = 1000,
|
timeout_ms = 3000,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
|
vim.keymap.set({ "n", "v" }, "<leader>mp", function()
|
||||||
conform.format({
|
conform.format({
|
||||||
lsp_fallback = true,
|
lsp_fallback = true,
|
||||||
async = false,
|
async = false,
|
||||||
timeout_ms = 1000,
|
timeout_ms = 1000,
|
||||||
})
|
})
|
||||||
end, { desc = "Format file or range (in visual mode)" })
|
end, { desc = "Format file or range (in visual mode)" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,29 +1,68 @@
|
|||||||
return {
|
return {
|
||||||
"mfussenegger/nvim-lint",
|
"mfussenegger/nvim-lint",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local lint = require("lint")
|
local lint = require("lint")
|
||||||
|
|
||||||
lint.linters_by_ft = {
|
lint.linters_by_ft = {
|
||||||
javascript = { "eslint_d" },
|
python = { "pylint" },
|
||||||
typescript = { "eslint_d" },
|
}
|
||||||
javascriptreact = { "eslint_d" },
|
|
||||||
typescriptreact = { "eslint_d" },
|
|
||||||
svelte = { "eslint_d" },
|
|
||||||
python = { "pylint" },
|
|
||||||
}
|
|
||||||
|
|
||||||
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true })
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
local function file_in_cwd(file_name)
|
||||||
group = lint_augroup,
|
return vim.fs.find(file_name, {
|
||||||
callback = function()
|
upward = true,
|
||||||
lint.try_lint()
|
stop = vim.loop.cwd():match("(.+)/"),
|
||||||
end,
|
path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)),
|
||||||
})
|
type = "file",
|
||||||
|
})[1]
|
||||||
|
end
|
||||||
|
|
||||||
vim.keymap.set("n", "<leader>l", function()
|
local function remove_linter(linters, linter_name)
|
||||||
lint.try_lint()
|
for k, v in pairs(linters) do
|
||||||
end, { desc = "Trigger linting for current file" })
|
if v == linter_name then
|
||||||
end,
|
linters[k] = nil
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function linter_in_linters(linters, linter_name)
|
||||||
|
for k, v in pairs(linters) do
|
||||||
|
if v == linter_name then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local function remove_linter_if_missing_config_file(linters, linter_name, config_file_name)
|
||||||
|
if linter_in_linters(linters, linter_name) and not file_in_cwd(config_file_name) then
|
||||||
|
remove_linter(linters, linter_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function try_linting()
|
||||||
|
local linters = lint.linters_by_ft[vim.bo.filetype]
|
||||||
|
|
||||||
|
-- if linters then
|
||||||
|
-- -- remove_linter_if_missing_config_file(linters, "eslint_d", ".eslintrc.cjs")
|
||||||
|
-- remove_linter_if_missing_config_file(linters, "eslint_d", "eslint.config.js")
|
||||||
|
-- end
|
||||||
|
|
||||||
|
lint.try_lint(linters)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWritePost", "InsertLeave" }, {
|
||||||
|
group = lint_augroup,
|
||||||
|
callback = function()
|
||||||
|
try_linting()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.keymap.set("n", "<leader>l", function()
|
||||||
|
try_linting()
|
||||||
|
end, { desc = "Trigger linting for current file" })
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,101 +1,19 @@
|
|||||||
return {
|
return {
|
||||||
"neovim/nvim-lspconfig",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
|
||||||
{ "antosha417/nvim-lsp-file-operations", config = true },
|
{ "antosha417/nvim-lsp-file-operations", config = true },
|
||||||
{ "folke/neodev.nvim", opts = {} },
|
{ "folke/lazydev.nvim", opts = {} },
|
||||||
-- Falls nicht bereits woanders eingebunden:
|
|
||||||
-- { "mason-org/mason-lspconfig.nvim", opts = {} },
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
-- cmp capabilities global setzen (für alle Server)
|
-- import cmp-nvim-lsp plugin
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
|
|
||||||
|
-- used to enable autocompletion (assign to every lsp server config)
|
||||||
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
vim.lsp.config("*", {
|
vim.lsp.config("*", {
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
}) -- :help lsp-config-merge
|
|
||||||
|
|
||||||
-- Keymaps bei Attach (deins, unveraendert)
|
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
|
||||||
group = vim.api.nvim_create_augroup("UserLspConfig", {}),
|
|
||||||
callback = function(ev)
|
|
||||||
local keymap = vim.keymap
|
|
||||||
local opts = { buffer = ev.buf, silent = true }
|
|
||||||
|
|
||||||
opts.desc = "Show LSP references"
|
|
||||||
keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Go to declaration"
|
|
||||||
keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
|
||||||
|
|
||||||
opts.desc = "Show LSP definitions"
|
|
||||||
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show LSP implementations"
|
|
||||||
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show LSP type definitions"
|
|
||||||
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "See available code actions"
|
|
||||||
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
|
|
||||||
|
|
||||||
opts.desc = "Smart rename"
|
|
||||||
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
|
||||||
|
|
||||||
opts.desc = "Show buffer diagnostics"
|
|
||||||
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
|
|
||||||
|
|
||||||
opts.desc = "Show line diagnostics"
|
|
||||||
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
|
|
||||||
|
|
||||||
opts.desc = "Go to previous diagnostic"
|
|
||||||
keymap.set("n", "[d", function()
|
|
||||||
vim.diagnostic.jump({ count = -1, float = true })
|
|
||||||
end, opts)
|
|
||||||
|
|
||||||
opts.desc = "Go to next diagnostic"
|
|
||||||
keymap.set("n", "]d", function()
|
|
||||||
vim.diagnostic.jump({ count = 1, float = true })
|
|
||||||
end, opts)
|
|
||||||
|
|
||||||
opts.desc = "Show documentation"
|
|
||||||
keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
|
||||||
|
|
||||||
opts.desc = "Restart LSP"
|
|
||||||
keymap.set("n", "<leader>rs", ":LspRestart<CR>", opts)
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Diagnostics-UI
|
|
||||||
local x = vim.diagnostic.severity
|
|
||||||
vim.diagnostic.config({
|
|
||||||
virtual_text = { prefix = "" },
|
|
||||||
signs = { text = { [x.ERROR] = "", [x.WARN] = "", [x.INFO] = "", [x.HINT] = "" } },
|
|
||||||
underline = true,
|
|
||||||
float = { border = "single" },
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Server-spezifisch: Lua
|
|
||||||
vim.lsp.config("lua_ls", {
|
|
||||||
settings = {
|
|
||||||
Lua = {
|
|
||||||
diagnostics = { globals = { "vim" } },
|
|
||||||
completion = { callSnippet = "Replace" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
-- (Optional) Mason-LSPConfig: Installer + kein Auto-Enable (wir enablen selbst)
|
|
||||||
local ok_mason, mason_lspconfig = pcall(require, "mason-lspconfig")
|
|
||||||
if ok_mason then
|
|
||||||
mason_lspconfig.setup({
|
|
||||||
ensure_installed = { "html", "cssls", "tailwindcss", "lua_ls", "pyright" },
|
|
||||||
automatic_enable = false, -- sonst wuerde Mason selbst enable() rufen
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Neovim 0.11+: Server aktivieren (statt lspconfig[server].setup)
|
|
||||||
vim.lsp.enable({ "html", "cssls", "tailwindcss", "lua_ls", "pyright" })
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +1,48 @@
|
|||||||
return {
|
return {
|
||||||
"williamboman/mason.nvim",
|
{
|
||||||
dependencies = {
|
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
opts = {
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
-- import mason
|
|
||||||
local mason = require("mason")
|
|
||||||
|
|
||||||
-- import mason-lspconfig
|
|
||||||
local mason_lspconfig = require("mason-lspconfig")
|
|
||||||
|
|
||||||
local mason_tool_installer = require("mason-tool-installer")
|
|
||||||
|
|
||||||
-- enable mason and configure icons
|
|
||||||
mason.setup({
|
|
||||||
ui = {
|
|
||||||
icons = {
|
|
||||||
package_installed = "✓",
|
|
||||||
package_pending = "➜",
|
|
||||||
package_uninstalled = "✗",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
mason_lspconfig.setup({
|
|
||||||
-- list of servers for mason to install
|
-- list of servers for mason to install
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
|
"ts_ls",
|
||||||
"html",
|
"html",
|
||||||
"cssls",
|
"cssls",
|
||||||
"tailwindcss",
|
"tailwindcss",
|
||||||
"lua_ls",
|
"lua_ls",
|
||||||
"pyright",
|
"pyright",
|
||||||
|
"eslint",
|
||||||
},
|
},
|
||||||
automatic_enable = false,
|
},
|
||||||
})
|
dependencies = {
|
||||||
|
{
|
||||||
mason_tool_installer.setup({
|
"williamboman/mason.nvim",
|
||||||
|
opts = {
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
package_installed = "✓",
|
||||||
|
package_pending = "➜",
|
||||||
|
package_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||||
|
opts = {
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"prettier", -- prettier formatter
|
"prettier", -- prettier formatter
|
||||||
"stylua", -- lua formatter
|
"stylua", -- lua formatter
|
||||||
"isort", -- python formatter
|
"isort", -- python formatter
|
||||||
"black", -- python formatter
|
"black", -- python formatter
|
||||||
"pylint", -- python linter
|
"pylint",
|
||||||
"eslint_d", -- js linter
|
"eslint_d",
|
||||||
},
|
},
|
||||||
})
|
},
|
||||||
end,
|
dependencies = {
|
||||||
|
"williamboman/mason.nvim",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +1,60 @@
|
|||||||
return {
|
return {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
event = "InsertEnter",
|
event = "InsertEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-buffer", -- source for text in buffer
|
"hrsh7th/cmp-buffer", -- source for text in buffer
|
||||||
"hrsh7th/cmp-path", -- source for file system paths
|
"hrsh7th/cmp-path", -- source for file system paths
|
||||||
{
|
{
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
-- follow latest release.
|
-- follow latest release.
|
||||||
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
version = "v2.*", -- Replace <CurrentMajor> by the latest released major (first number of latest release)
|
||||||
-- install jsregexp (optional!).
|
-- install jsregexp (optional!).
|
||||||
build = "make install_jsregexp",
|
build = "make install_jsregexp",
|
||||||
},
|
},
|
||||||
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
"saadparwaiz1/cmp_luasnip", -- for autocompletion
|
||||||
"rafamadriz/friendly-snippets", -- useful snippets
|
"rafamadriz/friendly-snippets", -- useful snippets
|
||||||
"onsails/lspkind.nvim", -- vs-code like pictograms
|
"onsails/lspkind.nvim", -- vs-code like pictograms
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
local luasnip = require("luasnip")
|
local luasnip = require("luasnip")
|
||||||
|
|
||||||
local lspkind = require("lspkind")
|
local lspkind = require("lspkind")
|
||||||
|
|
||||||
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
-- loads vscode style snippets from installed plugins (e.g. friendly-snippets)
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
completion = {
|
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
||||||
completeopt = "menu,menuone,preview,noselect",
|
expand = function(args)
|
||||||
},
|
luasnip.lsp_expand(args.body)
|
||||||
snippet = { -- configure how nvim-cmp interacts with snippet engine
|
end,
|
||||||
expand = function(args)
|
},
|
||||||
luasnip.lsp_expand(args.body)
|
mapping = cmp.mapping.preset.insert({
|
||||||
end,
|
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||||
},
|
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||||
mapping = cmp.mapping.preset.insert({
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
||||||
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
}),
|
||||||
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
-- sources for autocompletion
|
||||||
["<CR>"] = cmp.mapping.confirm({ select = false }),
|
sources = cmp.config.sources({
|
||||||
}),
|
{ name = "nvim_lsp" },
|
||||||
-- sources for autocompletion
|
{ name = "luasnip" }, -- snippets
|
||||||
sources = cmp.config.sources({
|
{ name = "buffer" }, -- text within current buffer
|
||||||
{ name = "nvim_lsp"},
|
{ name = "path" }, -- file system paths
|
||||||
{ name = "luasnip" }, -- snippets
|
}),
|
||||||
{ name = "buffer" }, -- text within current buffer
|
|
||||||
{ name = "path" }, -- file system paths
|
|
||||||
}),
|
|
||||||
|
|
||||||
-- configure lspkind for vs-code like pictograms in completion menu
|
-- configure lspkind for vs-code like pictograms in completion menu
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
maxwidth = 50,
|
maxwidth = 50,
|
||||||
ellipsis_char = "...",
|
ellipsis_char = "...",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,56 +1,61 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
dependencies = "nvim-tree/nvim-web-devicons",
|
dependencies = "nvim-tree/nvim-web-devicons",
|
||||||
config = function()
|
config = function()
|
||||||
local nvimtree = require("nvim-tree")
|
local nvimtree = require("nvim-tree")
|
||||||
|
|
||||||
-- recommended settings from nvim-tree documentation
|
-- recommended settings from nvim-tree documentation
|
||||||
vim.g.loaded_netrw = 1
|
vim.g.loaded_netrw = 1
|
||||||
vim.g.loaded_netrwPlugin = 1
|
vim.g.loaded_netrwPlugin = 1
|
||||||
|
|
||||||
nvimtree.setup({
|
nvimtree.setup({
|
||||||
view = {
|
view = {
|
||||||
width = 35,
|
width = 50,
|
||||||
relativenumber = true,
|
relativenumber = true,
|
||||||
},
|
},
|
||||||
-- change folder arrow icons
|
-- change folder arrow icons
|
||||||
renderer = {
|
renderer = {
|
||||||
indent_markers = {
|
indent_markers = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
icons = {
|
icons = {
|
||||||
glyphs = {
|
glyphs = {
|
||||||
folder = {
|
folder = {
|
||||||
arrow_closed = "", -- arrow when folder is closed
|
arrow_closed = "", -- arrow when folder is closed
|
||||||
arrow_open = "", -- arrow when folder is open
|
arrow_open = "", -- arrow when folder is open
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
-- disable window_picker for
|
-- disable window_picker for
|
||||||
-- explorer to work well with
|
-- explorer to work well with
|
||||||
-- window splits
|
-- window splits
|
||||||
actions = {
|
actions = {
|
||||||
open_file = {
|
open_file = {
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = false,
|
enable = false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
filters = {
|
filters = {
|
||||||
custom = { ".DS_Store" },
|
custom = { ".DS_Store" },
|
||||||
},
|
},
|
||||||
git = {
|
git = {
|
||||||
ignore = false,
|
ignore = false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
-- set keymaps
|
-- set keymaps
|
||||||
local keymap = vim.keymap -- for conciseness
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
|
keymap.set("n", "<leader>ee", "<cmd>NvimTreeToggle<CR>", { desc = "Toggle file explorer" }) -- toggle file explorer
|
||||||
keymap.set("n", "<leader>ef", "<cmd>NvimTreeFindFileToggle<CR>", { desc = "Toggle file explorer on current file" }) -- toggle file explorer on current file
|
keymap.set(
|
||||||
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
|
"n",
|
||||||
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
|
"<leader>ef",
|
||||||
end
|
"<cmd>NvimTreeFindFileToggle<CR>",
|
||||||
|
{ desc = "Toggle file explorer on current file" }
|
||||||
|
) -- toggle file explorer on current file
|
||||||
|
keymap.set("n", "<leader>ec", "<cmd>NvimTreeCollapse<CR>", { desc = "Collapse file explorer" }) -- collapse file explorer
|
||||||
|
keymap.set("n", "<leader>er", "<cmd>NvimTreeRefresh<CR>", { desc = "Refresh file explorer" }) -- refresh file explorer
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +1,36 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
branch = "0.1.x",
|
branch = "0.1.x",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim",
|
"nvim-lua/plenary.nvim",
|
||||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require("telescope")
|
local telescope = require("telescope")
|
||||||
local actions = require("telescope.actions")
|
local actions = require("telescope.actions")
|
||||||
|
|
||||||
telescope.setup({
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
path_display = { "smart" },
|
path_display = { "smart" },
|
||||||
mappings = {
|
mappings = {
|
||||||
i = {
|
i = {
|
||||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
telescope.load_extension("fzf")
|
telescope.load_extension("fzf")
|
||||||
|
|
||||||
-- set keymaps
|
-- set keymaps
|
||||||
local keymap = vim.keymap -- for conciseness
|
local keymap = vim.keymap -- for conciseness
|
||||||
|
|
||||||
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
|
keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in cwd" })
|
||||||
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
|
keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
|
||||||
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
|
keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
|
||||||
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
|
keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,6 @@ return {
|
|||||||
"nvim-treesitter/nvim-treesitter",
|
"nvim-treesitter/nvim-treesitter",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
build = ":TSUpdate",
|
build = ":TSUpdate",
|
||||||
dependencies = {
|
|
||||||
"windwp/nvim-ts-autotag",
|
|
||||||
},
|
|
||||||
config = function()
|
config = function()
|
||||||
-- import nvim-treesitter plugin
|
-- import nvim-treesitter plugin
|
||||||
local treesitter = require("nvim-treesitter.configs")
|
local treesitter = require("nvim-treesitter.configs")
|
||||||
@@ -14,17 +11,8 @@ return {
|
|||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
|
|
||||||
sync_install = false,
|
|
||||||
ignore_install = {},
|
|
||||||
auto_install = false,
|
|
||||||
|
|
||||||
-- enable indentation
|
-- enable indentation
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
-- enable autotagging (w/ nvim-ts-autotag plugin)
|
|
||||||
autotag = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
-- ensure these language parsers are installed
|
-- ensure these language parsers are installed
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
"json",
|
"json",
|
||||||
@@ -58,5 +46,8 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- use bash parser for zsh files
|
||||||
|
vim.treesitter.language.register("bash", "zsh")
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user