migrate to lazy.nvim
This commit is contained in:
parent
4a91484477
commit
34e314944e
22 changed files with 570 additions and 892 deletions
|
@ -2,6 +2,3 @@
|
|||
|
||||
[Salar Rahmanian](https://www.softinio.com)'s [neovim](https://neovim.io/) Configuration
|
||||
|
||||
### Credit
|
||||
|
||||
Based on [kickstart.nvim](https://github.com/nvim-lua/kickstart.nvim) by the awesome [TJ DeVries](https://twitter.com/teej_dv) thank you!
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
local installed, gitsigns = pcall(require, "gitsigns")
|
||||
if installed then
|
||||
gitsigns.setup({
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
})
|
||||
end
|
|
@ -1,13 +0,0 @@
|
|||
local installed, lualine = pcall(require, "lualine")
|
||||
if installed then
|
||||
-- Set lualine as statusline
|
||||
-- See `:help lualine.txt`
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = "tokyonight",
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
})
|
||||
end
|
|
@ -1,15 +0,0 @@
|
|||
local installed, neogit = pcall(require, "neogit")
|
||||
if installed then
|
||||
neogit.setup({
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>ng",
|
||||
[[<cmd>lua require('neogit').open({ kind = "split" })<cr>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end
|
|
@ -1,31 +0,0 @@
|
|||
local installed, nvim_tree = pcall(require, "nvim-tree")
|
||||
if installed then
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
nvim_tree.setup({
|
||||
sort_by = "case_sensitive",
|
||||
disable_netrw = true,
|
||||
view = {
|
||||
adaptive_size = true,
|
||||
mappings = {
|
||||
list = {
|
||||
{ key = "u", action = "dir_up" },
|
||||
},
|
||||
},
|
||||
},
|
||||
renderer = {
|
||||
highlight_git = true,
|
||||
group_empty = true,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = false,
|
||||
},
|
||||
})
|
||||
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>m",
|
||||
[[<cmd>lua require('nvim-tree').toggle()<cr>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
local installed, telescope = pcall(require, "telescope")
|
||||
if installed then
|
||||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-u>"] = false,
|
||||
["<C-d>"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "scaladex")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set("n", "<leader>?", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" })
|
||||
vim.keymap.set("n", "<leader><space>", require("telescope.builtin").buffers, { desc = "[ ] Find existing buffers" })
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer]" })
|
||||
|
||||
vim.keymap.set("n", "<leader>sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sw", require("telescope.builtin").grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
end
|
|
@ -1,36 +0,0 @@
|
|||
local installed, texlabconfig = pcall(require, "texlabconfig")
|
||||
if installed then
|
||||
-- vimtex
|
||||
vim.g.vimtex_view_method = "skim"
|
||||
vim.g.vimtex_compiler_method = "tectonic"
|
||||
|
||||
-- nvim-texlabconfig
|
||||
local tex_preview_executable = "/Applications/Skim.app/Contents/SharedSupport/displayline"
|
||||
local tex_preview_args = { "%l", "%p", "%f" }
|
||||
local texlab_build_executable = "tectonic"
|
||||
local texlab_build_args = {
|
||||
"-X",
|
||||
"compile",
|
||||
"%f",
|
||||
"--synctex",
|
||||
"--keep-logs",
|
||||
"--keep-intermediates",
|
||||
}
|
||||
texlabconfig.setup({
|
||||
cache_activate = true,
|
||||
cache_filetypes = { "tex", "bib" },
|
||||
reverse_search_edit_cmd = vim.cmd.edit,
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
executable = texlab_build_executable,
|
||||
args = texlab_build_args,
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = tex_preview_executable,
|
||||
args = tex_preview_args,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
|
@ -1,116 +0,0 @@
|
|||
local installed, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
if installed then
|
||||
-- [[ Configure Treesitter ]]
|
||||
-- See `:help nvim-treesitter`
|
||||
treesitter.setup({
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"cpp",
|
||||
"go",
|
||||
"lua",
|
||||
"python",
|
||||
"rust",
|
||||
"typescript",
|
||||
"help",
|
||||
"vim",
|
||||
"scala",
|
||||
"bash",
|
||||
"dockerfile",
|
||||
"fish",
|
||||
"git_rebase",
|
||||
"gitattributes",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"haskell",
|
||||
"hocon",
|
||||
"html",
|
||||
"http",
|
||||
"java",
|
||||
"javascript",
|
||||
"json",
|
||||
"json5",
|
||||
"latex",
|
||||
"make",
|
||||
"markdown_inline",
|
||||
"nix",
|
||||
"sql",
|
||||
"terraform",
|
||||
"yaml",
|
||||
},
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { "python" } },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<c-space>",
|
||||
node_incremental = "<c-space>",
|
||||
scope_incremental = "<c-s>",
|
||||
node_decremental = "<c-backspace>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["aa"] = "@parameter.outer",
|
||||
["ia"] = "@parameter.inner",
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
["]m"] = "@function.outer",
|
||||
["]]"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]["] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[["] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[]"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>a"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>A"] = "@parameter.inner",
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
288
init.lua
288
init.lua
|
@ -1,105 +1,23 @@
|
|||
-- Install packer
|
||||
local install_path = vim.fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
local is_bootstrap = false
|
||||
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
|
||||
is_bootstrap = true
|
||||
vim.fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("packer").startup(function(use)
|
||||
-- Package manager
|
||||
use("wbthomason/packer.nvim")
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
use({ -- LSP Configuration & Plugins
|
||||
"neovim/nvim-lspconfig",
|
||||
requires = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
|
||||
-- Useful status updates for LSP
|
||||
"j-hui/fidget.nvim",
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing
|
||||
"folke/neodev.nvim",
|
||||
},
|
||||
})
|
||||
|
||||
use({ -- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
})
|
||||
|
||||
use({ -- Highlight, edit, and navigate code
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = function()
|
||||
pcall(require("nvim-treesitter.install").update({ with_sync = true }))
|
||||
end,
|
||||
})
|
||||
|
||||
use({ -- Additional text objects via treesitter
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
after = "nvim-treesitter",
|
||||
})
|
||||
|
||||
-- Git related plugins
|
||||
use("tpope/vim-fugitive")
|
||||
use("tpope/vim-rhubarb")
|
||||
use("lewis6991/gitsigns.nvim")
|
||||
|
||||
use("folke/tokyonight.nvim") -- Theme
|
||||
use("nvim-lualine/lualine.nvim") -- Fancier statusline
|
||||
use("lukas-reineke/indent-blankline.nvim") -- Add indentation guides even on blank lines
|
||||
use("numToStr/Comment.nvim") -- "gc" to comment visual regions/lines
|
||||
use("tpope/vim-sleuth") -- Detect tabstop and shiftwidth automatically
|
||||
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
use({ "nvim-telescope/telescope.nvim", branch = "0.1.x", requires = { "nvim-lua/plenary.nvim" } })
|
||||
|
||||
-- Fuzzy Finder Algorithm which requires local dependencies to be built. Only load if `make` is available
|
||||
use({ "nvim-telescope/telescope-fzf-native.nvim", run = "make", cond = vim.fn.executable("make") == 1 })
|
||||
|
||||
-- Add custom plugins to packer from ~/.config/nvim/lua/plugins.lua
|
||||
local has_plugins, plugins = pcall(require, "plugins")
|
||||
if has_plugins then
|
||||
plugins(use)
|
||||
end
|
||||
|
||||
if is_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
||||
|
||||
-- When we are bootstrapping a configuration, it doesn't
|
||||
-- make sense to execute the rest of the init.lua.
|
||||
--
|
||||
-- You'll need to restart nvim, and then it will work.
|
||||
if is_bootstrap then
|
||||
print("==================================")
|
||||
print(" Plugins are being installed")
|
||||
print(" Wait until Packer completes,")
|
||||
print(" then restart nvim")
|
||||
print("==================================")
|
||||
return
|
||||
end
|
||||
|
||||
-- Automatically source and re-compile packer whenever you save this init.lua
|
||||
local packer_group = vim.api.nvim_create_augroup("Packer", { clear = true })
|
||||
vim.api.nvim_create_autocmd("BufWritePost", {
|
||||
command = "source <afile> | silent! LspStop | silent! LspStart | PackerCompile",
|
||||
group = packer_group,
|
||||
pattern = vim.fn.expand("$MYVIMRC"),
|
||||
})
|
||||
require("lazy").setup("plugins")
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.o`
|
||||
|
@ -131,21 +49,13 @@ vim.o.smartcase = true
|
|||
vim.o.updatetime = 250
|
||||
vim.wo.signcolumn = "yes"
|
||||
|
||||
-- Set colorscheme
|
||||
vim.g.tokyonight_style = "night"
|
||||
vim.g.tokyonight_italic_functions = true
|
||||
vim.o.termguicolors = true
|
||||
vim.cmd([[colorscheme tokyonight]])
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
|
||||
-- Set completeopt to have a better completion experience
|
||||
vim.o.completeopt = "menuone,noselect"
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
-- Keymaps for better default experience
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
@ -166,171 +76,11 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
|||
pattern = "*",
|
||||
})
|
||||
|
||||
-- Enable Comment.nvim
|
||||
require("Comment").setup()
|
||||
|
||||
-- Enable `lukas-reineke/indent-blankline.nvim`
|
||||
-- See `:help indent_blankline.txt`
|
||||
require("indent_blankline").setup({
|
||||
char = "┊",
|
||||
show_trailing_blankline_indent = false,
|
||||
})
|
||||
|
||||
require("trouble").setup()
|
||||
|
||||
-- nvim-autopairs
|
||||
require("nvim-autopairs").setup()
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
|
||||
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
|
||||
vim.keymap.set("n", "<leader>e", vim.diagnostic.open_float)
|
||||
vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist)
|
||||
|
||||
-- LSP settings.
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = "LSP: " .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
||||
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
||||
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
||||
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
|
||||
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
||||
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
|
||||
nmap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "[W]orkspace [L]ist Folders")
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- tsserver = {},
|
||||
|
||||
sumneko_lua = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require("neodev").setup()
|
||||
--
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
|
||||
-- Setup mason so it can manage external tooling
|
||||
require("mason").setup()
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
})
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Turn on lsp status information
|
||||
require("fidget").setup()
|
||||
|
||||
-- nvim-cmp setup
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
-- vim: ts=2 sts=2 sw=2 et
|
||||
|
|
45
lazy-lock.json
Normal file
45
lazy-lock.json
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "eab2c83a0207369900e92783f56990808082eac2" },
|
||||
"LuaSnip": { "branch": "master", "commit": "9bff06b570df29434a88f9c6a9cea3b21ca17208" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "23c51b2a3c00f6abc4e922dbd7c3b9aca6992063" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
|
||||
"cmp-nvim-lsp-signature-help": { "branch": "main", "commit": "3d8912ebeb56e5ae08ef0906e3a54de1c66b92f1" },
|
||||
"cmp-nvim-lua": { "branch": "main", "commit": "f3491638d123cfd2c8048aefaf66d246ff250ca6" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "18095520391186d634a0045dacaa346291096566" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "11827d46e939b4748dbdb7e0df4982a63bd59d26" },
|
||||
"fidget.nvim": { "branch": "main", "commit": "9dc6d15fdb877b2fb09ea0ba2dfde9beccb5965a" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "f29f0b22fd66c910b892aae3bc18a4872c002738" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "8299fe7703dfff4b1752aeed271c3b95281a952d" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "bab744565e9d8d743b1889c66707aa2e8018ae86" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0050b308552e45f7128f399886c86afefc3eb988" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7a97a77eee486ae152d2c559a459eda7c8aa12aa" },
|
||||
"mason.nvim": { "branch": "main", "commit": "14ae1ca58440b158a0a35cf90773013caddf788a" },
|
||||
"neo-tree.nvim": { "branch": "v2.x", "commit": "8238865e1d9c61f1a260c290653f2c419503e0a9" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "a514065e361e123b04bf587d4d5980bf3965d8d6" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "e70715e5c914a97efb9bcc1cd14671afd4a3405d" },
|
||||
"neogit": { "branch": "master", "commit": "089d388876a535032ac6a3f80e19420f09e4ddda" },
|
||||
"nui.nvim": { "branch": "main", "commit": "d147222a1300901656f3ebd5b95f91732785a329" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "45ae3122a4c7744db41298b41f9f5a3f092123e6" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "cfafe0a1ca8933f7b7968a287d39904156f2c57d" },
|
||||
"nvim-jqx": { "branch": "master", "commit": "24d3e0228aec27280e091d09ff65593e99d4d564" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "27e6eb27f31d1ef41427e1008029284c02dc856f" },
|
||||
"nvim-texlabconfig": { "branch": "master", "commit": "2786bdcc37922c285a560e6f3a1cfad3f09d804c" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "f6df07be122de665fb363476cc3680c90f5bdf05" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "13edf91f47c91b390bb00e1df2f7cc1ca250af3a" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "ade34ca7d19543904b28b903e606be8930fb9ee3" },
|
||||
"playground": { "branch": "master", "commit": "c481c660fa903a0e295902b1765ecfbd6e76a556" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "9a0d3bf7b832818c042aaf30f692b081ddd58bd9" },
|
||||
"scaladex.nvim": { "branch": "main", "commit": "93dddf53450c0563da8efec917b5301c581d8d6f" },
|
||||
"stylua-nvim": { "branch": "main", "commit": "ce59a353f02938cba3e0285e662fcd3901cd270f" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "580b6c48651cabb63455e97d7e131ed557b8c7e2" },
|
||||
"telescope.nvim": { "branch": "0.1.x", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "a0abe53df53616d13da327636cb0bcac3ea7f5af" },
|
||||
"trouble.nvim": { "branch": "main", "commit": "556ef3089709a6e253df1e500381fec5eb48e48a" },
|
||||
"vim-fugitive": { "branch": "master", "commit": "62f42f013d866139fa23068ac2651b3f7e05a56f" },
|
||||
"vim-rhubarb": { "branch": "master", "commit": "cad60fe382f3f501bbb28e113dfe8c0de6e77c75" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "1cc4557420f215d02c4d2645a748a816c220e99b" },
|
||||
"vimtex": { "branch": "master", "commit": "3a9180f1d2cc984fe24bc7afaf9d4d00b3e4c20a" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "5224c261825263f46f6771f1b644cae33cd06995" }
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
return function(use)
|
||||
use({ "folke/trouble.nvim" })
|
||||
use({
|
||||
"folke/which-key.nvim",
|
||||
config = function()
|
||||
require("which-key").setup({})
|
||||
end,
|
||||
})
|
||||
use({ "windwp/nvim-autopairs" })
|
||||
use({ "nvim-tree/nvim-web-devicons" })
|
||||
use({
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
tag = "nightly",
|
||||
})
|
||||
use({ "ckipp01/stylua-nvim" })
|
||||
use({ "gennaro-tedesco/nvim-jqx" })
|
||||
use({ "lervag/vimtex" })
|
||||
use({
|
||||
"f3fora/nvim-texlabconfig",
|
||||
run = "go build",
|
||||
})
|
||||
use({ "sindrets/diffview.nvim" })
|
||||
use({ "nvim-treesitter/playground" })
|
||||
use({ "softinio/scaladex.nvim" })
|
||||
use({ "TimUntersberger/neogit" })
|
||||
end
|
15
lua/plugins/gitsigns.lua
Normal file
15
lua/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("gitsigns").setup({
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
63
lua/plugins/init.lua
Normal file
63
lua/plugins/init.lua
Normal file
|
@ -0,0 +1,63 @@
|
|||
return {
|
||||
{ "folke/neoconf.nvim", cmd = "Neoconf" },
|
||||
{
|
||||
"folke/neodev.nvim",
|
||||
config = function()
|
||||
require("neodev").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
config = function()
|
||||
vim.g.tokyonight_style = "night"
|
||||
vim.g.tokyonight_italic_functions = true
|
||||
vim.o.termguicolors = true
|
||||
-- load the colorscheme here
|
||||
vim.cmd([[colorscheme tokyonight]])
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
config = function()
|
||||
require("trouble").setup()
|
||||
end,
|
||||
},
|
||||
"folke/which-key.nvim",
|
||||
{
|
||||
"j-hui/fidget.nvim",
|
||||
config = function()
|
||||
require("fidget").setup()
|
||||
end,
|
||||
},
|
||||
{
|
||||
"windwp/nvim-autopairs",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("nvim-autopairs").setup()
|
||||
end,
|
||||
},
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"ckipp01/stylua-nvim",
|
||||
"gennaro-tedesco/nvim-jqx",
|
||||
"softinio/scaladex.nvim",
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
config = function()
|
||||
require("indent_blankline").setup({
|
||||
char = "┊",
|
||||
show_trailing_blankline_indent = false,
|
||||
})
|
||||
end,
|
||||
},
|
||||
"tpope/vim-fugitive",
|
||||
"tpope/vim-rhubarb",
|
||||
"tpope/vim-sleuth",
|
||||
{
|
||||
"numToStr/Comment.nvim",
|
||||
config = function()
|
||||
require("Comment").setup()
|
||||
end,
|
||||
},
|
||||
}
|
105
lua/plugins/lsp.lua
Normal file
105
lua/plugins/lsp.lua
Normal file
|
@ -0,0 +1,105 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
|
||||
-- Useful status updates for LSP
|
||||
"j-hui/fidget.nvim",
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing
|
||||
"folke/neodev.nvim",
|
||||
},
|
||||
config = function()
|
||||
-- LSP settings.
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
-- NOTE: Remember that lua is a real programming language, and as such it is possible
|
||||
-- to define small helper and utility functions so you don't have to repeat yourself
|
||||
-- many times.
|
||||
--
|
||||
-- In this case, we create a function that lets us more easily define mappings specific
|
||||
-- for LSP related items. It sets the mode, buffer and description for us each time.
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = "LSP: " .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set("n", keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||
|
||||
nmap("gd", vim.lsp.buf.definition, "[G]oto [D]efinition")
|
||||
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
nmap("gI", vim.lsp.buf.implementation, "[G]oto [I]mplementation")
|
||||
nmap("<leader>D", vim.lsp.buf.type_definition, "Type [D]efinition")
|
||||
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
|
||||
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
nmap("<C-k>", vim.lsp.buf.signature_help, "Signature Documentation")
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
nmap("<leader>wa", vim.lsp.buf.add_workspace_folder, "[W]orkspace [A]dd Folder")
|
||||
nmap("<leader>wr", vim.lsp.buf.remove_workspace_folder, "[W]orkspace [R]emove Folder")
|
||||
nmap("<leader>wl", function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, "[W]orkspace [L]ist Folders")
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, "Format", function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, { desc = "Format current buffer with LSP" })
|
||||
end
|
||||
|
||||
-- Enable the following language servers
|
||||
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
|
||||
--
|
||||
-- Add any additional override configuration in the following tables. They will be passed to
|
||||
-- the `settings` field of the server config. You must look up that documentation yourself.
|
||||
local servers = {
|
||||
-- clangd = {},
|
||||
-- gopls = {},
|
||||
-- pyright = {},
|
||||
-- rust_analyzer = {},
|
||||
-- tsserver = {},
|
||||
|
||||
sumneko_lua = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
--
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities)
|
||||
|
||||
-- Setup mason so it can manage external tooling
|
||||
require("mason").setup()
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
})
|
||||
|
||||
mason_lspconfig.setup_handlers({
|
||||
function(server_name)
|
||||
require("lspconfig")[server_name].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
})
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
14
lua/plugins/lualine.lua
Normal file
14
lua/plugins/lualine.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = "tokyonight",
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
15
lua/plugins/neo-tree.lua
Normal file
15
lua/plugins/neo-tree.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v2.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-tree/nvim-web-devicons", -- not strictly required, but recommended
|
||||
"MunifTanjim/nui.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>m", "<cmd>Neotree toggle<cr>", desc = "NeoTree" },
|
||||
},
|
||||
config = function()
|
||||
require("neo-tree").setup()
|
||||
end,
|
||||
}
|
18
lua/plugins/neogit.lua
Normal file
18
lua/plugins/neogit.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
return {
|
||||
"TimUntersberger/neogit",
|
||||
cmd = "Neogit",
|
||||
dependencies = { "sindrets/diffview.nvim" },
|
||||
config = function()
|
||||
require("neogit").setup({
|
||||
integrations = {
|
||||
diffview = true,
|
||||
},
|
||||
})
|
||||
vim.api.nvim_set_keymap(
|
||||
"n",
|
||||
"<leader>ng",
|
||||
[[<cmd>lua require('neogit').open({ kind = "split" })<cr>]],
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end,
|
||||
}
|
67
lua/plugins/nvim-cmp.lua
Normal file
67
lua/plugins/nvim-cmp.lua
Normal file
|
@ -0,0 +1,67 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
-- load cmp on InsertEnter
|
||||
event = "InsertEnter",
|
||||
-- these dependencies will only be loaded when cmp loads
|
||||
-- dependencies are always lazy-loaded unless specified otherwise
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lua",
|
||||
"hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp_signature_help" },
|
||||
},
|
||||
})
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
}
|
41
lua/plugins/telescope.lua
Normal file
41
lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-u>"] = false,
|
||||
["<C-d>"] = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "scaladex")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set("n", "<leader>?", require("telescope.builtin").oldfiles, { desc = "[?] Find recently opened files" })
|
||||
vim.keymap.set("n", "<leader><space>", require("telescope.builtin").buffers, { desc = "[ ] Find existing buffers" })
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
require("telescope.builtin").current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer]" })
|
||||
|
||||
vim.keymap.set("n", "<leader>sf", require("telescope.builtin").find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>sh", require("telescope.builtin").help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sw", require("telescope.builtin").grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", require("telescope.builtin").live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", require("telescope.builtin").diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
end,
|
||||
}
|
40
lua/plugins/texlabconfig.lua
Normal file
40
lua/plugins/texlabconfig.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
return {
|
||||
"f3fora/nvim-texlabconfig",
|
||||
build = "go build",
|
||||
dependencies = { "lervag/vimtex" },
|
||||
config = function()
|
||||
-- vimtex
|
||||
vim.g.vimtex_view_method = "skim"
|
||||
vim.g.vimtex_compiler_method = "tectonic"
|
||||
|
||||
-- nvim-texlabconfig
|
||||
local tex_preview_executable = "/Applications/Skim.app/Contents/SharedSupport/displayline"
|
||||
local tex_preview_args = { "%l", "%p", "%f" }
|
||||
local texlab_build_executable = "tectonic"
|
||||
local texlab_build_args = {
|
||||
"-X",
|
||||
"compile",
|
||||
"%f",
|
||||
"--synctex",
|
||||
"--keep-logs",
|
||||
"--keep-intermediates",
|
||||
}
|
||||
require("texlabconfig").setup({
|
||||
cache_activate = true,
|
||||
cache_filetypes = { "tex", "bib" },
|
||||
reverse_search_edit_cmd = vim.cmd.edit,
|
||||
settings = {
|
||||
texlab = {
|
||||
build = {
|
||||
executable = texlab_build_executable,
|
||||
args = texlab_build_args,
|
||||
},
|
||||
forwardSearch = {
|
||||
executable = tex_preview_executable,
|
||||
args = tex_preview_args,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
128
lua/plugins/treesitter.lua
Normal file
128
lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,128 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
-- build = function()
|
||||
-- pcall(require("nvim-treesitter.install").update({ with_sync = true }))
|
||||
-- end,
|
||||
dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", "nvim-treesitter/playground" },
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
"c",
|
||||
"cpp",
|
||||
"go",
|
||||
"lua",
|
||||
"python",
|
||||
"rust",
|
||||
"typescript",
|
||||
"help",
|
||||
"vim",
|
||||
"scala",
|
||||
"bash",
|
||||
"dockerfile",
|
||||
"fish",
|
||||
"git_rebase",
|
||||
"gitattributes",
|
||||
"gitcommit",
|
||||
"gitignore",
|
||||
"haskell",
|
||||
"hocon",
|
||||
"html",
|
||||
"http",
|
||||
"java",
|
||||
"javascript",
|
||||
"json",
|
||||
"json5",
|
||||
"latex",
|
||||
"make",
|
||||
"markdown_inline",
|
||||
"nix",
|
||||
"sql",
|
||||
"terraform",
|
||||
"yaml",
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true, disable = { "python" } },
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<c-space>",
|
||||
node_incremental = "<c-space>",
|
||||
scope_incremental = "<c-s>",
|
||||
node_decremental = "<c-backspace>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
|
||||
keymaps = {
|
||||
-- You can use the capture groups defined in textobjects.scm
|
||||
["aa"] = "@parameter.outer",
|
||||
["ia"] = "@parameter.inner",
|
||||
["af"] = "@function.outer",
|
||||
["if"] = "@function.inner",
|
||||
["ac"] = "@class.outer",
|
||||
["ic"] = "@class.inner",
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true, -- whether to set jumps in the jumplist
|
||||
goto_next_start = {
|
||||
["]m"] = "@function.outer",
|
||||
["]]"] = "@class.outer",
|
||||
},
|
||||
goto_next_end = {
|
||||
["]M"] = "@function.outer",
|
||||
["]["] = "@class.outer",
|
||||
},
|
||||
goto_previous_start = {
|
||||
["[m"] = "@function.outer",
|
||||
["[["] = "@class.outer",
|
||||
},
|
||||
goto_previous_end = {
|
||||
["[M"] = "@function.outer",
|
||||
["[]"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
swap = {
|
||||
enable = true,
|
||||
swap_next = {
|
||||
["<leader>a"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader>A"] = "@parameter.inner",
|
||||
},
|
||||
playground = {
|
||||
enable = true,
|
||||
disable = {},
|
||||
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
|
||||
persist_queries = false, -- Whether the query persists across vim sessions
|
||||
keybindings = {
|
||||
toggle_query_editor = "o",
|
||||
toggle_hl_groups = "i",
|
||||
toggle_injected_languages = "t",
|
||||
toggle_anonymous_nodes = "a",
|
||||
toggle_language_display = "I",
|
||||
focus_language = "f",
|
||||
unfocus_language = "F",
|
||||
update = "R",
|
||||
goto_node = "<cr>",
|
||||
show_help = "?",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
|
@ -1,335 +0,0 @@
|
|||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function("has", { "nvim-0.5" }) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command("packadd packer.nvim")
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.inside_compile = true
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = { chunk_name, time_taken }
|
||||
end
|
||||
table.sort(sorted_times, function(a, b)
|
||||
return a[2] > b[2]
|
||||
end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. " took " .. elem[2] .. "ms"
|
||||
end
|
||||
end
|
||||
if threshold then
|
||||
table.insert(results, "(Only showing plugins that took longer than " .. threshold .. " ms " .. "to load)")
|
||||
end
|
||||
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str =
|
||||
"/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/Users/salar/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ";" .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ";" .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify(
|
||||
"packer.nvim: Error running " .. component .. " for " .. name .. ": " .. result,
|
||||
vim.log.levels.ERROR,
|
||||
{}
|
||||
)
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
["Comment.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||
url = "https://github.com/numToStr/Comment.nvim",
|
||||
},
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip",
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer",
|
||||
},
|
||||
["cmp-cmdline"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||
url = "https://github.com/hrsh7th/cmp-cmdline",
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
["cmp-nvim-lsp-signature-help"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp-signature-help",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp-signature-help",
|
||||
},
|
||||
["cmp-nvim-lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-nvim-lua",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lua",
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path",
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
["diffview.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/diffview.nvim",
|
||||
url = "https://github.com/sindrets/diffview.nvim",
|
||||
},
|
||||
["fidget.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/fidget.nvim",
|
||||
url = "https://github.com/j-hui/fidget.nvim",
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim",
|
||||
},
|
||||
["indent-blankline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
|
||||
url = "https://github.com/lukas-reineke/indent-blankline.nvim",
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim",
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||
url = "https://github.com/williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
["mason.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||
url = "https://github.com/williamboman/mason.nvim",
|
||||
},
|
||||
["neodev.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/neodev.nvim",
|
||||
url = "https://github.com/folke/neodev.nvim",
|
||||
},
|
||||
neogit = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/neogit",
|
||||
url = "https://github.com/TimUntersberger/neogit",
|
||||
},
|
||||
["nvim-autopairs"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||
url = "https://github.com/windwp/nvim-autopairs",
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp",
|
||||
},
|
||||
["nvim-jqx"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-jqx",
|
||||
url = "https://github.com/gennaro-tedesco/nvim-jqx",
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig",
|
||||
},
|
||||
["nvim-texlabconfig"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-texlabconfig",
|
||||
url = "https://github.com/f3fora/nvim-texlabconfig",
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||
url = "https://github.com/nvim-tree/nvim-tree.lua",
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
["nvim-treesitter-textobjects"] = {
|
||||
load_after = {},
|
||||
loaded = true,
|
||||
needs_bufread = false,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/opt/nvim-treesitter-textobjects",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter-textobjects",
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
url = "https://github.com/nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim",
|
||||
},
|
||||
playground = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/playground",
|
||||
url = "https://github.com/nvim-treesitter/playground",
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim",
|
||||
},
|
||||
["scaladex.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/scaladex.nvim",
|
||||
url = "https://github.com/softinio/scaladex.nvim",
|
||||
},
|
||||
["stylua-nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/stylua-nvim",
|
||||
url = "https://github.com/ckipp01/stylua-nvim",
|
||||
},
|
||||
["telescope-fzf-native.nvim"] = {
|
||||
cond = { true },
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
only_cond = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/opt/telescope-fzf-native.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope-fzf-native.nvim",
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim",
|
||||
},
|
||||
["tokyonight.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
|
||||
url = "https://github.com/folke/tokyonight.nvim",
|
||||
},
|
||||
["trouble.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/trouble.nvim",
|
||||
url = "https://github.com/folke/trouble.nvim",
|
||||
},
|
||||
["vim-fugitive"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vim-fugitive",
|
||||
url = "https://github.com/tpope/vim-fugitive",
|
||||
},
|
||||
["vim-rhubarb"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vim-rhubarb",
|
||||
url = "https://github.com/tpope/vim-rhubarb",
|
||||
},
|
||||
["vim-sleuth"] = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vim-sleuth",
|
||||
url = "https://github.com/tpope/vim-sleuth",
|
||||
},
|
||||
vimtex = {
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/vimtex",
|
||||
url = "https://github.com/lervag/vimtex",
|
||||
},
|
||||
["which-key.nvim"] = {
|
||||
config = {
|
||||
"\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0",
|
||||
},
|
||||
loaded = true,
|
||||
path = "/Users/salar/.local/share/nvim/site/pack/packer/start/which-key.nvim",
|
||||
url = "https://github.com/folke/which-key.nvim",
|
||||
},
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: which-key.nvim
|
||||
time([[Config for which-key.nvim]], true)
|
||||
try_loadstring(
|
||||
"\27LJ\2\n;\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\14which-key\frequire\0",
|
||||
"config",
|
||||
"which-key.nvim"
|
||||
)
|
||||
time([[Config for which-key.nvim]], false)
|
||||
-- Conditional loads
|
||||
time([[Conditional loading of telescope-fzf-native.nvim]], true)
|
||||
require("packer.load")({ "telescope-fzf-native.nvim" }, {}, _G.packer_plugins)
|
||||
time([[Conditional loading of telescope-fzf-native.nvim]], false)
|
||||
-- Load plugins in order defined by `after`
|
||||
time([[Sequenced loading]], true)
|
||||
vim.cmd([[ packadd nvim-treesitter ]])
|
||||
vim.cmd([[ packadd nvim-treesitter-textobjects ]])
|
||||
time([[Sequenced loading]], false)
|
||||
|
||||
_G._packer.inside_compile = false
|
||||
if _G._packer.needs_bufread == true then
|
||||
vim.cmd("doautocmd BufRead")
|
||||
end
|
||||
_G._packer.needs_bufread = false
|
||||
|
||||
if should_profile then
|
||||
save_profiles()
|
||||
end
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command(
|
||||
'echohl ErrorMsg | echom "Error in packer_compiled: '
|
||||
.. error_msg
|
||||
.. '" | echom "Please check your config for correctness" | echohl None'
|
||||
)
|
||||
end
|
Loading…
Reference in a new issue