commit ca57342a54bc36a4614bfd87e216d2d00b8fe386 Author: pika Date: Fri Mar 28 13:03:36 2025 +0100 batman diff --git a/.neoconf.json b/.neoconf.json new file mode 100644 index 0000000..2d7a81f --- /dev/null +++ b/.neoconf.json @@ -0,0 +1,20 @@ +{ + "neodev": { + "library": { + "enabled": true, + "plugins": true + } + }, + "neoconf": { + "plugins": { + "lua_ls": { + "enabled": true + } + } + }, + "lspconfig": { + "lua_ls": { + "Lua.format.enable": false + } + } +} diff --git a/.stylua.toml b/.stylua.toml new file mode 100644 index 0000000..bfcffff --- /dev/null +++ b/.stylua.toml @@ -0,0 +1,7 @@ +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "None" +collapse_simple_statement = "Always" diff --git a/lua/community.lua b/lua/community.lua new file mode 100644 index 0000000..5cce0f2 --- /dev/null +++ b/lua/community.lua @@ -0,0 +1,12 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroCommunity: import any community modules here +-- We import this file in `lazy_setup.lua` before the `plugins/` folder. +-- This guarantees that the specs are processed before any user plugins. + +---@type LazySpec +return { + "AstroNvim/astrocommunity", + { import = "astrocommunity.pack.lua" }, + -- import/override with your plugins folder +} diff --git a/lua/core/keymaps.lua b/lua/core/keymaps.lua new file mode 100644 index 0000000..69fc905 --- /dev/null +++ b/lua/core/keymaps.lua @@ -0,0 +1,89 @@ +vim.g.mapleader = " " + +-- ─< lua/keymaps.lua >───────────────────────────────────────────────────────────────── +local nomap = vim.keymap.set +nomap("i", "", "") +nomap("n", "", "") +nomap("n", "q", "") +nomap("v", "q", "") +nomap("v", "S", "") + +local map = vim.keymap.set + +map("n", "", "nohlsearch") + +-- ─< Comment >───────────────────────────────────────────────────────────────────────── +map("n", "", "gcc", { desc = "comment toggle", remap = true }) +map("v", "", "gc", { desc = "comment toggle", remap = true }) + +-- ─< Terminal >──────────────────────────────────────────────────────────────────────── +map("t", "", "", { desc = "terminal escape terminal mode" }) + +-- ─< Movement while in "insert"-mode >───────────────────────────────────────────────── +map("i", "", "^i", { desc = "move beginning of line" }) +map("i", "", "", { desc = "move end of line" }) +map("i", "", "", { desc = "move left" }) +map("i", "", "", { desc = "move right" }) +map("i", "", "", { desc = "move down" }) +map("i", "", "", { desc = "move up" }) + +map("n", ";", ":", { desc = "CMD enter command mode" }) +map("i", "jk", "") +map("i", "", "") +map("n", "", "") +map("v", "", "") + +map("n", "x", "bd!") + +-- ─< Disable arrow keys in normal mode >─────────────────────────────────────────────── +map("n", "", 'echo "Use h to move!!"') +map("n", "", 'echo "Use l to move!!"') +map("n", "", 'echo "Use k to move!!"') +map("n", "", 'echo "Use j to move!!"') + +map("n", "l", "", { desc = "Move focus to the right window" }) +map("n", "h", "", { desc = "Move focus to the left window" }) +map("n", "j", "", { desc = "Move focus to the lower window" }) +map("n", "k", "", { desc = "Move focus to the upper window" }) + +-- map("n", "p", vim.cmd.Ex) +map("n", "q", vim.cmd.q) +map("n", "s", vim.cmd.w) +map("n", "", vim.cmd.w) + +-- ─< rename word under cursor >─────────────────────────────────────────────────────────── +map("n", "R", [[:%s/\<\>//gI]]) + +-- window management +map("n", "sv", "v", { desc = "Split window vertically" }) -- split window vertically +map("n", "sh", "s", { desc = "Split window horizontally" }) -- split window horizontally + +vim.keymap.set({ "n", "i" }, "tt", function() + -- Frage den Shell-Command ab + vim.ui.input({ prompt = "Shell Command: " }, function(cmd) + if cmd == nil or cmd == "" then + return + end + + local result = vim.fn.system(cmd) + local exit_code = vim.v.shell_error + + if exit_code ~= 0 then + vim.notify("Shell Error:\n" .. result, vim.log.levels.ERROR, { title = "Shell Command Failed" }) + return + end + + local lines = vim.split(result, "\n", { trimempty = true }) + + -- Insert at cursor position + local row, col = unpack(vim.api.nvim_win_get_cursor(0)) + if #lines == 1 then + -- Insert inline if the result is a single line + local current_line = vim.api.nvim_get_current_line() + local new_line = current_line:sub(1, col) .. lines[1] .. current_line:sub(col + 1) + vim.api.nvim_set_current_line(new_line) + else + vim.api.nvim_buf_set_lines(0, row, row, false, lines) + end + end) +end, { desc = "Insert Shell Output at Cursor" }) diff --git a/lua/core/options.lua b/lua/core/options.lua new file mode 100644 index 0000000..fa3fc11 --- /dev/null +++ b/lua/core/options.lua @@ -0,0 +1,85 @@ +vim.cmd("let g:netrw_liststyle = 3") + +local o = vim.opt + +o.relativenumber = true +o.number = true + +-- Minimal number of screen lines to keep above and below the cursor. +o.scrolloff = 8 + +-- tabs & indentation +o.tabstop = 2 -- 2 spaces for tabs (prettier default) +o.shiftwidth = 2 -- 2 spaces for indent width +o.softtabstop = 2 +-- o.tabstop = 4 -- for TitusWorkings +-- o.shiftwidth = 4 -- for TitusWorkings +-- o.softtabstop = 4 -- for TitusWorkings +o.expandtab = true -- expand tab to spaces +o.autoindent = true -- copy indent from current line when starting new one + +o.mouse = "a" +o.mousemoveevent = true +o.wrap = false + +-- search settings +o.ignorecase = true -- ignore case when searching +o.smartcase = true -- if you include mixed case in your search, assumes you want case-sensitive + +o.cursorline = true + +-- Don't show the mode, since it's already in the status line +o.showmode = false + +-- turn on termguicolors for tokyonight colorscheme to work +-- (have to use iterm2 or any other true color terminal) +o.termguicolors = true +o.background = "dark" -- colorschemes that can be light or dark will be made dark +o.signcolumn = "yes" -- show sign column so that text doesn't shift + +-- backspace +o.backspace = "indent,eol,start" -- allow backspace on indent, end of line or insert mode start position + +-- clipboard +o.clipboard:append("unnamedplus") -- use system clipboard as default register + +-- split windows +o.splitright = true -- split vertical window to the right +o.splitbelow = true -- split horizontal window to the bottom +o.splitkeep = "screen" +o.laststatus = 3 + +-- turn off swapfile +o.swapfile = false + +-- Disable the tilde on empty lines +o.fillchars = { eob = " " } + +-- SudaRead automatic if file is inaccessible +vim.g.suda_smart_edit = 1 + +vim.api.nvim_create_autocmd("TextYankPost", { + desc = "Highlight when yanking (copying) text", + group = vim.api.nvim_create_augroup("kickstart-highlight-yank", { clear = true }), + callback = function() + vim.highlight.on_yank() + end, +}) + +-- Set cursor to beam when entering Neovim +vim.cmd([[ + augroup ChangeCursorShape + autocmd! + autocmd VimEnter * set guicursor=n-v-c-sm:block,i-ci-ve:ver25,r-cr-o:hor20 + autocmd VimLeave * set guicursor=a:ver25 + augroup END +]]) + +if vim.g.neovide then + -- vim.g.neovide_transparency = 0.35 + vim.g.neovide_transparency = 1 + vim.g.neovide_theme = "dark" + vim.g.neovide_refresh_rate = 90 + vim.g.neovide_cursor_vfx_mode = "torpedo" + vim.g.neovide_cursor_smooth_blink = true +end diff --git a/lua/lazy_setup.lua b/lua/lazy_setup.lua new file mode 100644 index 0000000..4d9552f --- /dev/null +++ b/lua/lazy_setup.lua @@ -0,0 +1,32 @@ +require("lazy").setup({ + { + "AstroNvim/AstroNvim", + version = "^5", -- Remove version tracking to elect for nightly AstroNvim + import = "astronvim.plugins", + opts = { -- AstroNvim options must be set here with the `import` key + mapleader = " ", -- This ensures the leader key must be configured before Lazy is set up + maplocalleader = ",", -- This ensures the localleader key must be configured before Lazy is set up + icons_enabled = true, -- Set to false to disable icons (if no Nerd Font is available) + pin_plugins = nil, -- Default will pin plugins when tracking `version` of AstroNvim, set to true/false to override + update_notifications = true, -- Enable/disable notification about running `:Lazy update` twice to update pinned plugins + }, + }, + { import = "community" }, + { import = "plugins" }, +} --[[@as LazySpec]], { + -- Configure any other `lazy.nvim` configuration options here + install = { colorscheme = { "astrotheme", "habamax" } }, + ui = { backdrop = 100 }, + performance = { + rtp = { + -- disable some rtp plugins, add more to your liking + disabled_plugins = { + "gzip", + "netrwPlugin", + "tarPlugin", + "tohtml", + "zipPlugin", + }, + }, + }, +} --[[@as LazyConfig]]) diff --git a/lua/plugins/astrocore.lua b/lua/plugins/astrocore.lua new file mode 100644 index 0000000..c8f67a0 --- /dev/null +++ b/lua/plugins/astrocore.lua @@ -0,0 +1,72 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroCore provides a central place to modify mappings, vim options, autocommands, and more! +-- Configuration documentation can be found with `:h astrocore` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrocore", + ---@type AstroCoreOpts + opts = { + -- Configure core features of AstroNvim + features = { + large_buf = { size = 1024 * 256, lines = 10000 }, -- set global limits for large files for disabling features like treesitter + autopairs = true, -- enable autopairs at start + cmp = true, -- enable completion at start + diagnostics = { virtual_text = true, virtual_lines = false }, -- diagnostic settings on startup + highlighturl = true, -- highlight URLs at start + notifications = true, -- enable notifications at start + }, + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + -- vim options can be configured here + options = { + opt = { -- vim.opt. + relativenumber = true, -- sets vim.opt.relativenumber + number = true, -- sets vim.opt.number + spell = false, -- sets vim.opt.spell + signcolumn = "yes", -- sets vim.opt.signcolumn to yes + wrap = false, -- sets vim.opt.wrap + }, + g = { -- vim.g. + -- configure global vim variables (vim.g) + -- NOTE: `mapleader` and `maplocalleader` must be set in the AstroNvim opts or before `lazy.setup` + -- This can be found in the `lua/lazy_setup.lua` file + }, + }, + -- Mappings can be configured through AstroCore as well. + -- NOTE: keycodes follow the casing in the vimdocs. For example, `` must be capitalized + mappings = { + -- first key is the mode + n = { + -- second key is the lefthand side of the map + + -- navigate buffer tabs + ["]b"] = { function() require("astrocore.buffer").nav(vim.v.count1) end, desc = "Next buffer" }, + ["[b"] = { function() require("astrocore.buffer").nav(-vim.v.count1) end, desc = "Previous buffer" }, + + -- mappings seen under group name "Buffer" + ["bd"] = { + function() + require("astroui.status.heirline").buffer_picker( + function(bufnr) require("astrocore.buffer").close(bufnr) end + ) + end, + desc = "Close buffer from tabline", + }, + + -- tables with just a `desc` key will be registered with which-key if it's installed + -- this is useful for naming menus + -- ["b"] = { desc = "Buffers" }, + + -- setting a mapping to false will disable it + -- [""] = false, + }, + }, + }, +} diff --git a/lua/plugins/astrolsp.lua b/lua/plugins/astrolsp.lua new file mode 100644 index 0000000..21bb78c --- /dev/null +++ b/lua/plugins/astrolsp.lua @@ -0,0 +1,105 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroLSP allows you to customize the features in AstroNvim's LSP configuration engine +-- Configuration documentation can be found with `:h astrolsp` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astrolsp", + ---@type AstroLSPOpts + opts = { + -- Configuration table of features provided by AstroLSP + features = { + codelens = true, -- enable/disable codelens refresh on start + inlay_hints = false, -- enable/disable inlay hints on start + semantic_tokens = true, -- enable/disable semantic token highlighting + }, + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 1000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + -- customize language server configuration options passed to `lspconfig` + ---@diagnostic disable: missing-fields + config = { + -- clangd = { capabilities = { offsetEncoding = "utf-8" } }, + }, + -- customize how language servers are attached + handlers = { + -- a function without a key is simply the default handler, functions take two parameters, the server name and the configured options table for that server + -- function(server, opts) require("lspconfig")[server].setup(opts) end + + -- the key is the server that is being setup with `lspconfig` + -- rust_analyzer = false, -- setting a handler to false will disable the set up of that language server + -- pyright = function(_, opts) require("lspconfig").pyright.setup(opts) end -- or a custom handler function can be passed + }, + -- Configure buffer local auto commands to add when attaching a language server + autocmds = { + -- first key is the `augroup` to add the auto commands to (:h augroup) + lsp_codelens_refresh = { + -- Optional condition to create/delete auto command group + -- can either be a string of a client capability or a function of `fun(client, bufnr): boolean` + -- condition will be resolved for each client on each execution and if it ever fails for all clients, + -- the auto commands will be deleted for that buffer + cond = "textDocument/codeLens", + -- cond = function(client, bufnr) return client.name == "lua_ls" end, + -- list of auto commands to set + { + -- events to trigger + event = { "InsertLeave", "BufEnter" }, + -- the rest of the autocmd options (:h nvim_create_autocmd) + desc = "Refresh codelens (buffer)", + callback = function(args) + if require("astrolsp").config.features.codelens then vim.lsp.codelens.refresh { bufnr = args.buf } end + end, + }, + }, + }, + -- mappings to be set up on attaching of a language server + mappings = { + n = { + -- a `cond` key can provided as the string of a server capability to be required to attach, or a function with `client` and `bufnr` parameters from the `on_attach` that returns a boolean + gD = { + function() vim.lsp.buf.declaration() end, + desc = "Declaration of current symbol", + cond = "textDocument/declaration", + }, + ["uY"] = { + function() require("astrolsp.toggles").buffer_semantic_tokens() end, + desc = "Toggle LSP semantic highlight (buffer)", + cond = function(client) + return client.supports_method "textDocument/semanticTokens/full" and vim.lsp.semantic_tokens ~= nil + end, + }, + }, + }, + -- A custom `on_attach` function to be run after the default `on_attach` function + -- takes two parameters `client` and `bufnr` (`:h lspconfig-setup`) + on_attach = function(client, bufnr) + -- this would disable semanticTokensProvider for all clients + -- client.server_capabilities.semanticTokensProvider = nil + end, + }, +} diff --git a/lua/plugins/astroui.lua b/lua/plugins/astroui.lua new file mode 100644 index 0000000..170dcf9 --- /dev/null +++ b/lua/plugins/astroui.lua @@ -0,0 +1,39 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- AstroUI provides the basis for configuring the AstroNvim User Interface +-- Configuration documentation can be found with `:h astroui` +-- NOTE: We highly recommend setting up the Lua Language Server (`:LspInstall lua_ls`) +-- as this provides autocomplete and documentation while editing + +---@type LazySpec +return { + "AstroNvim/astroui", + ---@type AstroUIOpts + opts = { + -- change colorscheme + colorscheme = "astrodark", + -- AstroUI allows you to easily modify highlight groups easily for any and all colorschemes + highlights = { + init = { -- this table overrides highlights in all themes + -- Normal = { bg = "#000000" }, + }, + astrodark = { -- a table of overrides/changes when applying the astrotheme theme + -- Normal = { bg = "#000000" }, + }, + }, + -- Icons can be configured throughout the interface + icons = { + -- configure the loading of the lsp in the status line + LSPLoading1 = "⠋", + LSPLoading2 = "⠙", + LSPLoading3 = "⠹", + LSPLoading4 = "⠸", + LSPLoading5 = "⠼", + LSPLoading6 = "⠴", + LSPLoading7 = "⠦", + LSPLoading8 = "⠧", + LSPLoading9 = "⠇", + LSPLoading10 = "⠏", + }, + }, +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua new file mode 100644 index 0000000..94d113b --- /dev/null +++ b/lua/plugins/mason.lua @@ -0,0 +1,28 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Mason + +---@type LazySpec +return { + -- use mason-tool-installer for automatically installing Mason packages + { + "WhoIsSethDaniel/mason-tool-installer.nvim", + -- overrides `require("mason-tool-installer").setup(...)` + opts = { + -- Make sure to use the names found in `:Mason` + ensure_installed = { + -- install language servers + "lua-language-server", + + -- install formatters + "stylua", + + -- install debuggers + "debugpy", + + -- install any other package + "tree-sitter-cli", + }, + }, + }, +} diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua new file mode 100644 index 0000000..98a0eae --- /dev/null +++ b/lua/plugins/none-ls.lua @@ -0,0 +1,24 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize None-ls sources + +---@type LazySpec +return { + "nvimtools/none-ls.nvim", + opts = function(_, opts) + -- opts variable is the default configuration table for the setup function call + -- local null_ls = require "null-ls" + + -- Check supported formatters and linters + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/formatting + -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics + + -- Only insert new sources, do not replace the existing ones + -- (If you wish to replace, use `opts.sources = {}` instead of the `list_insert_unique` function) + opts.sources = require("astrocore").list_insert_unique(opts.sources, { + -- Set a formatter + -- null_ls.builtins.formatting.stylua, + -- null_ls.builtins.formatting.prettier, + }) + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..a96027a --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,15 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- Customize Treesitter + +---@type LazySpec +return { + "nvim-treesitter/nvim-treesitter", + opts = { + ensure_installed = { + "lua", + "vim", + -- add more arguments for adding more treesitter parsers + }, + }, +} diff --git a/lua/plugins/user.lua b/lua/plugins/user.lua new file mode 100644 index 0000000..206b5d4 --- /dev/null +++ b/lua/plugins/user.lua @@ -0,0 +1,419 @@ +-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- You can also add or configure plugins by creating files in this `plugins/` folder +-- PLEASE REMOVE THE EXAMPLES YOU HAVE NO INTEREST IN BEFORE ENABLING THIS FILE +-- Here are some examples: + +---@type LazySpec +return { + + -- == Examples of Adding Plugins == + + "andweeb/presence.nvim", + { + "ray-x/lsp_signature.nvim", + event = "BufRead", + config = function() require("lsp_signature").setup() end, + }, + + "lambdalisue/vim-suda", + "folke/lsp-colors.nvim", + "dstein64/nvim-scrollview", + + -- == Examples of Overriding Plugins == + + -- customize dashboard options + -- { + -- "folke/snacks.nvim", + -- opts = { + -- dashboard = { + -- preset = { + -- header = table.concat({ + -- " █████ ███████ ████████ ██████ ██████ ", + -- "██ ██ ██ ██ ██ ██ ██ ██", + -- "███████ ███████ ██ ██████ ██ ██", + -- "██ ██ ██ ██ ██ ██ ██ ██", + -- "██ ██ ███████ ██ ██ ██ ██████ ", + -- "", + -- "███  ██ ██  ██ ██ ███  ███", + -- "████  ██ ██  ██ ██ ████  ████", + -- "██ ██  ██ ██  ██ ██ ██ ████ ██", + -- "██  ██ ██  ██  ██  ██ ██  ██  ██", + -- "██   ████   ████   ██ ██      ██", + -- }, "\n"), + -- }, + -- }, + -- }, + -- }, + + -- You can disable default plugins as follows: + { "max397574/better-escape.nvim", enabled = true }, + + -- You can also easily customize additional setup of plugins that is outside of the plugin's setup call + { + "L3MON4D3/LuaSnip", + config = function(plugin, opts) + -- include the default astronvim config that calls the setup call + require "astronvim.plugins.configs.luasnip"(plugin, opts) + -- load snippets paths + require("luasnip.loaders.from_vscode").lazy_load { + paths = { vim.fn.stdpath "config" .. "/snippets" }, + } + end, + }, + + { + "windwp/nvim-autopairs", + config = function(plugin, opts) + require "astronvim.plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call + -- add more custom autopairs configuration such as custom rules + local npairs = require "nvim-autopairs" + local Rule = require "nvim-autopairs.rule" + local cond = require "nvim-autopairs.conds" + npairs.add_rules( + { + Rule("$", "$", { "tex", "latex" }) + -- don't add a pair if the next character is % + :with_pair(cond.not_after_regex "%%") + -- don't add a pair if the previous character is xxx + :with_pair( + cond.not_before_regex("xxx", 3) + ) + -- don't move right when repeat character + :with_move(cond.none()) + -- don't delete if the next character is xx + :with_del(cond.not_after_regex "xx") + -- disable adding a newline when you press + :with_cr(cond.none()), + }, + -- disable for .vim files, but it work for another filetypes + Rule("a", "a", "-vim") + ) + end, + }, + + -- { + -- "saghen/blink.cmp", + -- -- -- optional: provides snippets for the snippet source + -- -- dependencies = { "rafamadriz/friendly-snippets" }, + -- -- + -- -- -- use a release tag to download pre-built binaries + -- -- version = "1.*", + -- -- -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- -- -- build = "cargo build --release", + -- -- -- If you use nix, you can build from source using latest nightly rust with: + -- -- -- build = 'nix run .#build-plugin', + -- -- + -- ---@module 'blink.cmp' + -- ---@type blink.cmp.Config + -- opts = { + -- -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- -- 'super-tab' for mappings similar to vscode (tab to accept) + -- -- 'enter' for enter to accept + -- -- 'none' for no mappings + -- keymap = { + -- -- set to 'none' to disable the 'default' preset + -- preset = "super-tab", + -- + -- [""] = { "select_prev", "fallback" }, + -- [""] = { "select_next", "fallback" }, + -- [""] = { "hide", "fallback" }, + -- + -- -- disable a keymap from the preset + -- [""] = {}, + -- [""] = {}, + -- [""] = {}, + -- + -- -- show with a list of providers + -- -- [""] = { + -- -- function(cmp) + -- -- cmp.show({ providers = { "snippets" } }) + -- -- end, + -- -- }, + -- + -- -- control whether the next command will be run when using a function + -- -- [""] = { + -- -- function(cmp) + -- -- if some_condition then + -- -- return + -- -- end -- runs the next command + -- -- return true -- doesn't run the next command + -- -- end, + -- -- "select_next", + -- -- }, + -- }, + -- + -- -- appearance = { + -- -- -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- -- -- Adjusts spacing to ensure icons are aligned + -- -- nerd_font_variant = "mono", + -- -- + -- -- -- highlight_ns = vim.api.nvim_create_namespace("nvim-cmp"), + -- -- -- Sets the fallback highlight groups to nvim-cmp's highlight groups + -- -- -- Useful for when your theme doesn't support blink.cmp + -- -- -- Will be removed in a future release + -- -- + -- -- use_nvim_cmp_as_default = true, + -- -- }, + -- + -- -- (Default) Only show the documentation popup when manually triggered + -- completion = { + -- keyword = { range = "full" }, + -- -- trigger = { + -- -- When true, will prefetch the completion items when entering insert mode + -- -- prefetch_on_insert = false, + -- + -- -- When false, will not show the completion window automatically when in a snippet + -- -- show_in_snippet = true, + -- + -- -- When true, will show the completion window after typing any of alphanumerics, `-` or `_` + -- -- show_on_keyword = true, + -- + -- -- When true, will show the completion window after typing a trigger character + -- -- show_on_trigger_character = true, + -- + -- -- LSPs can indicate when to show the completion window via trigger characters + -- -- however, some LSPs (i.e. tsserver) return characters that would essentially + -- -- always show the window. We block these by default. + -- -- show_on_blocked_trigger_characters = { " ", "\n", "\t" }, + -- -- You can also block per filetype with a function: + -- -- show_on_blocked_trigger_characters = function(ctx) + -- -- if vim.bo.filetype == "markdown" then + -- -- return { " ", "\n", "\t", ".", "/", "(", "[" } + -- -- end + -- -- return { " ", "\n", "\t" } + -- -- end, + -- + -- -- When both this and show_on_trigger_character are true, will show the completion window + -- -- when the cursor comes after a trigger character after accepting an item + -- -- show_on_accept_on_trigger_character = true, + -- + -- -- When both this and show_on_trigger_character are true, will show the completion window + -- -- when the cursor comes after a trigger character when entering insert mode + -- -- show_on_insert_on_trigger_character = true, + -- + -- -- List of trigger characters (on top of `show_on_blocked_trigger_characters`) that won't trigger + -- -- the completion window when the cursor comes after a trigger character when + -- -- entering insert mode/accepting an item + -- -- show_on_x_blocked_trigger_characters = { "'", '"', "(" }, + -- -- or a function, similar to show_on_blocked_trigger_character + -- -- }, + -- list = { + -- -- Maximum number of items to display + -- max_items = 128, + -- + -- selection = { + -- -- When `true`, will automatically select the first item in the completion list + -- preselect = true, + -- -- preselect = function(ctx) return vim.bo.filetype ~= 'markdown' end, + -- + -- -- When `true`, inserts the completion item automatically when selecting it + -- -- You may want to bind a key to the `cancel` command (default ) when using this option, + -- -- which will both undo the selection and hide the completion menu + -- auto_insert = false, + -- -- auto_insert = function(ctx) return vim.bo.filetype ~= 'markdown' end + -- }, + -- + -- cycle = { + -- -- When `true`, calling `select_next` at the _bottom_ of the completion list + -- -- will select the _first_ completion item. + -- from_bottom = true, + -- -- When `true`, calling `select_prev` at the _top_ of the completion list + -- -- will select the _last_ completion item. + -- from_top = true, + -- }, + -- }, + -- + -- -- documentation = { + -- -- auto_show = false, + -- -- auto_show_delay_ms = 230, + -- -- update_delay_ms = 50, + -- -- treesitter_highlighting = false, + -- -- draw = function(opts) opts.default_implementation() end, + -- -- window = { + -- -- min_width = 16, + -- -- max_width = 80, + -- -- max_height = 24, + -- -- border = "padded", -- Defaults to `vim.o.winborder` on nvim 0.11+ or 'padded' when not defined/<=0.10 + -- -- winblend = 0, + -- -- winhighlight = "Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,EndOfBuffer:BlinkCmpDoc", + -- -- -- Note that the gutter will be disabled when border ~= 'none' + -- -- scrollbar = true, + -- -- }, + -- -- }, + -- -- ghost_text = { + -- -- enabled = true, + -- -- show_with_selection = true, + -- -- show_without_selection = false, + -- -- show_with_menu = true, + -- -- show_without_menu = false, + -- -- }, + -- -- ─────────────────────────────────< mini-icons config >────────────────────────────── + -- -- menu = { + -- -- enabled = true, + -- -- min_width = 16, + -- -- max_height = 10, + -- -- border = nil, -- Defaults to `vim.o.winborder` on nvim 0.11+ + -- -- winblend = 0, + -- -- winhighlight = "Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None", + -- -- -- Keep the cursor X lines away from the top/bottom of the window + -- -- scrolloff = 2, + -- -- -- Note that the gutter will be disabled when border ~= 'none' + -- -- scrollbar = true, + -- -- -- Which directions to show the window, + -- -- -- falling back to the next direction when there's not enough space + -- -- direction_priority = { "s", "n" }, + -- -- + -- -- -- Whether to automatically show the window when new completion items are available + -- -- auto_show = true, + -- -- + -- -- draw = { + -- -- -- Aligns the keyword you've typed to a component in the menu + -- -- align_to = "label", -- or 'none' to disable, or 'cursor' to align to the cursor + -- -- -- Left and right padding, optionally { left, right } for different padding on each side + -- -- padding = 1, + -- -- -- Gap between columns + -- -- gap = 2, + -- -- -- Use treesitter to highlight the label text for the given list of sources + -- -- -- treesitter = {}, + -- -- treesitter = { "lsp" }, + -- -- columns = { { "kind_icon" }, { "label", "label_description", gap = 1 } }, + -- -- components = { + -- -- label = { + -- -- text = function(ctx) return require("colorful-menu").blink_components_text(ctx) end, + -- -- highlight = function(ctx) return require("colorful-menu").blink_components_highlight(ctx) end, + -- -- }, + -- -- kind_icon = { + -- -- text = function(ctx) + -- -- local kind_icon, _, _ = require("mini.icons").get("lsp", ctx.kind) + -- -- return kind_icon + -- -- end, + -- -- -- (optional) use highlights from mini.icons + -- -- highlight = function(ctx) + -- -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + -- -- return hl + -- -- end, + -- -- }, + -- -- + -- -- -- kind = { + -- -- -- -- (optional) use highlights from mini.icons + -- -- -- highlight = function(ctx) + -- -- -- local _, hl, _ = require("mini.icons").get("lsp", ctx.kind) + -- -- -- return hl + -- -- -- end, + -- -- -- }, + -- -- + -- -- label_description = { + -- -- width = { max = 30 }, + -- -- text = function(ctx) return ctx.label_description end, + -- -- highlight = "BlinkCmpLabelDescription", + -- -- }, + -- -- + -- -- source_name = { + -- -- width = { max = 30 }, + -- -- text = function(ctx) return ctx.source_name end, + -- -- highlight = "BlinkCmpSource", + -- -- }, + -- -- + -- -- source_id = { + -- -- width = { max = 30 }, + -- -- text = function(ctx) return ctx.source_id end, + -- -- highlight = "BlinkCmpSource", + -- -- }, + -- -- }, + -- -- }, + -- -- }, + -- }, + -- + -- -- Default list of enabled providers defined so that you can extend it + -- -- elsewhere in your config, without redefining it, due to `opts_extend` + -- sources = { + -- default = { "lsp", "path", "snippets", "buffer" }, + -- }, + -- + -- -- snippets = { preset = "default" | "luasnip" }, + -- + -- -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- -- + -- -- See the fuzzy documentation for more information + -- fuzzy = { + -- implementation = "prefer_rust", + -- + -- -- Frecency tracks the most recently/frequently used items and boosts the score of the item + -- -- Note, this does not apply when using the Lua implementation. + -- use_frecency = true, + -- + -- -- Proximity bonus boosts the score of items matching nearby words + -- -- Note, this does not apply when using the Lua implementation. + -- use_proximity = true, + -- + -- -- UNSAFE!! When enabled, disables the lock and fsync when writing to the frecency database. This should only be used on unsupported platforms (i.e. alpine termux) + -- -- Note, this does not apply when using the Lua implementation. + -- use_unsafe_no_lock = false, + -- sorts = { + -- -- (optionally) always prioritize exact matches + -- -- 'exact', + -- + -- -- pass a function for custom behavior + -- -- function(item_a, item_b) + -- -- return item_a.score > item_b.score + -- -- end, + -- + -- "score", + -- "sort_text", + -- }, + -- }, + -- }, + -- opts_extend = { "sources.default" }, + -- }, + + { + { + "chrisgrieser/nvim-scissors", + lazy = false, + dependencies = { "nvim-telescope/telescope.nvim", "garymjr/nvim-snippets" }, + opts = { + snippetDir = "~/.config/nvim/snippets", -- <- i have this as a submodule in my neovim config to have a seperate repo https://git.k4li.de/dotfiles/nvim-snippets.git + }, + }, + -- ──────────────────────────< keybindings for snippets engine >─────────────────────── + vim.keymap.set("n", "sm", ":ScissorsEditSnippet"), + vim.keymap.set("v", "sa", ":ScissorsAddNewSnippet"), + }, + -- -@type LazySpec + { + "mikavilpas/yazi.nvim", + event = "VeryLazy", + keys = { + -- 👇 in this section, choose your own keymappings! + -- { + -- "lf", + -- "Yazi", + -- desc = "Open yazi at the current file", + -- }, + { + -- Open in the current working directory + "tLf", + "Yazi cwd", + desc = "Open the file manager in nvim's working directory", + }, + { + -- NOTE: this requires a version of yazi that includes + -- https://github.com/sxyazi/yazi/pull/1305 from 2024-07-18 + "tlf", + "Yazi toggle", + desc = "Resume the last yazi session", + }, + }, + ---@type YaziConfig + opts = { + -- if you want to open yazi instead of netrw, see below for more info + open_for_directories = true, + keymaps = { + show_help = "", + }, + }, + }, +} diff --git a/lua/polish.lua b/lua/polish.lua new file mode 100644 index 0000000..5b65b7d --- /dev/null +++ b/lua/polish.lua @@ -0,0 +1,18 @@ +if true then return end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE + +-- This will run last in the setup process and is a good place to configure +-- things like custom filetypes. This is just pure lua so anything that doesn't +-- fit in the normal config locations above can go here + +-- Set up custom filetypes +vim.filetype.add { + extension = { + foo = "fooscript", + }, + filename = { + ["Foofile"] = "fooscript", + }, + pattern = { + ["~/%.config/foo/.*"] = "fooscript", + }, +}