From 310b6c4d2534a897d0e2f9126bf91b7ebf82fdff Mon Sep 17 00:00:00 2001 From: Christopher Beckmann Date: Thu, 12 Dec 2024 18:04:51 +0100 Subject: [PATCH] nvim config update --- .config/nvim/lazy-lock.json | 19 ++- .config/nvim/lua/kamu/debug.lua | 9 ++ .config/nvim/lua/kamu/keymaps.lua | 4 + .config/nvim/lua/kamu/options.lua | 15 +- .config/nvim/lua/kamu/plugins/completions.lua | 112 +++++++++++--- .config/nvim/lua/kamu/plugins/lsp.lua | 142 +++++++++--------- .config/nvim/lua/kamu/plugins/lualine.lua | 22 +-- .config/nvim/lua/kamu/plugins/noice.lua | 26 ---- .config/nvim/lua/kamu/plugins/snacks.lua | 66 ++++++++ .config/nvim/lua/kamu/plugins/telescope.lua | 34 ++++- .../nvim/lua/kamu/snippets/plaintex/syss.lua | 31 ++++ 11 files changed, 336 insertions(+), 144 deletions(-) create mode 100644 .config/nvim/lua/kamu/debug.lua delete mode 100644 .config/nvim/lua/kamu/plugins/noice.lua create mode 100644 .config/nvim/lua/kamu/plugins/snacks.lua create mode 100644 .config/nvim/lua/kamu/snippets/plaintex/syss.lua diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 0ca068d..c933b5a 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,19 +1,30 @@ { + "Comment.nvim": { "branch": "master", "commit": "e30b7f2008e52442154b66f7c519bfd2f1e32acb" }, "LuaSnip": { "branch": "master", "commit": "cdbf6f41381e5ee4810b4b09284b603d8f18365d" }, "catppuccin": { "branch": "main", "commit": "fc537040147f0374a22b88142a20eb6781141f0b" }, + "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" }, + "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" }, "cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" }, - "lazy.nvim": { "branch": "main", "commit": "41d3b2a9dbf03774a2c92c376d8371dcca9710a9" }, - "lsp-zero.nvim": { "branch": "v3.x", "commit": "96f29a47fe48254cb3a826f6d7e90a108dae502d" }, - "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" }, + "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, + "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, + "lazy.nvim": { "branch": "main", "commit": "96584866b9c5e998cbae300594d0ccfd0c464627" }, + "lazydev.nvim": { "branch": "main", "commit": "f59bd14a852ca43db38e3662395354cb2a9b13e0" }, + "lspkind.nvim": { "branch": "master", "commit": "d79a1c3299ad0ef94e255d045bed9fa26025dab6" }, + "lualine.nvim": { "branch": "master", "commit": "2248ef254d0a1488a72041cfb45ca9caada6d994" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "ddefe5ab051e7ca6a7b374754f0920c44668b54f" }, "mason.nvim": { "branch": "main", "commit": "cd7835b15f5a4204fc37e0aa739347472121a54c" }, + "noice.nvim": { "branch": "main", "commit": "7b1960c48078a8b2fb44a89db82f4fa637b2d7c8" }, "nvim-cmp": { "branch": "main", "commit": "5dce1b778b85c717f6614e3f4da45e9f19f54435" }, "nvim-highlight-colors": { "branch": "main", "commit": "231547093a788b925b8fc36351ad422701c3a8c8" }, "nvim-lspconfig": { "branch": "master", "commit": "2b361e043810d5587d9af0787f8ce40da92ec5e9" }, + "nvim-scrollbar": { "branch": "main", "commit": "6994eb9f73d5fdc36ee2c8717940e8c853e51a49" }, "nvim-tree.lua": { "branch": "master", "commit": "53b0bcaadaffb505acff230578b56a86ec1ab38a" }, "nvim-treesitter": { "branch": "master", "commit": "dfd4fb330f75595813e2a2f83000580a36dd10ff" }, - "nvim-web-devicons": { "branch": "master", "commit": "a1e6268779411048a87f767a27380089362a0ce2" }, + "nvim-web-devicons": { "branch": "master", "commit": "3fafeea5f339223e888fd15eb4032260849cb038" }, "plenary.nvim": { "branch": "master", "commit": "9ce85b0f7dcfe5358c0be937ad23e456907d410b" }, + "snacks.nvim": { "branch": "main", "commit": "9651a931043359fcc094ab5c67ac22554a602745" }, + "telescope-fzf-native.nvim": { "branch": "main", "commit": "cf48d4dfce44e0b9a2e19a008d6ec6ea6f01a83b" }, "telescope.nvim": { "branch": "master", "commit": "54930e1abfc94409e1bb9266e752ef8379008592" }, "vim-tmux-navigator": { "branch": "master", "commit": "7db70e08ea03b3e4d91f63713d76134512e28d7e" } } \ No newline at end of file diff --git a/.config/nvim/lua/kamu/debug.lua b/.config/nvim/lua/kamu/debug.lua new file mode 100644 index 0000000..18d59f7 --- /dev/null +++ b/.config/nvim/lua/kamu/debug.lua @@ -0,0 +1,9 @@ +for _, style in ipairs({ "compact", "fancy", "minimal" }) do + for _, level in ipairs({ "debug", "warn", "error" }) do + Snacks.notifier.notify( + "- `notifier` says **hello**\n- and *goodbye*", + level, + { style = style, timeout = 10000, title = "Snacks" } + ) + end +end diff --git a/.config/nvim/lua/kamu/keymaps.lua b/.config/nvim/lua/kamu/keymaps.lua index 68202ca..145ad1d 100644 --- a/.config/nvim/lua/kamu/keymaps.lua +++ b/.config/nvim/lua/kamu/keymaps.lua @@ -17,6 +17,10 @@ vim.keymap.set("n", "nh", vim.cmd.noh) -- clear highlight on search when pressing -- vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set("n", "x", "source %") +vim.keymap.set("n", "x", ":.lua") +vim.keymap.set("v", "x", ":lua") + -- Highlight when yanking text vim.api.nvim_create_autocmd("TextYankPost", { desc = "Highlight when yanking text", diff --git a/.config/nvim/lua/kamu/options.lua b/.config/nvim/lua/kamu/options.lua index 07bc010..315d6b9 100644 --- a/.config/nvim/lua/kamu/options.lua +++ b/.config/nvim/lua/kamu/options.lua @@ -1,14 +1,14 @@ -in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil +local in_wsl = os.getenv('WSL_DISTRO_NAME') ~= nil -- https://mitchellt.com/2022/05/15/WSL-Neovim-Lua-and-the-Windows-Clipboard.html if in_wsl then vim.g.clipboard = { name = 'wsl clipboard', - copy = { - ["+"] = { "clip.exe" }, - ["*"] = { "clip.exe" } + copy = { + ["+"] = { "clip.exe" }, + ["*"] = { "clip.exe" } }, - paste = { + paste = { ["+"] = { 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))' }, ["*"] = { 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))' } }, cache_enabled = true @@ -65,7 +65,6 @@ local options = { smartcase = true, showtabline = 0, - cursorline = true, background = "dark", termguicolors = true, @@ -83,8 +82,8 @@ local options = { updatetime = 50, showmode = false, - list = true, - listchars = { tab = '┬╗ ', trail = '┬╖', nbsp= 'ΓÉú'}, + -- list = true, + -- listchars = { tab = '┬╗ ', trail = '┬╖', nbsp= 'ΓÉú'}, inccommand = 'split', cursorline = true, diff --git a/.config/nvim/lua/kamu/plugins/completions.lua b/.config/nvim/lua/kamu/plugins/completions.lua index 53cd457..2899ab7 100644 --- a/.config/nvim/lua/kamu/plugins/completions.lua +++ b/.config/nvim/lua/kamu/plugins/completions.lua @@ -1,33 +1,85 @@ +local function check_backspace() + local col = vim.fn.col(".") - 1 + if col == 0 or vim.fn.getline("."):sub(col, col):match("%s") then + return true + else + return false + end +end + +local function T(str) + return vim.api.nvim_replace_termcodes(str, true, true, true) +end + return { - { - 'L3MON4D3/LuaSnip', - dependencies = { - 'saadparwaiz1/cmp_luasnip', - 'rafamadriz/friendly-snippets', - }, - config = function() - require("luasnip.loaders.from_vscode").lazy_load() - end - }, { 'hrsh7th/nvim-cmp', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', - -- 'hrsh7th/cmp-path', - -- 'hrsh7th/cmp-cmdline', - 'L3MON4D3/LuaSnip', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-cmdline', + 'onsails/lspkind.nvim', + { 'L3MON4D3/LuaSnip', build = "make install_jsregexp" }, + 'saadparwaiz1/cmp_luasnip', + 'rafamadriz/friendly-snippets', }, + lazy = false, + priority = 100, config = function() + vim.opt.completeopt = { "menu", "menuone" } + + + local lspkind = require('lspkind') local cmp = require('cmp') + local ls = require("luasnip") + ls.setup({ + history = true, + }) + + ls.filetype_extend("latex", { "tex" }) + + -- require("luasnip.loaders.from_vscode").lazy_load() + require("luasnip.loaders.from_lua").load({ + -- paths = vim.api.nvim_get_runtime_file("lua/kamu/snippets/", true)[1] + paths = "~/.config/nvim/lua/kamu/snippets/", + }) + -- require("luasnip.loaders").edit_snippet_files() + + -- vim.keymap.set({ "i", "s" }, "", function() + -- if ls.expand_or_jumpable() then + -- ls.expand_or_jump() + -- else + -- return "" + -- end + -- end, { expr = true, silent = true }) + -- + -- vim.keymap.set({ "i", "s" }, "", function() + -- if ls.jumpable(-1) then + -- ls.jump(-1) + -- else + -- print("can't go further back") + -- end + -- end, { silent = true }) cmp.setup({ + formatting = { + format = lspkind.cmp_format({ + mode = 'symbol_text', + }), + }, + ellipsis_char = '...', + show_labelDetails = true, snippet = { - -- REQUIRED - you must specify a snippet engine expand = function(args) - require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + -- vim.snippet.expand(args.body) + require('luasnip').lsp_expand(args.body) end, }, + maxwidth = { + menu = 50, + abbr = 50, + }, window = { -- completion = cmp.config.window.bordered(), -- documentation = cmp.config.window.bordered(), @@ -37,14 +89,37 @@ return { [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + -- [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping.confirm({ select = false }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [''] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + vim.fn.feedkeys(T(''), 'n') + elseif ls.expand_or_jumpable() then + ls.expand_or_jump() + elseif not check_backspace() then + cmp.mapping.complete()(core, fallback) + else + vim.cmd(':>') + vim.cmd(':startinsert') + end + end, { "i", "s" }), + [''] = cmp.mapping(function(fallback) + if vim.fn.pumvisible() == 1 then + vim.fn.feedkeys(T(''), 'n') + elseif ls.jumpable(-1) then + ls.jump(-1) + else + vim.cmd(':<') + vim.cmd(':startinsert') + end + end, { "i", "s" }), }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'luasnip' }, - }, { + { name = 'path' }, { name = 'buffer' }, - }) + }), }) -- Set configuration for specific filetype. @@ -63,6 +138,7 @@ return { -- { name = 'buffer' } -- } -- }) + -- -- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). -- cmp.setup.cmdline(':', { diff --git a/.config/nvim/lua/kamu/plugins/lsp.lua b/.config/nvim/lua/kamu/plugins/lsp.lua index c4d110c..8f8c7fb 100644 --- a/.config/nvim/lua/kamu/plugins/lsp.lua +++ b/.config/nvim/lua/kamu/plugins/lsp.lua @@ -1,76 +1,76 @@ return { - { - -- lsp client plugin - "neovim/nvim-lspconfig", -- https://github.com/neovim/nvim-lspconfig - dependencies = { - "williamboman/mason.nvim", -- https://github.com/williamboman/mason.nvim - "williamboman/mason-lspconfig.nvim", -- https://github.com/williamboman/mason-lspconfig.nvim bridges the gab between lspconfig and mason - -- "folke/neodev.nvim", -- https://github.com/folke/neodev.nvim - }, - config = function() - local capabilities = require('cmp_nvim_lsp').default_capabilities() - - require('mason').setup() - require('mason-lspconfig').setup({ - ensure_installed = { - 'lua_ls', + -- lsp client plugin + "neovim/nvim-lspconfig", -- https://github.com/neovim/nvim-lspconfig + dependencies = { + "williamboman/mason.nvim", -- https://github.com/williamboman/mason.nvim + "williamboman/mason-lspconfig.nvim", -- https://github.com/williamboman/mason-lspconfig.nvim bridges the gab between lspconfig and mason + { + "folke/lazydev.nvim", -- https://github.com/folke/lazydev.nvim + ft = "lua", + opts = { + library = { + { path = "${3rd}/luv/library", words = { "vim%.uv" } }, }, - handlers = { - -- set up all installed servers automatically - function(server_name) - require("lspconfig")[server_name].setup({ - -- print(server_name), - capabilities = capabilities - }) - end, - - ["ansiblels"] = function() - require("lspconfig")['ansiblels'].setup({ - filetypes = { - "yaml", - }, - -- settings = { - -- }, - }) - end, - } - }) - - -- require("neodev").setup({}) - - vim.api.nvim_create_autocmd('LspAttach', { - group = vim.api.nvim_create_augroup('KamuLspConfig', {}), - callback = function(ev) - local opts = { buffer = ev.buf } - vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) - vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) - vim.keymap.set("n", "ca", function() vim.lsp.buf.code_action() end, opts) - vim.keymap.set('n', 'f', function() - vim.lsp.buf.format { async = true } - end, opts) - - vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) - vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) - vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) - vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) - vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) - vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) - vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) - end, - }) - end + }, + }, }, - { - "nvimtools/none-ls.nvim", - config = function() - local null_ls = require("null-ls") + config = function() + local capabilities = require('cmp_nvim_lsp').default_capabilities() - null_ls.setup({ - sources = { - null_ls.builtins.formatting.black, - null_ls.builtins.formatting.isort, - } - }) - end - } + require('mason').setup() + require('mason-lspconfig').setup({ + ensure_installed = { + 'lua_ls', + }, + handlers = { + function(server_name) + require("lspconfig")[server_name].setup({ + capabilities = capabilities + }) + end, + + ["ansiblels"] = function() + require("lspconfig")['ansiblels'].setup({ + filetypes = { + "yaml", + }, + }) + end, + } + }) + + vim.api.nvim_create_autocmd('LspAttach', { + -- group = vim.api.nvim_create_augroup('KamuLspConfig', {}), + callback = function(ev) + local opts = { buffer = ev.buf } + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if not client then return end + + vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts) + vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts) + vim.keymap.set("n", "ca", function() vim.lsp.buf.code_action() end, opts) + vim.keymap.set('n', 'f', function() + vim.lsp.buf.format { async = true } + end, opts) + + vim.keymap.set("n", "vws", function() vim.lsp.buf.workspace_symbol() end, opts) + vim.keymap.set("n", "vd", function() vim.diagnostic.open_float() end, opts) + vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts) + vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts) + vim.keymap.set("n", "vrr", function() vim.lsp.buf.references() end, opts) + vim.keymap.set("n", "vrn", function() vim.lsp.buf.rename() end, opts) + vim.keymap.set("i", "", function() vim.lsp.buf.signature_help() end, opts) + + -- Format on save + if client.supports_method('textDocument/formatting') and vim.bo.filetype == "lua" then + vim.api.nvim_create_autocmd('BufWritePre', { + buffer = ev.buf, + callback = function() + vim.lsp.buf.format({ bufnr = ev.buf, id = client.id }) + end, + }) + end + end, + }) + end } diff --git a/.config/nvim/lua/kamu/plugins/lualine.lua b/.config/nvim/lua/kamu/plugins/lualine.lua index 487f724..d6f6124 100644 --- a/.config/nvim/lua/kamu/plugins/lualine.lua +++ b/.config/nvim/lua/kamu/plugins/lualine.lua @@ -65,7 +65,7 @@ end return { 'nvim-lualine/lualine.nvim', - dependencies = { + dependencies = { 'kyazdani42/nvim-web-devicons', 'folke/noice.nvim', }, @@ -75,8 +75,8 @@ return { theme = 'catppuccin', --fmt = string.lower, icons_enabled = true, - component_separators = { left = '', right = ''}, - section_separators = { left = '', right = ''}, + component_separators = { left = '', right = '' }, + section_separators = { left = '', right = '' }, disabled_filetypes = { statusline = {}, winbar = {}, @@ -104,7 +104,7 @@ return { { 'branch', color = { fg = "#FFF" }, - icon = { 'εéá', color = function() return { fg = getModeColor('a', 'bg') } end }, + icon = { '', color = function() return { fg = getModeColor('a', 'bg') } end }, }, { 'diff', @@ -138,13 +138,13 @@ return { } }, lualine_x = { -- print recording messages - { - require("noice").api.statusline.mode.get, - cond = function() - return require("noice").api.statusline.mode.has() and string.match(require("noice").api.statusline.mode.get(), '^recording @.$') ~= nil - end, - color = { fg = "#ff9e64" }, - }, + -- { + -- require("noice").api.statusline.mode.get, + -- cond = function() + -- return require("noice").api.statusline.mode.has() and string.match(require("noice").api.statusline.mode.get(), '^recording @.$') ~= nil + -- end, + -- color = { fg = "#ff9e64" }, + -- }, 'encoding', 'fileformat', 'filetype' }, lualine_y = { { diff --git a/.config/nvim/lua/kamu/plugins/noice.lua b/.config/nvim/lua/kamu/plugins/noice.lua deleted file mode 100644 index 006f29c..0000000 --- a/.config/nvim/lua/kamu/plugins/noice.lua +++ /dev/null @@ -1,26 +0,0 @@ -return { - "folke/noice.nvim", - event = "VeryLazy", - opts = { - }, - dependencies = { - "rcarriga/nvim-notify", - "MunifTanjim/nui.nvim", - }, - config = function(_, opts) - require("noice").setup(opts) - - require("notify").setup({ - background_colour = "#000000", - level = 2, - minimum_width = 50, - render = "compact", - time_formats = { - notification = "%T", - notification_history = "%FT%T" - }, - timeout = 5000, - top_down = true - }) - end, -} \ No newline at end of file diff --git a/.config/nvim/lua/kamu/plugins/snacks.lua b/.config/nvim/lua/kamu/plugins/snacks.lua new file mode 100644 index 0000000..67dd535 --- /dev/null +++ b/.config/nvim/lua/kamu/plugins/snacks.lua @@ -0,0 +1,66 @@ +return { + "folke/snacks.nvim", + priority = 1000, + lazy = false, + keys = { + { "sh", "lua Snacks.notifier.show_history()", mode = "n", desc = "Show the notification History" } + }, + opts = { + bigfile = { enabled = true }, + notifier = { + enabled = true, + { + timeout = 3000, -- default timeout in ms + width = { min = 40, max = 0.4 }, + height = { min = 1, max = 0.6 }, + margin = { top = 0, right = 1, bottom = 0 }, + padding = true, -- add 1 cell of left/right padding to the notification window + sort = { "level", "added" }, -- sort by level and time + level = vim.log.levels.TRACE, + icons = { + error = " ", + warn = " ", + info = " ", + debug = " ", + trace = " ", + }, + keep = function(notif) + return vim.fn.getcmdpos() > 0 + end, + style = "compact", + top_down = true, -- place notifications from top to bottom + date_format = "%R", -- time format for notifications + more_format = " ↓ %d lines ", + refresh = 50, -- refresh at most every 50ms + } + }, + quickfile = { enabled = true }, + statuscolumn = { enabled = true }, + words = { enabled = true }, + }, + init = function() + vim.api.nvim_create_autocmd("User", { + pattern = "VeryLazy", + callback = function() + _G.dd = function(...) + Snacks.debug.inspect(...) + end + _G.bt = function() + Snacks.debug.backtrace() + end + vim.print = _G.dd -- Override print to use snacks for `:=` command + + Snacks.toggle.option("spell", { name = "Spelling" }):map("us") + Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") + Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") + Snacks.toggle.diagnostics():map("ud") + Snacks.toggle.line_number():map("ul") + Snacks.toggle.option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }):map( + "uc") + Snacks.toggle.treesitter():map("uT") + Snacks.toggle.option("background", { off = "light", on = "dark", name = "Dark Background" }):map("ub") + Snacks.toggle.inlay_hints():map("uh") + end, + }) + end, +} diff --git a/.config/nvim/lua/kamu/plugins/telescope.lua b/.config/nvim/lua/kamu/plugins/telescope.lua index 6460499..d3e10ba 100644 --- a/.config/nvim/lua/kamu/plugins/telescope.lua +++ b/.config/nvim/lua/kamu/plugins/telescope.lua @@ -1,17 +1,39 @@ return { - "nvim-telescope/telescope.nvim", - tag = '0.1.3', - dependencies = {'nvim-lua/plenary.nvim'}, + "nvim-telescope/telescope.nvim", + tag = '0.1.8', + dependencies = { + 'nvim-lua/plenary.nvim', + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + }, config = function() - require("telescope").setup() + require("telescope").setup({ + pickers = { + find_files = { + theme = "ivy", + }, + }, + extensions = { + fzf = {}, + } + }) + + require('telescope').load_extension('fzf') + local builtin = require('telescope.builtin') - vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'ff', builtin.find_files) + vim.keymap.set('n', 'fn', function() builtin.find_files { cwd = vim.fn.stdpath("config") } end) + vim.keymap.set('n', 'fr', function() + builtin.live_grep { + cwd = "~/reports", + file_ignore_patterns = { "/Makefile$", "%.png$", "%.PNG$" } + } + end) vim.keymap.set('n', 'fg', builtin.live_grep, {}) vim.keymap.set('n', 'fb', builtin.buffers, {}) vim.keymap.set('n', 'fh', builtin.help_tags, {}) vim.keymap.set('n', 'fs', builtin.current_buffer_fuzzy_find, {}) vim.keymap.set('n', 'fo', builtin.lsp_document_symbols, {}) vim.keymap.set('n', 'fi', builtin.lsp_incoming_calls, {}) - vim.keymap.set('n', 'fm', function() builtin.treesitter({default_text=":method:"}) end) + vim.keymap.set('n', 'fm', function() builtin.treesitter({ default_text = ":method:" }) end) end, } diff --git a/.config/nvim/lua/kamu/snippets/plaintex/syss.lua b/.config/nvim/lua/kamu/snippets/plaintex/syss.lua new file mode 100644 index 0000000..9bd60a0 --- /dev/null +++ b/.config/nvim/lua/kamu/snippets/plaintex/syss.lua @@ -0,0 +1,31 @@ +-- require("luasnip.session.snippet_collection").clear_snippets("tex") + +local ls = require("luasnip") +local s = ls.snippet +local i = ls.insert_node +local sn = ls.snippet_node +local t = ls.text_node +local f = ls.function_node +local c = ls.choice_node +local d = ls.dynamic_node +local r = ls.restore_node +local fmt = require("luasnip.extras.fmt").fmt + +local snippets = { + -- s("todo", fmt("\\sytodo[{}]{{ {} }}{}", { c(1, { t("todo"), t("techqa") }), i(2, "techqa"), i(0) })), + s("todo", + fmt("\\sytodo[{}]{{{}}}{}", + { + i(1, "techqa"), + i(2), + i(0) + } + ) + ) +} + +local autosnippets = {} + +ls.add_snippets("tex", snippets) + +return snippets, autosnippets