Finalized moving things out of init.lua into seperate folders
This commit is contained in:
parent
3b96ad1b57
commit
dd94586255
|
@ -1,4 +1,4 @@
|
|||
column_width = 120
|
||||
column_width = 80
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
|
|
641
init.lua
641
init.lua
|
@ -16,595 +16,22 @@ if not vim.loop.fs_stat(lazypath) then
|
|||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.runtimepath:prepend(lazypath)
|
||||
|
||||
-- [[ Plugins ]]
|
||||
-- TODO: require("lazy").setup("angryluck.plugins")
|
||||
require("lazy").setup({
|
||||
|
||||
-- Detect tabstop and shiftwidth automatically
|
||||
-- Don't like this...
|
||||
-- "tpope/vim-sleuth",
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ "numToStr/Comment.nvim", opts = {} },
|
||||
|
||||
-- Git related plugins
|
||||
"tpope/vim-fugitive",
|
||||
"tpope/vim-rhubarb",
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{ -- Shows pending keybinds
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
require("which-key").setup({
|
||||
-- Remove this if so many keymaps, that you need to scroll
|
||||
popup_mappings = {
|
||||
scroll_down = "<Nop>",
|
||||
scroll_up = "<Nop>",
|
||||
},
|
||||
-- Doesn't work
|
||||
-- trigger_blacklist = {
|
||||
-- v = { "j", "k", "<C-D>", "<C-U>" },
|
||||
-- },
|
||||
})
|
||||
|
||||
-- Document existing key chains
|
||||
require("which-key").register({
|
||||
-- Naming leader-key-groups
|
||||
["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" },
|
||||
["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" },
|
||||
["<leader>r"] = { name = "[R]ename", _ = "which_key_ignore" },
|
||||
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
|
||||
["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" },
|
||||
["<leader>o"] = { name = "[O]rgmode", _ = "which_key_ignore" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ -- If encountering errors, see telescope-fzf-native README
|
||||
"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 },
|
||||
{ "xiyaowong/telescope-emoji.nvim" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = { ["<c-enter>"] = "to_fuzzy_refine" },
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
require("telescope").load_extension("emoji")
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[S]earch [H]elp" })
|
||||
vim.keymap.set("n", "<leader>sk", builtin.keymaps, { desc = "[S]earch [K]eymaps" })
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[S]earch [F]iles" })
|
||||
vim.keymap.set("n", "<leader>ss", builtin.builtin, { desc = "[S]earch [S]elect Telescope" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[S]earch current [W]ord" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[S]earch by [G]rep" })
|
||||
vim.keymap.set("n", "<leader>sd", builtin.diagnostics, { desc = "[S]earch [D]iagnostics" })
|
||||
vim.keymap.set("n", "<leader>sr", builtin.resume, { desc = "[S]earch [R]esume" })
|
||||
vim.keymap.set("n", "<leader>s.", builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.git_files, { desc = "[S]earch [G]it Files" })
|
||||
vim.keymap.set("n", "<leader><leader>", builtin.buffers, { desc = "[ ] Find existing buffers" })
|
||||
|
||||
vim.keymap.set("n", "<leader>se", ":Telescope emoji<CR>", { desc = "[S]earch [E]mojis" })
|
||||
-- Overriding default behavior and theme
|
||||
vim.keymap.set("n", "<leader>/", function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
}))
|
||||
end, { desc = "[/] Fuzzily search in current buffer" })
|
||||
|
||||
-- Also possible to pass additional configuration options.
|
||||
-- See `:help telescope.builtin.live_grep()` for information about particular keys
|
||||
vim.keymap.set("n", "<leader>s/", function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end, { desc = "[S]earch [/] in Open Files" })
|
||||
|
||||
vim.keymap.set("n", "<leader>sn", function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end, { desc = "[S]earch [N]eovim files" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- To add "add to dictionary" to ltex, but doesn't work...
|
||||
-- { "vigoux/ltex-ls.nvim", dependencies = { "neovim/nvim-lspconfig" } },
|
||||
|
||||
{ -- LSP Configuration & Plugins
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
-- Useful status updates for LSP
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
|
||||
-- Lua LSP for Neovim config
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
-- Lua helper function
|
||||
local nmap = function(keys, func, desc)
|
||||
vim.keymap.set("n", keys, func, { buffer = event.buf, desc = "LSP: " .. desc })
|
||||
end
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
nmap("gd", require("telescope.builtin").lsp_definitions, "[G]oto [D]efinition")
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
nmap("gr", require("telescope.builtin").lsp_references, "[G]oto [R]eferences")
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
nmap("gI", require("telescope.builtin").lsp_implementations, "[G]oto [I]mplementation")
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
nmap("<leader>D", require("telescope.builtin").lsp_type_definitions, "Type [D]efinition")
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
nmap("<leader>ds", require("telescope.builtin").lsp_document_symbols, "[D]ocument [S]ymbols")
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace
|
||||
-- Similar to document symbols, except searches over your whole project.
|
||||
nmap("<leader>ws", require("telescope.builtin").lsp_dynamic_workspace_symbols, "[W]orkspace [S]ymbols")
|
||||
|
||||
-- Rename the variable under your cursor
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap
|
||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header
|
||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
|
||||
-- Highlight references of word under cursor
|
||||
-- local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
-- if client and client.server_capabilities.documentHighlightProvider then
|
||||
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
-- buffer = event.buf,
|
||||
-- callback = vim.lsp.buf.document_highlight,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
|
||||
-- buffer = event.buf,
|
||||
-- callback = vim.lsp.buf.clear_references,
|
||||
-- })
|
||||
-- end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Broadcast cmp capabilities to servers.
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend("force", capabilities, require("cmp_nvim_lsp").default_capabilities())
|
||||
|
||||
-- Available config keys:
|
||||
-- - cmd (table): Override the default command used to start the server
|
||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
local servers = {
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes = { ...},
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
ltex = {
|
||||
filetypes = { "tex" },
|
||||
settings = {
|
||||
dictionary = {
|
||||
["en-US"] = { "homotopy" },
|
||||
},
|
||||
},
|
||||
},
|
||||
hls = {
|
||||
filetypes = { "haskell", "lhaskell", "cabal" },
|
||||
haskell = {
|
||||
cabalFormattingProvider = "cabalfmt",
|
||||
formattingProvider = "fourmolu",
|
||||
},
|
||||
single_file_suppport = true,
|
||||
},
|
||||
}
|
||||
-- Use :Mason to install manually
|
||||
require("mason").setup()
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, { "stylua" })
|
||||
require("mason-tool-installer").setup({ ensure_installed = ensure_installed })
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
||||
server.capabilities = vim.tbl_deep_extend("force", {}, capabilities, server.capabilities or {})
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{ -- Autoformat
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
haskell = { "fourmolu" },
|
||||
json = { "jq" },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use a sub-list to tell conform to run *until* a formatter is found.
|
||||
-- javascript = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
-- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- build needed for regex support
|
||||
build = (function()
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
require("lazy").setup(
|
||||
"angryluck.plugins",
|
||||
-- For multiple sources:
|
||||
-- {
|
||||
-- -- premade snippets
|
||||
-- "rafamadriz/friendly-snippets",
|
||||
-- config = function()
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load { exclude = { "tex" } }
|
||||
-- require("luasnip.loaders.from_snipmate").lazy_load { exclude = { "tex" } }
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
config = function()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
end,
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
|
||||
-- Adds LSP completion capabilities
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
luasnip.config.setup({ enable_autosnippets = true })
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- old one: completeopt = "menuone,noselect",
|
||||
completion = { completeopt = "menu,menuone,noinsert" },
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-8),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(8),
|
||||
-- Accept ([y]es) the completion
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
-- Manually trigger a completion from nvim-cmp (normally not needed)
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "neorg" },
|
||||
{ name = "orgmode" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = "catppuccin",
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
-- lualine layout:
|
||||
-- +-------------------------------------------------+
|
||||
-- | A | B | C X | Y | Z |
|
||||
-- +-------------------------------------------------+
|
||||
sections = {
|
||||
lualine_x = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- {
|
||||
-- -- Add indentation guides even on blank lines
|
||||
-- "lukas-reineke/indent-blankline.nvim",
|
||||
-- main = "ibl",
|
||||
-- opts = {
|
||||
-- -- char = "┊",
|
||||
-- -- show_trailing_blankline_indent = false,
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
{
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { signs = false },
|
||||
},
|
||||
|
||||
{ -- Collection of various small independent plugins/modules
|
||||
"echasnovski/mini.nvim",
|
||||
config = function()
|
||||
-- Better Around/Inside textobjects
|
||||
|
||||
-- Examples:
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
-- - saiw( - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr(' - [S]urround [R]eplace [)] [']
|
||||
--
|
||||
-- nvim-surround is better...
|
||||
-- require("mini.surround").setup {}
|
||||
|
||||
-- See 'https://github.com/echasnovski/mini.nvim' for more uses
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
-- Highlight, edit, and navigate code
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
-- Interact with treesitter textobjects
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
-- Keeps function description stuck on top
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
-- Extra stuff
|
||||
"nvim-treesitter/nvim-treesitter-refactor",
|
||||
},
|
||||
opts = {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"haskell",
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
-- "org",
|
||||
"norg",
|
||||
"markdown",
|
||||
},
|
||||
ignore_install = { "latex" },
|
||||
auto_install = true,
|
||||
-- indent = { enable = true },
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "latex" },
|
||||
-- additional_vim_regex_highlighting = { "latex", "markdown" },
|
||||
},
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
-- Defaults
|
||||
-- init_selection = "gnn",
|
||||
-- node_incremental = "grn",
|
||||
-- scope_incremental = "grc",
|
||||
-- node_decremental = "grm",
|
||||
|
||||
init_selection = "<c-space>",
|
||||
node_incremental = "<c-space>",
|
||||
scope_incremental = "<c-s>",
|
||||
node_decremental = "<m-space>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
-- automatically jump forward to textobj, see targets.vim
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- you can use the capture groups defined in textobjects.scm
|
||||
["af"] = { query = "@function.outer", desc = "[a]round [f]unction" },
|
||||
["if"] = { query = "@function.inner", desc = "[i]nner [f]unction" },
|
||||
-- [a/i]p is taken for "paragraph".
|
||||
["aa"] = { query = "@parameter.outer", desc = "[a]round [a]rgument" },
|
||||
["ia"] = { query = "@parameter.inner", desc = "[i]nner [a]rgument" },
|
||||
-- fucks up vimtex commands!
|
||||
-- ['ac'] = '@class.outer',
|
||||
-- ['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
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>>"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader><"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
lsp_interop = {
|
||||
enable = true,
|
||||
border = "none",
|
||||
floating_preview_opts = {},
|
||||
peek_definition_code = {
|
||||
["<leader>df"] = "@function.outer",
|
||||
["<leader>dF"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
refactor = {
|
||||
highlight_definitions = {
|
||||
enable = true,
|
||||
-- Set to false if you have an `updatetime` of ~100.
|
||||
clear_on_cursor_move = true,
|
||||
},
|
||||
highlight_current_scope = { enable = true },
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
-- Assign keymaps to false to disable them, e.g. `smart_rename = false`.
|
||||
keymaps = {
|
||||
smart_rename = "grr",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
},
|
||||
|
||||
-- Uncomment for debug plugin
|
||||
-- require 'kickstart.plugins.debug',
|
||||
|
||||
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
|
||||
{ import = "angryluck.plugins" },
|
||||
-- { import = "angryluck.plugins" },
|
||||
-- { import = "kickstart.plugins" },
|
||||
}, {
|
||||
-- },
|
||||
{
|
||||
change_detection = { notify = false },
|
||||
ui = {
|
||||
-- Default icons, if no nerd font installed
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
|
@ -613,7 +40,7 @@ require("lazy").setup({
|
|||
event = "📅",
|
||||
ft = "📂",
|
||||
init = "⚙",
|
||||
keys = "🗝",
|
||||
keys = "🔑",
|
||||
plugin = "🔌",
|
||||
runtime = "💻",
|
||||
require = "🌙",
|
||||
|
@ -623,52 +50,8 @@ require("lazy").setup({
|
|||
lazy = "💤 ",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- require("ltex-ls").setup {
|
||||
-- on_attach = on_attach,
|
||||
-- capabilities = capabilities,
|
||||
-- use_spellfile = false,
|
||||
-- filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text" },
|
||||
-- settings = {
|
||||
-- ltex = {
|
||||
-- enabled = { "latex", "tex", "bib", "markdown" },
|
||||
-- language = "auto",
|
||||
-- diagnosticSeverity = "information",
|
||||
-- sentenceCacheSize = 2000,
|
||||
-- additionalRules = {
|
||||
-- enablePickyRules = true,
|
||||
-- motherTongue = "fr",
|
||||
-- },
|
||||
-- disabledRules = {
|
||||
-- fr = { "APOS_TYP", "FRENCH_WHITESPACE" },
|
||||
-- },
|
||||
-- dictionary = (function()
|
||||
-- -- For dictionary, search for files in the runtime to have
|
||||
-- -- and include them as externals the format for them is
|
||||
-- -- dict/{LANG}.txt
|
||||
-- --
|
||||
-- -- Also add dict/default.txt to all of them
|
||||
-- local files = {}
|
||||
-- for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do
|
||||
-- local lang = vim.fn.fnamemodify(file, ":t:r")
|
||||
-- local fullpath = vim.fs.normalize(file, ":p")
|
||||
-- files[lang] = { ":" .. fullpath }
|
||||
-- end
|
||||
--
|
||||
-- if files.default then
|
||||
-- for lang, _ in pairs(files) do
|
||||
-- if lang ~= "default" then
|
||||
-- vim.list_extend(files[lang], files.default)
|
||||
-- end
|
||||
-- end
|
||||
-- files.default = nil
|
||||
-- end
|
||||
-- return files
|
||||
-- end)(),
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
}
|
||||
)
|
||||
|
||||
-- modeline
|
||||
-- vim: ts=2 sts=4 sw=2 et
|
||||
-- vim: tabstop=2 softtabstop=4 shiftwidth=2 expandtab
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
-- stylua: ignore start
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- mapleader = " " and maplocalleader = " " are set in init.lua
|
||||
|
||||
|
@ -21,7 +23,7 @@ vim.keymap.set("n", "<leader>q", vim.diagnostic.setloclist, { desc = "Open diagn
|
|||
vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
|
||||
-- Easier window movement (but conflicts with Harpoon)
|
||||
-- vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
-- vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
-- vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
-- vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
|
|
|
@ -50,7 +50,7 @@ vim.opt.splitbelow = true
|
|||
|
||||
-- wrap between words
|
||||
vim.opt.linebreak = true
|
||||
|
||||
vim.opt.showbreak = "↪ "
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 8
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
return {
|
||||
-- Autocompletion
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
-- Snippet Engine & its associated nvim-cmp source
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
-- build needed for regex support
|
||||
build = (function()
|
||||
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
|
||||
return
|
||||
end
|
||||
return "make install_jsregexp"
|
||||
end)(),
|
||||
dependencies = {
|
||||
-- {
|
||||
-- -- premade snippets
|
||||
-- "rafamadriz/friendly-snippets",
|
||||
-- config = function()
|
||||
-- require("luasnip.loaders.from_vscode").lazy_load { exclude = { "tex" } }
|
||||
-- require("luasnip.loaders.from_snipmate").lazy_load { exclude = { "tex" } }
|
||||
-- end,
|
||||
-- },
|
||||
},
|
||||
config = function()
|
||||
require("luasnip.loaders.from_snipmate").lazy_load()
|
||||
end,
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
|
||||
-- Adds LSP completion capabilities
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
luasnip.config.setup({ enable_autosnippets = true })
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- old one: completeopt = "menuone,noselect",
|
||||
completion = { completeopt = "menu,menuone,noinsert" },
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item(),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item(),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-8),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(8),
|
||||
-- Accept ([y]es) the completion
|
||||
["<C-y>"] = cmp.mapping.confirm({ select = true }),
|
||||
-- Manually trigger a completion from nvim-cmp (normally not needed)
|
||||
["<C-Space>"] = cmp.mapping.complete({}),
|
||||
["<C-l>"] = cmp.mapping(function()
|
||||
if luasnip.expand_or_locally_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
["<C-h>"] = cmp.mapping(function()
|
||||
if luasnip.locally_jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "neorg" },
|
||||
{ name = "orgmode" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
return { -- Autoformat
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||
-- have a well standardized coding style. You can add additional
|
||||
-- languages here or re-enable it for the disabled ones.
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
haskell = { "fourmolu" },
|
||||
json = { "jq" },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use a sub-list to tell conform to run *until* a formatter is found.
|
||||
-- javascript = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
-- Git related plugins
|
||||
"tpope/vim-fugitive",
|
||||
"tpope/vim-rhubarb",
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = "+" },
|
||||
change = { text = "~" },
|
||||
delete = { text = "_" },
|
||||
topdelete = { text = "‾" },
|
||||
changedelete = { text = "~" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
|
@ -42,18 +42,15 @@ return {
|
|||
-- "." repeats plugincommands
|
||||
"tpope/vim-repeat",
|
||||
|
||||
-- {
|
||||
-- "ggandor/leap.nvim",
|
||||
-- -- opts = {},
|
||||
-- config = function()
|
||||
-- require("leap").create_default_mappings()
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {},
|
||||
opts = {
|
||||
modes = {
|
||||
-- enhanced f, F, t, T motions - fix lat8r
|
||||
char = { enabled = false },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
-- stylua: ignore start
|
||||
{ "s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash", },
|
||||
|
@ -65,8 +62,7 @@ return {
|
|||
},
|
||||
},
|
||||
|
||||
-- Edit files like nvim buffer
|
||||
{
|
||||
{ -- Edit files like nvim buffer
|
||||
"stevearc/oil.nvim",
|
||||
opts = {},
|
||||
-- Optional dependencies
|
||||
|
@ -75,4 +71,38 @@ return {
|
|||
require("oil").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- "gc" to comment visual regions/lines
|
||||
{ "numToStr/Comment.nvim", opts = {}, lazy = false },
|
||||
|
||||
{ -- Highlight todo, notes, etc in comments
|
||||
"folke/todo-comments.nvim",
|
||||
event = "VimEnter",
|
||||
dependencies = { "nvim-lua/plenary.nvim" },
|
||||
opts = { signs = false },
|
||||
},
|
||||
|
||||
-- [ GRAVEYARD ]
|
||||
-- Plugins I don't use anymore
|
||||
--------------------------------------------------
|
||||
|
||||
-- "tpope/vim-sleuth"
|
||||
|
||||
-- {
|
||||
-- -- Add indentation guides even on blank lines
|
||||
-- "lukas-reineke/indent-blankline.nvim",
|
||||
-- main = "ibl",
|
||||
-- opts = {
|
||||
-- -- char = "┊",
|
||||
-- -- show_trailing_blankline_indent = false,
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- {
|
||||
-- "ggandor/leap.nvim",
|
||||
-- -- opts = {},
|
||||
-- config = function()
|
||||
-- require("leap").create_default_mappings()
|
||||
-- end,
|
||||
-- },
|
||||
}
|
||||
|
|
|
@ -0,0 +1,231 @@
|
|||
return { -- LSP Configuration & Plugins
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"WhoIsSethDaniel/mason-tool-installer.nvim",
|
||||
|
||||
-- Useful status updates for LSP
|
||||
{ "j-hui/fidget.nvim", opts = {} },
|
||||
|
||||
-- Lua LSP for Neovim config
|
||||
{ "folke/neodev.nvim", opts = {} },
|
||||
},
|
||||
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
|
||||
callback = function(event)
|
||||
-- Lua helper function
|
||||
local nmap = function(keys, func, desc)
|
||||
vim.keymap.set(
|
||||
"n",
|
||||
keys,
|
||||
func,
|
||||
{ buffer = event.buf, desc = "LSP: " .. desc }
|
||||
)
|
||||
end
|
||||
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
nmap(
|
||||
"gd",
|
||||
require("telescope.builtin").lsp_definitions,
|
||||
"[G]oto [D]efinition"
|
||||
)
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
nmap(
|
||||
"gr",
|
||||
require("telescope.builtin").lsp_references,
|
||||
"[G]oto [R]eferences"
|
||||
)
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
nmap(
|
||||
"gI",
|
||||
require("telescope.builtin").lsp_implementations,
|
||||
"[G]oto [I]mplementation"
|
||||
)
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
nmap(
|
||||
"<leader>D",
|
||||
require("telescope.builtin").lsp_type_definitions,
|
||||
"Type [D]efinition"
|
||||
)
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
nmap(
|
||||
"<leader>ds",
|
||||
require("telescope.builtin").lsp_document_symbols,
|
||||
"[D]ocument [S]ymbols"
|
||||
)
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace
|
||||
-- Similar to document symbols, except searches over your whole project.
|
||||
nmap(
|
||||
"<leader>ws",
|
||||
require("telescope.builtin").lsp_dynamic_workspace_symbols,
|
||||
"[W]orkspace [S]ymbols"
|
||||
)
|
||||
|
||||
-- Rename the variable under your cursor
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
nmap("<leader>rn", vim.lsp.buf.rename, "[R]e[n]ame")
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
nmap("<leader>ca", vim.lsp.buf.code_action, "[C]ode [A]ction")
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap
|
||||
nmap("K", vim.lsp.buf.hover, "Hover Documentation")
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header
|
||||
nmap("gD", vim.lsp.buf.declaration, "[G]oto [D]eclaration")
|
||||
|
||||
-- Highlight references of word under cursor
|
||||
-- local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
-- if client and client.server_capabilities.documentHighlightProvider then
|
||||
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||
-- buffer = event.buf,
|
||||
-- callback = vim.lsp.buf.document_highlight,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, {
|
||||
-- buffer = event.buf,
|
||||
-- callback = vim.lsp.buf.clear_references,
|
||||
-- })
|
||||
-- end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Broadcast cmp capabilities to servers.
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
capabilities,
|
||||
require("cmp_nvim_lsp").default_capabilities()
|
||||
)
|
||||
|
||||
-- Available config keys:
|
||||
-- - cmd (table): Override the default command used to start the server
|
||||
-- - filetypes (table): Override the default list of associated filetypes for the server
|
||||
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
|
||||
-- - settings (table): Override the default settings passed when initializing the server.
|
||||
local servers = {
|
||||
lua_ls = {
|
||||
-- cmd = {...},
|
||||
-- filetypes = { ...},
|
||||
-- capabilities = {},
|
||||
settings = {
|
||||
Lua = {
|
||||
completion = {
|
||||
callSnippet = "Replace",
|
||||
},
|
||||
-- diagnostics = { disable = { 'missing-fields' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
ltex = {
|
||||
filetypes = { "tex" },
|
||||
settings = {
|
||||
dictionary = {
|
||||
["en-US"] = { "homotopy" },
|
||||
},
|
||||
},
|
||||
},
|
||||
hls = {
|
||||
filetypes = { "haskell", "lhaskell", "cabal" },
|
||||
haskell = {
|
||||
cabalFormattingProvider = "cabalfmt",
|
||||
formattingProvider = "fourmolu",
|
||||
},
|
||||
single_file_suppport = true,
|
||||
},
|
||||
}
|
||||
-- Use :Mason to install manually
|
||||
require("mason").setup()
|
||||
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, { "stylua" })
|
||||
require("mason-tool-installer").setup({
|
||||
ensure_installed = ensure_installed,
|
||||
})
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
handlers = {
|
||||
function(server_name)
|
||||
local server = servers[server_name] or {}
|
||||
-- This handles overriding only values explicitly passed
|
||||
-- by the server configuration above. Useful when disabling
|
||||
-- certain features of an LSP (for example, turning off formatting for tsserver)
|
||||
server.capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
capabilities,
|
||||
server.capabilities or {}
|
||||
)
|
||||
require("lspconfig")[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
-- To add "add to dictionary" to ltex, but doesn't work...
|
||||
-- { "vigoux/ltex-ls.nvim", dependencies = { "neovim/nvim-lspconfig" } },
|
||||
|
||||
-- Something I tried, but didn't work:
|
||||
-- require("ltex-ls").setup {
|
||||
-- on_attach = on_attach,
|
||||
-- capabilities = capabilities,
|
||||
-- use_spellfile = false,
|
||||
-- filetypes = { "latex", "tex", "bib", "markdown", "gitcommit", "text" },
|
||||
-- settings = {
|
||||
-- ltex = {
|
||||
-- enabled = { "latex", "tex", "bib", "markdown" },
|
||||
-- language = "auto",
|
||||
-- diagnosticSeverity = "information",
|
||||
-- sentenceCacheSize = 2000,
|
||||
-- additionalRules = {
|
||||
-- enablePickyRules = true,
|
||||
-- motherTongue = "fr",
|
||||
-- },
|
||||
-- disabledRules = {
|
||||
-- fr = { "APOS_TYP", "FRENCH_WHITESPACE" },
|
||||
-- },
|
||||
-- dictionary = (function()
|
||||
-- -- For dictionary, search for files in the runtime to have
|
||||
-- -- and include them as externals the format for them is
|
||||
-- -- dict/{LANG}.txt
|
||||
-- --
|
||||
-- -- Also add dict/default.txt to all of them
|
||||
-- local files = {}
|
||||
-- for _, file in ipairs(vim.api.nvim_get_runtime_file("dict/*", true)) do
|
||||
-- local lang = vim.fn.fnamemodify(file, ":t:r")
|
||||
-- local fullpath = vim.fs.normalize(file, ":p")
|
||||
-- files[lang] = { ":" .. fullpath }
|
||||
-- end
|
||||
--
|
||||
-- if files.default then
|
||||
-- for lang, _ in pairs(files) do
|
||||
-- if lang ~= "default" then
|
||||
-- vim.list_extend(files[lang], files.default)
|
||||
-- end
|
||||
-- end
|
||||
-- files.default = nil
|
||||
-- end
|
||||
-- return files
|
||||
-- end)(),
|
||||
-- },
|
||||
-- },
|
||||
-- }
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = {
|
||||
{ "nvim-tree/nvim-web-devicons", enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
icons_enabled = false,
|
||||
theme = "catppuccin",
|
||||
component_separators = "|",
|
||||
section_separators = "",
|
||||
},
|
||||
-- lualine layout:
|
||||
-- +-------------------------------------------------+
|
||||
-- | A | B | C X | Y | Z |
|
||||
-- +-------------------------------------------------+
|
||||
sections = { lualine_x = { "filetype" } },
|
||||
},
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
return { -- Collection of various small independent plugins/modules
|
||||
"echasnovski/mini.nvim",
|
||||
config = function()
|
||||
-- Better Around/Inside textobjects
|
||||
|
||||
-- Examples:
|
||||
-- - yinq - [Y]ank [I]nside [N]ext [']quote
|
||||
-- - ci' - [C]hange [I]nside [']quote
|
||||
require("mini.ai").setup({ n_lines = 500 })
|
||||
|
||||
-- Add/delete/replace surroundings (brackets, quotes, etc.)
|
||||
--
|
||||
-- - saiw( - [S]urround [A]dd [I]nner [W]ord [)]Paren
|
||||
-- - sd' - [S]urround [D]elete [']quotes
|
||||
-- - sr(' - [S]urround [R]eplace [)] [']
|
||||
--
|
||||
-- nvim-surround is better...
|
||||
-- require("mini.surround").setup {}
|
||||
|
||||
-- See 'https://github.com/echasnovski/mini.nvim' for more uses
|
||||
end,
|
||||
}
|
|
@ -0,0 +1,80 @@
|
|||
return {
|
||||
-- Fuzzy Finder (files, lsp, etc)
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VimEnter",
|
||||
branch = "0.1.x",
|
||||
dependencies = {
|
||||
{ "nvim-lua/plenary.nvim" },
|
||||
{ -- If encountering errors, see telescope-fzf-native README
|
||||
"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 },
|
||||
{ "xiyaowong/telescope-emoji.nvim" },
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = { ["<c-enter>"] = "to_fuzzy_refine" },
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
["ui-select"] = {
|
||||
require("telescope.themes").get_dropdown(),
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require("telescope").load_extension, "fzf")
|
||||
pcall(require("telescope").load_extension, "ui-select")
|
||||
require("telescope").load_extension("emoji")
|
||||
|
||||
-- Mappings
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require("telescope.builtin")
|
||||
local nmap = function(key, cmd, desc)
|
||||
vim.keymap.set("n", key, cmd, { desc = desc })
|
||||
end
|
||||
nmap("<leader>sh", builtin.help_tags, "[S]earch [H]elp")
|
||||
nmap("<leader>sk", builtin.keymaps, "[S]earch [K]eymaps")
|
||||
nmap("<leader>sf", builtin.find_files, "[S]earch [F]iles")
|
||||
nmap("<leader>ss", builtin.builtin, "[S]earch [S]elect Telescope")
|
||||
nmap("<leader>sw", builtin.grep_string, "[S]earch current [W]ord")
|
||||
nmap("<leader>sg", builtin.live_grep, "[S]earch by [G]rep")
|
||||
nmap("<leader>sd", builtin.diagnostics, "[S]earch [D]iagnostics")
|
||||
nmap("<leader>sr", builtin.resume, "[S]earch [R]esume")
|
||||
nmap("<leader>s.", builtin.oldfiles, "[S]earch [.] (Recent Files)")
|
||||
nmap("<leader>sg", builtin.git_files, "[S]earch [G]it Files")
|
||||
nmap("<leader><leader>", builtin.buffers, "[ ] Find existing buffers")
|
||||
nmap("<leader>se", ":Telescope emoji<CR>", "[S]earch [E]mojis")
|
||||
|
||||
local fuzzy_find = function()
|
||||
builtin.current_buffer_fuzzy_find(
|
||||
require("telescope.themes").get_dropdown({
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
)
|
||||
end
|
||||
nmap("<leader>/", fuzzy_find, "[/] Fuzzily search current buffer")
|
||||
|
||||
local live_grep = function()
|
||||
builtin.live_grep({
|
||||
grep_open_files = true,
|
||||
prompt_title = "Live Grep in Open Files",
|
||||
})
|
||||
end
|
||||
nmap("<leader>s/", live_grep, "[S]earch [/] in Open Files")
|
||||
|
||||
local find_files = function()
|
||||
builtin.find_files({ cwd = vim.fn.stdpath("config") })
|
||||
end
|
||||
nmap("<leader>sn", find_files, "[S]earch [N]eovim files")
|
||||
end,
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
return {
|
||||
-- Highlight, edit, and navigate code
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
dependencies = {
|
||||
-- Interact with treesitter textobjects
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
-- Keeps function description stuck on top
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
-- Extra stuff
|
||||
"nvim-treesitter/nvim-treesitter-refactor",
|
||||
},
|
||||
opts = {
|
||||
-- Add languages to be installed here that you want installed for treesitter
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"haskell",
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
-- "org",
|
||||
"norg",
|
||||
"markdown",
|
||||
},
|
||||
ignore_install = { "latex" },
|
||||
auto_install = true,
|
||||
-- indent = { enable = true },
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { "latex" },
|
||||
-- additional_vim_regex_highlighting = { "latex", "markdown" },
|
||||
},
|
||||
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
-- Defaults
|
||||
-- init_selection = "gnn",
|
||||
-- node_incremental = "grn",
|
||||
-- scope_incremental = "grc",
|
||||
-- node_decremental = "grm",
|
||||
|
||||
init_selection = "<c-space>",
|
||||
node_incremental = "<c-space>",
|
||||
scope_incremental = "<c-s>",
|
||||
node_decremental = "<m-space>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
select = {
|
||||
enable = true,
|
||||
-- automatically jump forward to textobj, see targets.vim
|
||||
lookahead = true,
|
||||
keymaps = {
|
||||
-- you can use the capture groups defined in textobjects.scm
|
||||
["af"] = { query = "@function.outer", desc = "[a]round [f]unction" },
|
||||
["if"] = { query = "@function.inner", desc = "[i]nner [f]unction" },
|
||||
-- [a/i]p is taken for "paragraph".
|
||||
["aa"] = {
|
||||
query = "@parameter.outer",
|
||||
desc = "[a]round [a]rgument",
|
||||
},
|
||||
["ia"] = { query = "@parameter.inner", desc = "[i]nner [a]rgument" },
|
||||
-- fucks up vimtex commands!
|
||||
-- ['ac'] = '@class.outer',
|
||||
-- ['ic'] = '@class.inner',
|
||||
},
|
||||
},
|
||||
move = {
|
||||
enable = true,
|
||||
set_jumps = true,
|
||||
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>>"] = "@parameter.inner",
|
||||
},
|
||||
swap_previous = {
|
||||
["<leader><"] = "@parameter.inner",
|
||||
},
|
||||
},
|
||||
lsp_interop = {
|
||||
enable = true,
|
||||
border = "none",
|
||||
floating_preview_opts = {},
|
||||
peek_definition_code = {
|
||||
["<leader>df"] = "@function.outer",
|
||||
["<leader>dF"] = "@class.outer",
|
||||
},
|
||||
},
|
||||
},
|
||||
refactor = {
|
||||
highlight_definitions = {
|
||||
enable = true,
|
||||
-- Set to false if you have an `updatetime` of ~100.
|
||||
clear_on_cursor_move = true,
|
||||
},
|
||||
highlight_current_scope = { enable = true },
|
||||
smart_rename = {
|
||||
enable = true,
|
||||
-- Assign keymaps to false to disable them, e.g. `smart_rename = false`.
|
||||
keymaps = {
|
||||
smart_rename = "grr",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
return { -- Shows pending keybinds
|
||||
"folke/which-key.nvim",
|
||||
event = "VimEnter",
|
||||
config = function()
|
||||
require("which-key").setup({
|
||||
-- Remove this if so many keymaps, that you need to scroll
|
||||
popup_mappings = {
|
||||
scroll_down = "<Nop>",
|
||||
scroll_up = "<Nop>",
|
||||
},
|
||||
-- Doesn't work
|
||||
-- trigger_blacklist = {
|
||||
-- v = { "j", "k", "<C-D>", "<C-U>" },
|
||||
-- },
|
||||
})
|
||||
|
||||
-- Document existing key chains
|
||||
require("which-key").register({
|
||||
-- Naming leader-key-groups
|
||||
["<leader>c"] = { name = "[C]ode", _ = "which_key_ignore" },
|
||||
["<leader>d"] = { name = "[D]ocument", _ = "which_key_ignore" },
|
||||
["<leader>r"] = { name = "[R]ename", _ = "which_key_ignore" },
|
||||
["<leader>s"] = { name = "[S]earch", _ = "which_key_ignore" },
|
||||
["<leader>w"] = { name = "[W]orkspace", _ = "which_key_ignore" },
|
||||
["<leader>o"] = { name = "[O]rgmode", _ = "which_key_ignore" },
|
||||
})
|
||||
end,
|
||||
}
|
Loading…
Reference in New Issue