Merge branch 'trunk' of github.com:bugabinga/dotfiles into trunk
3c79b2a5705595aa0aa6901ebb88fd3f1b738c51
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
- Parent 1: 35ad98826903 · Showing diff
- Parent 2: 25d56e42da22 · Diff against parent 2
bugabingas dorkfiles
3c79b2a5705595aa0aa6901ebb88fd3f1b738c51
Oliver Jan Krylow <oliver@bugabinga.net> ·
unsigned
+658 / −833 text lines
+1 / −0 text lines
+3 / −0 text lines
+1 / −1 text lines
+0 / −37 text lines
local map = require 'std.map'map.normal { description = 'Wrap word under cursor with require call', keys = '<leader>rq', category = 'refactor', -- surround word with ' -- insert `require` -- move 3 words command = "ebi'<esc>ea'<esc>bbirequire <esc>www", buffer = true, remap = true,}--TODO: add dbg.print, require, prequireprequire 'nvim-surround'.buffer_setup { surrounds = { ['R'] = { add = { "require '", "'", }, find = "require%b''", --FIXME: find out how to craft these, those cannot be correct right now delete = "^(require')().-(')()$", change = { target = "^(require')().-('()$", }, }, ['P'] = { add = { 'vim.print(', ')', }, find = 'vim%.print%b()', delete = '^(vim%.print%()().-(%))()$', change = { target = '^(vim%.print%()().-(%))()$', }, }, },}+8 / −0 text lines
+1 / −8 text lines
"mini.bufremove": { "branch": "main", "commit": "931a3bb514147d9e812767275c4beba6b779b1d3" }, "nrpattern.nvim": { "branch": "master", "commit": "f862ce687761078ef3155688151c55f69d28453e" }, "nvim-autopairs": { "branch": "master", "commit": "4f41e5940bc0443fdbe5f995e2a596847215cd2a" }, "nvim-neoclip.lua": { "branch": "main", "commit": "798cd0592a81c185465db3a091a0ff8a21af60fd" }, "nvim-nio": { "branch": "master", "commit": "8765cbc4d0c629c8158a5341e1b4305fd93c3a90" }, "nvim-web-devicons": { "branch": "master", "commit": "794bba734ec95eaff9bb82fbd112473be2087283" }, "overseer.nvim": { "branch": "master", "commit": "89942ad366c8a9bb93f82411de17dc7c644b4e3b" }, "qf_helper.nvim": { "branch": "master", "commit": "301cea47118ccfc91a7cc48e316f2abc1ec7c1c6" }, "resession.nvim": { "branch": "master", "commit": "dc8825439c619030925543a444c4186a2487c200" },+0 / −1 text lines
deleted file mode 100644+0 / −26 text lines
local project = require 'std.project'return { name = 'jsonls', filetypes = { 'json', 'jsonc' }, command = { 'vscode-json-language-server', '--stdio' }, root_dir = project.find_vcs_project_root, single_file_support = true, workspaces = false, init_options = { provideFormatter = true, }, settings = { json = { schemas = require 'schemastore'.json.schemas { extra = { description = 'Settings for lua-language-server', name = 'LuaLS Settings', url = 'https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json', fileMatch = { '.luarc.json', '.luarc.jsonc' }, } }, validate = { enable = true }, }, },}+2 / −2 text lines
+4 / −3 text lines
+7 / −18 text lines
vim.opt.guifont = 'Cousine,Symbols Nerd Font Mono:#e-subpixelantialias:#h-full'-- NOTE: neovide font config is not as powerful as wezterm right now-- characters for box drawing do not seem to line up. try different font for now?vim.opt.linespace = -3vim.opt.guifont = 'Cousine,Symbols Nerd Font Mono:h16:#e-subpixelantialias:#h-none' -- vim.g.neovide_floating_blur_amount_x = 12.0 -- vim.g.neovide_floating_blur_amount_y = 12.0 -- vim.g.neovide_scroll_animation_length = 0.69 -- vim.g.neovide_fullscreen = true vim.g.neovide_remember_window_size = true vim.g.neovide_profiler = false -- vim.g.neovide_cursor_animation_length = 0.42 -- vim.g.neovide_cursor_trail_length = 0.42 vim.g.neovide_cursor_vfx_mode = 'railgun' -- vim.g.neovide_cursor_unfocused_outline_width = 0.125 vim.g.neovide_cursor_antialiasing = true vim.g.neovide_padding_left = 8 vim.g.neovide_padding_left = 0new file mode 100644+27 / −0 text lines
-- FIXME: own thisreturn { 'echasnovski/mini.bufremove', keys = { { '<leader>bd', function () local bd = require 'mini.bufremove' .delete if vim.bo.modified then local choice = vim.fn.confirm( ('Save changes to %q?'):format( vim.fn.bufname() ), '&Yes\n&No\n&Cancel' ) if choice == 1 then -- Yes vim.cmd.write() bd( 0 ) elseif choice == 2 then -- No bd( 0, true ) end else bd( 0 ) end end, desc = 'Delete Buffer', }, -- stylua: ignore { '<leader>bD', function () require 'mini.bufremove' .delete( 0, true ) end, desc = 'Delete Buffer (Force)', }, },}+118 / −119 text lines
'hrsh7th/nvim-cmp', lazy = false, dependencies = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lua', 'saadparwaiz1/cmp_luasnip', 'onsails/lspkind.nvim', 'L3MON4D3/LuaSnip', }, config = function () local cmp = require 'cmp' local luasnip = require 'luasnip' local MAX_INDEX_FILE_SIZE = 4000 'hrsh7th/nvim-cmp', event = 'InsertEnter', dependencies = { 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', 'hrsh7th/cmp-nvim-lua', 'saadparwaiz1/cmp_luasnip', 'onsails/lspkind.nvim', 'L3MON4D3/LuaSnip', }, config = function () local cmp = require 'cmp' local luasnip = require 'luasnip' local MAX_INDEX_FILE_SIZE = 4000 local mapping = cmp.mapping.preset.insert { ['<C-d>'] = cmp.mapping.scroll_docs( -4 ), ['<C-f>'] = cmp.mapping.scroll_docs( 4 ), ['<C-e>'] = cmp.mapping.close(), ['<C-y>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, ['<C-space>'] = cmp.mapping.complete(), ['<Tab>'] = cmp.mapping( snippet_next, { 'i', 's', } ), ['<S-Tab>'] = cmp.mapping( snippet_prev, { 'i', 's', } ), } local mapping = cmp.mapping.preset.insert { ['<C-d>'] = cmp.mapping.scroll_docs( -4 ), ['<C-f>'] = cmp.mapping.scroll_docs( 4 ), ['<C-e>'] = cmp.mapping.close(), ['<C-y>'] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = true, }, ['<C-space>'] = cmp.mapping.complete(), ['<Tab>'] = cmp.mapping( snippet_next, { 'i', 's', } ), ['<S-Tab>'] = cmp.mapping( snippet_prev, { 'i', 's', } ), } local formatting = {} local ok, lspkind = pcall( require, 'lspkind' ) if ok then formatting.format = lspkind.cmp_format { mode = 'symbol', symbol_map = { Copilot = icon.copilot, Class = icon.class, Color = icon.color, Constant = icon.constant, Constructor = icon.constructor, Enum = icon.enum, EnumMember = icon.enum_member, Event = icon.event, Field = icon.field, File = icon.file, Folder = icon.folder, Function = icon['function'], Interface = icon.interface, Keyword = icon.keyword, Method = icon.method, Module = icon.module, Operator = icon.operator, Property = icon.property, Reference = icon.reference, Snippet = icon.snippet, Struct = icon.struct, Text = icon.text, TypeParameter = icon.type_parameter, Unit = icon.unit, Value = icon.value, Variable = icon.variable, }, menu = { buffer = '[buf]', nvim_lsp = '[LSP]', nvim_lua = '[nvim]', path = '[path]', luasnip = '[snip]', }, } end local formatting = {} local ok, lspkind = pcall( require, 'lspkind' ) if ok then formatting.format = lspkind.cmp_format { mode = 'symbol', symbol_map = { Copilot = icon.copilot, Class = icon.class, Color = icon.color, Constant = icon.constant, Constructor = icon.constructor, Enum = icon.enum, EnumMember = icon.enum_member, Event = icon.event, Field = icon.field, File = icon.file, Folder = icon.folder, Function = icon['function'], Interface = icon.interface, Keyword = icon.keyword, Method = icon.method, Module = icon.module, Operator = icon.operator, Property = icon.property, Reference = icon.reference, Snippet = icon.snippet, Struct = icon.struct, Text = icon.text, TypeParameter = icon.type_parameter, Unit = icon.unit, Value = icon.value, Variable = icon.variable, }, menu = { buffer = '[buf]', nvim_lsp = '[LSP]', nvim_lua = '[nvim]', path = '[path]', luasnip = '[snip]', }, } end local sources = { { name = 'neodev', }, { name = 'nvim_lua', }, { name = 'nvim_lsp', }, { name = 'path', }, { name = 'luasnip', }, { name = 'neorg', }, { name = 'buffer', keyword_length = 4, options = { get_bufnrs = function () local bufs = {} for _, bufnr in ipairs( vim.api.nvim_list_bufs() ) do -- Don't index giant files if vim.api.nvim_buf_is_loaded( bufnr ) and vim.api.nvim_buf_line_count( bufnr ) < MAX_INDEX_FILE_SIZE then table.insert( bufs, bufnr ) end end return bufs end, }, }, } local sources = { { name = 'neodev', }, { name = 'nvim_lua', }, { name = 'nvim_lsp', }, { name = 'path', }, { name = 'luasnip', }, { name = 'buffer', keyword_length = 4, options = { get_bufnrs = function () local bufs = {} for _, bufnr in ipairs( vim.api.nvim_list_bufs() ) do -- Don't index giant files if vim.api.nvim_buf_is_loaded( bufnr ) and vim.api.nvim_buf_line_count( bufnr ) < MAX_INDEX_FILE_SIZE then table.insert( bufs, bufnr ) end end return bufs end, }, }, }deleted file mode 100644+0 / −59 text lines
--FIXME: own thisreturn { { 'mfussenegger/nvim-dap', dependencies = { 'rcarriga/nvim-dap-ui', { 'theHamsta/nvim-dap-virtual-text', config = true, }, { 'stevearc/overseer.nvim', }, }, keys = { { '<leader>dc', "<cmd>lua require'dap'.continue()<CR>", mode = 'n', desc = '[D]ebug [C]ontinue', }, { '<leader>dj', "<cmd>lua require'dap'.step_over()<CR>", mode = 'n', desc = '[D]ebug step over', }, { '<leader>di', "<cmd>lua require'dap'.step_into()<CR>", mode = 'n', desc = '[D]ebug step [I]nto', }, { '<leader>do', "<cmd>lua require'dap'.step_out()<CR>", mode = 'n', desc = '[D]ebug step [O]ut', }, { '<leader>dl', "<cmd>lua require'dap'.run_last()<CR>", mode = 'n', desc = '[D]ebug run [L]ast', }, { '<leader>dr', "<cmd>lua require'dap'.repl.open()<CR>", mode = 'n', desc = '[D]ebug open [R]epl', }, { '<leader>dq', "<cmd>lua require'dap'.terminate()<CR>", mode = 'n', desc = '[D]ebug [Q]uit', }, { '<leader>db', "<cmd>lua require'dap'.toggle_breakpoint()<CR>", mode = 'n', desc = '[D]ebug set [B]reakpoint', }, { '<leader>dB', function () vim.ui.input( { prompt = 'Breakpoint condition', }, function ( cond ) if cond then require 'dap' .set_breakpoint( cond ) end end ) end, mode = 'n', desc = '[D]ebug set conditional [B]reakpoint', }, }, config = function () -- dap.set_log_level("DEBUG") vim.fn.sign_define( 'DapBreakpoint', { text = '•', texthl = 'DiagnosticError', linehl = '', numhl = '', } ) vim.fn.sign_define( 'DapBreakpointCondition', { text = '?', texthl = 'DiagnosticError', linehl = '', numhl = '', } ) vim.fn.sign_define( 'DapLogPoint', { text = '⁋', texthl = '', linehl = '', numhl = '', } ) vim.fn.sign_define( 'DapStopped', { text = ' ', texthl = 'DiagnosticInfo', linehl = '', numhl = '', } ) vim.fn.sign_define( 'DapBreakpointRejected', { text = 'X', texthl = 'DiagnosticError', linehl = '', numhl = '', } ) local dapui = require 'dapui' local dap = require 'dap' dapui.setup() dap.listeners.after.event_initialized['dapui_config'] = function () dapui.open() end dap.listeners.before.event_terminated['dapui_config'] = function () dapui.close() end dap.listeners.before.event_exited['dapui_config'] = function () dapui.close() end vim.schedule( function () require 'dap.ext.vscode' .json_decode = require 'overseer.json' .decode require 'dap.ext.vscode' .load_launchjs( nil, { node = { 'typescript', 'javascript', }, } ) require 'overseer' .patch_dap( true ) end ) end, },}+3 / −4 text lines
+73 / −60 text lines
'chrisgrieser/nvim-genghis', cmd = { 'New', 'NewFromSelection', 'Duplicate', 'Rename', 'Move', 'MoveToFolderInCwd', 'Trash', 'CopyFilename', 'CopyFilepath', 'CopyFilepathWithTilde', 'CopyRelativePath', 'CopyDirectoryPath', 'CopyRelativeDirectoryPath', 'Chmodx', }, dependencies = { 'stevearc/dressing.nvim', }, 'chrisgrieser/nvim-genghis', cmd = { 'New', 'NewFromSelection', 'Duplicate', 'Rename', 'Move', 'MoveToFolderInCwd', 'Trash', -- this one does not work on windows, because we cannot configure the trashCmd... 'CopyFilename', 'CopyFilepath', 'CopyFilepathWithTilde', 'CopyRelativePath', 'CopyDirectoryPath', 'CopyRelativeDirectoryPath', 'Chmodx', }, dependencies = { 'stevearc/dressing.nvim', },+2 / −0 text lines
+4 / −0 text lines
deleted file mode 100644+0 / −98 text lines
local map = require 'std.map'local auto = require 'std.auto'local LAST_SESSION = 'last'auto 'automatic_session_management' { { events = 'VimEnter', description = 'Load automatically saved session for the CWD', command = function () -- Only load the session if nvim was started with no args if vim.fn.argc( -1 ) == 0 then -- Save these to a different directory, so our manual sessions don't get polluted prequire 'resession'.load( vim.fn.getcwd(), { dir = 'autosession', silence_errors = true, } ) end end, }, { events = 'VimLeavePre', description = 'Automatically save sessions for the CWD (tab)', command = function () prequire 'resession'.save_tab( vim.fn.getcwd(), { dir = 'autosession', notify = false, } ) end, }, { events = 'VimLeavePre', description = 'Automatically save last session (all tabs)', command = function () prequire 'resession'.save( LAST_SESSION ) end, },}map.normal { description = 'Restore last session', category = 'history', keys = '<leader>sl', command = function () prequire 'resession'.load( LAST_SESSION ) end,}map.normal { description = 'Restore a session', category = 'history', keys = '<leader>sL', command = function () prequire 'resession'.load() end,}map.normal { description = 'Delete session', category = 'history', keys = '<leader>sd', command = function () prequire 'resession'.delete() end,}map.normal { description = 'Save session (tab)', category = 'history', keys = '<leader>ss', command = function () prequire 'resession'.save_tab() end,}map.normal { description = 'Save session (all tabs)', category = 'history', keys = '<leader>sS', command = function () prequire 'resession'.save() end,}return { 'stevearc/resession.nvim', version = '1.*', event = 'VeryLazy', opts = { autosave = { enable = true, }, -- Save and restore these options options = { 'binary', 'bufhidden', 'buflisted', 'cmdheight', 'diff', 'filetype', 'modifiable', 'previewwindow', 'readonly', 'scrollbind', 'winfixheight', 'winfixwidth', 'cursorline', 'virtualedit', 'number', 'spell', }, -- only save buffers that are associated with the cwd of the current tab tab_buf_filter = function ( tabpage, bufnr ) local dir = vim.fn.getcwd( -1, vim.api.nvim_tabpage_get_number( tabpage ) ) -- ensure dir has trailing / dir = dir:sub( -1 ) ~= '/' and dir .. '/' or dir return vim.startswith( vim.api.nvim_buf_get_name( bufnr ), dir ) end, },}+61 / −20 text lines
'kylechui/nvim-surround', event = 'VeryLazy', opts = { keymaps = { insert = '<C-g>ms', insert_line = '<C-g>mS', normal = 'ms', normal_cur = 'mss', normal_line = 'mS', normal_cur_line = 'mSS', visual = 'ms', visual_line = 'mS', delete = 'md', change = 'mc', change_line = 'mC', }, }, dependencies = { 'nvim-treesitter/nvim-treesitter', }, 'kylechui/nvim-surround', keys = { '<C-g>ms', '<C-g>mS', 'ms', 'mss', 'mS', 'mSS', 'ms', 'mS', 'md', 'mr', 'mR', }, opts = { -- setting key maps for this plugin is pretty intricate. -- normally I would set them myself, but in this case not... keymaps = { insert = '<C-g>ms', insert_line = '<C-g>mS', normal = 'ms', normal_cur = 'mss', normal_line = 'mS', normal_cur_line = 'mSS', visual = 'ms', visual_line = 'mS', delete = 'md', change = 'mr', change_line = 'mR', }, surrounds = { ['R'] = { add = { "require '", "'", }, find = "require%b''", --FIXME: find out how to craft these, those cannot be correct right now delete = "^(require')().-(')()$", change = { target = "^(require')().-('()$", }, }, ['P'] = { add = { 'vim.print(', ')', }, find = 'vim%.print%b()', delete = '^(vim%.print%()().-(%))()$', change = { target = '^(vim%.print%()().-(%))()$', }, }, }, }, dependencies = { 'nvim-treesitter/nvim-treesitter', },+0 / −1 text lines
deleted file mode 100644+0 / −137 text lines
local debug = require 'std.dbg'local icon = require 'std.icon'local map = require 'std.map'map.normal { description = 'Run all tests', category = 'test', keys = '<leader>7n', command = function () prequire 'neotest'.run.run {} end,}map.normal { description = 'Run all tests', category = 'test', keys = '<leader>7n', command = function () prequire 'neotest'.run.run {} end,}map.normal { description = 'Run tests for current file', category = 'test', keys = '<leader>7t', command = function () prequire 'neotest'.run.run { vim.api.nvim_buf_get_name( 0 ), } end,}map.normal { description = 'Run all test suites', category = 'test', keys = '<leader>7a', command = function () for _, adapter_id in ipairs( require 'neotest'.run.adapters() ) do prequire 'neotest'.run.run { suite = true, adapter = adapter_id, } end end,}map.normal { description = 'Run last test', category = 'test', keys = '<leader>7l', command = function () prequire 'neotest'.run.run_last() end,}map.normal { description = 'Run all tests in debugger', category = 'test', keys = '<leader>7d', command = function () prequire 'neotest'.run.run { strategy = 'dap', } end,}map.normal { description = 'Show test summary', category = 'test', keys = '<leader>7p', command = function () prequire 'neotest'.summary.toggle() end,}map.normal { description = 'Show test output', category = 'test', keys = '<leader>7o', command = function () prequire 'neotest'.output.open { short = true, } end,}-- Investigate:-- * Does neotest have ability to throttle groups of individual test runs?-- * Tangential, but also check out https://github.com/andythigpen/nvim-coveragereturn { 'nvim-neotest/neotest', dependencies = { 'nvim-lua/plenary.nvim', 'nvim-neotest/neotest-plenary', 'nvim-neotest/nvim-nio', 'stevearc/overseer.nvim', }, config = function () local neotest = require 'neotest' if debug.get() then require 'neotest.logging':set_level 'trace' end neotest.setup { adapters = { require 'neotest-plenary', }, discovery = { enabled = false, }, consumers = { overseer = prequire 'neotest.consumers.overseer', }, summary = { mappings = { attach = 'a', expand = 'l', expand_all = 'L', jumpto = 'gf', output = 'o', run = '<C-r>', short = 'p', stop = 'u', }, }, icons = { passed = icon.passed, running = icon.running, failed = icon.failed, unknown = icon.unknown, running_animated = vim.tbl_map( function ( s ) return s .. ' ' end, { icon.progress_0, icon.progress_1, icon.progress_2, icon.progress_3, icon.progress_4, icon.progress_5, icon.progress_6, icon.progress_7, icon.progress_8, icon.progress_9, } ), }, diagnostic = { enabled = true, }, output = { enabled = true, open_on_run = false, }, status = { enabled = true, }, } end,}+2 / −5 text lines
-- FIXME: own this { 'gA', '<cmd>TextCaseOpenTelescope<CR>', mode = { 'n', 'x', }, desc = 'Telescope', }, { 'gA', '<cmd>TextCaseOpenTelescope<CR>', mode = { 'n', 'x', }, desc = 'Change text case', }, -- If you want to use the interactive feature of the `Subs` command right away, text-case.nvim -- has to be loaded on startup. Otherwise, the interactive feature of the `Subs` will only be -- available after the first executing of it or after a keymap of text-case.nvim has been used. lazy = false,+209 / −198 text lines
'nvim-treesitter/nvim-treesitter', -- version = '0.9.*', branch = 'master', -- restoring session throws errors, if this is lazy lazy = false, build = function () require 'nvim-treesitter.install'.update { with_sync = false, } end, dependencies = { 'nvim-treesitter/playground', 'nvim-treesitter/nvim-treesitter-textobjects', 'windwp/nvim-ts-autotag', 'RRethy/nvim-treesitter-endwise', 'nvim-treesitter/nvim-treesitter-context', 'nushell/tree-sitter-nu', }, config = function () local install = require 'nvim-treesitter.install' local configs = require 'nvim-treesitter.configs' 'nvim-treesitter/nvim-treesitter', -- version = '0.9.*', branch = 'master', event = events, init = function ( plugin ) -- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early -- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which -- no longer trigger the **nvim-treesitter** module to be loaded in time. -- Luckily, the only things that those plugins need are the custom queries, which we make available -- during startup. require 'lazy.core.loader'.add_to_rtp( plugin ) require 'nvim-treesitter.query_predicates' end, build = function () require 'nvim-treesitter.install'.update { with_sync = false, } end, dependencies = { 'nvim-treesitter/playground', 'nvim-treesitter/nvim-treesitter-textobjects', 'windwp/nvim-ts-autotag', 'RRethy/nvim-treesitter-endwise', 'nvim-treesitter/nvim-treesitter-context', 'nushell/tree-sitter-nu', }, config = function () local install = require 'nvim-treesitter.install' local configs = require 'nvim-treesitter.configs' ---@diagnostic disable-next-line: missing-fields configs.setup { sync_install = false, ensure_installed = { 'bash', 'c', 'comment', 'diff', 'dot', 'dtd', 'git_config', 'gitattributes', 'gitcommit', 'gitignore', 'ini', 'java', 'just', 'jsonc', 'lua', 'luap', 'luadoc', 'markdown', 'markdown_inline', 'muttrc', 'nasm', 'nix', 'nu', 'passwd', 'pem', 'properties', 'proto', 'printf', 'query', 'regex', 'ssh_config', 'toml', 'udev', 'vim', 'vimdoc', 'xml', 'zig', }, ---@diagnostic disable-next-line: missing-fields configs.setup { sync_install = false, ensure_installed = { 'bash', 'c', 'comment', 'diff', 'dot', 'dtd', 'git_config', 'gitattributes', 'gitcommit', 'gitignore', 'ini', 'java', 'just', 'jsonc', 'lua', 'luap', 'luadoc', 'markdown', 'markdown_inline', 'muttrc', 'nasm', 'nix', 'nu', 'passwd', 'pem', 'properties', 'proto', 'printf', 'query', 'regex', 'ssh_config', 'toml', 'udev', 'vim', 'vimdoc', 'xml', 'zig', }, playground = { enable = true, disable = should_disable, updatetime = 25, persist_queries = false, keybindings = { toggle_query_editor = 'o', toggle_hl_groups = 'i', toggle_injected_languages = 't', toggle_anonymous_nodes = 'a', toggle_language_display = 'I', focus_language = 'f', unfocus_language = 'F', update = 'R', goto_node = '<cr>', show_help = '?', }, }, playground = { enable = true, disable = should_disable, updatetime = 25, persist_queries = false, keybindings = { toggle_query_editor = 'o', toggle_hl_groups = 'i', toggle_injected_languages = 't', toggle_anonymous_nodes = 'a', toggle_language_display = 'I', focus_language = 'f', unfocus_language = 'F', update = 'R', goto_node = '<cr>', show_help = '?', }, }, ['agc'] = { query = '@comment.outer', desc = 'outer comment', }, ['igc'] = { query = '@comment.inner', desc = 'inner comment', }, }, selection_modes = { ['@parameter.outer'] = 'v', ['@function.outer'] = 'v', ['@class.outer'] = '<c-v>', ['@scope'] = 'V', }, include_surroundig_whitespace = true, }, ['agc'] = { query = '@comment.outer', desc = 'outer comment', }, ['igc'] = { query = '@comment.inner', desc = 'inner comment', }, }, selection_modes = { ['@parameter.outer'] = 'v', ['@function.outer'] = 'v', ['@class.outer'] = '<c-v>', ['@scope'] = 'V', }, include_surroundig_whitespace = true, }, lsp_interop = { enable = true, disable = should_disable, border = vim.g.border_style, floating_preview_opts = {}, peek_definition_code = { ['<leader>lpf'] = { query = '@function.outer', desc = 'Peek definition of outer function.', }, ['<leader>lpc'] = { query = '@class.outer', desc = 'Peek definition of outer class.', }, }, }, lsp_interop = { enable = true, disable = should_disable, border = vim.g.border_style, floating_preview_opts = {}, peek_definition_code = { ['<leader>lpf'] = { query = '@function.outer', desc = 'Peek definition of outer function.', }, ['<leader>lpc'] = { query = '@class.outer', desc = 'Peek definition of outer class.', }, }, }, move = { enable = true, disable = should_disable, set_jumps = true, goto_next = { [']f'] = { query = '@call.outer', desc = 'Goto next function call', }, [']m'] = { query = '@fucntion.outer', desc = 'Goto next function definition', }, [']c'] = { query = '@class.outer', desc = 'Goto next class', }, [']o'] = { query = '@conditional.outer', desc = 'Goto next conditional', }, [']p'] = { query = '@parameter.outer', desc = 'Goto next parameter', }, }, goto_previous = { ['[f'] = { query = '@call.outer', desc = 'Goto previous function call', }, ['[m'] = { query = '@function.outer', desc = 'Goto previous function definition', }, ['[c'] = { query = '@class.outer', desc = 'goto previous class', }, ['[o'] = { query = '@conditional.outer', desc = 'Goto previous conditional', }, ['[p'] = { query = '@parameter.outer', desc = 'Goto previous parameter', }, }, }, }, } require 'treesitter-context'.setup { enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. line_numbers = true, multiline_threshold = 20, -- Maximum number of lines to show for a single context trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' -- Separator between context and content. Should be a single character string, like '-'. -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. separator = nil, zindex = 20, -- The Z-index of the context window on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching } end, move = { enable = true, disable = should_disable, set_jumps = true, goto_next = { [']f'] = { query = '@call.outer', desc = 'Goto next function call', }, [']m'] = { query = '@fucntion.outer', desc = 'Goto next function definition', }, [']c'] = { query = '@class.outer', desc = 'Goto next class', }, [']o'] = { query = '@conditional.outer', desc = 'Goto next conditional', }, [']p'] = { query = '@parameter.outer', desc = 'Goto next parameter', }, }, goto_previous = { ['[f'] = { query = '@call.outer', desc = 'Goto previous function call', }, ['[m'] = { query = '@function.outer', desc = 'Goto previous function definition', }, ['[c'] = { query = '@class.outer', desc = 'goto previous class', }, ['[o'] = { query = '@conditional.outer', desc = 'Goto previous conditional', }, ['[p'] = { query = '@parameter.outer', desc = 'Goto previous parameter', }, }, }, }, } require 'treesitter-context'.setup { enable = true, -- Enable this plugin (Can be enabled/disabled later via commands) max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit. min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit. line_numbers = true, multiline_threshold = 20, -- Maximum number of lines to show for a single context trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer' mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline' -- Separator between context and content. Should be a single character string, like '-'. -- When separator is set, the context will only show up when there are at least 2 lines above cursorline. separator = nil, zindex = 20, -- The Z-index of the context window on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching } end,+1 / −0 text lines
b = { name = '|b|uffer', _ = 'which_key_ignore', },new file mode 100644+100 / −0 text lines
local map = require 'std.map'local auto = require 'std.auto'local sessions = vim.fs.normalize( vim.fn.stdpath 'data' .. '/sessions' )-- FIXME: this needs to live somewhere in stdlocal file_exists = function ( path ) local stat = vim.uv.fs_stat( path ) ---@diagnostic disable-next-line: undefined-field return stat ~= nil and stat.type ~= nilendlocal encode = function ( data ) vim.validate { data = { data, 'string', }, } -- replace some chars in base64, that are not allowed in file names. return vim.base64.encode( data ):gsub( '%+', '-' ):gsub( '%/', '.' ):gsub( '%=', '_' )endlocal decode = function ( data ) vim.validate { data = { data, 'string', }, } return vim.base64.decode( data:gsub( '%-', '+' ):gsub( '%.', '/' ):gsub( '%_', '=' ) )endlocal to_session_path = function ( path ) local encoded = sessions .. '/' .. encode( path ) local session_save_path = vim.fs.normalize( encoded ) return session_save_pathendlocal save_session_for_cwd = function () local cwd = vim.uv.cwd() local session_save_path = to_session_path( cwd ) vim.cmd.mksession { session_save_path, bang = true, }endlocal load_session = function ( session ) local session_path = vim.fs.normalize( sessions .. '/' .. session ) if file_exists( session_path ) then vim.cmd.source { session_path, } else vim.notify( 'No session `' .. session .. '` found!' ) endendlocal load_current_session = function ()endlocal load_any_session = function () local all_sessions = {} for session, type in vim.fs.dir( sessions ) do if type == 'file' then table.insert( all_sessions, session ) end end table.sort( all_sessions, function ( a, b ) a = vim.fs.normalize( sessions .. '/' .. a ) b = vim.fs.normalize( sessions .. '/' .. b ) return vim.uv.fs_stat( a ).mtime.sec > vim.uv.fs_stat( b ).mtime.sec end ) vim.ui.select( all_sessions, { prompt = 'Select a session to load: ', format_item = function ( encoded_session_path ) local session_name = vim.fs.basename( encoded_session_path ) session_name = decode( session_name ) session_name = vim.fn.fnamemodify( session_name, ':~' ) return ' ' .. session_name end, }, function ( session ) if session then load_session( session ) end end )endmap.normal { description = 'Load for cwd, if available.', category = 'session', keys = '<F4>', command = load_current_session,}map.normal { description = 'Load any.', category = 'session', keys = '<F4><F4>', command = load_any_session,}auto 'save_session_on_exit' { description = 'Save current session for cwd, when leaving vim', events = 'VimLeavePre', command = save_session_for_cwd,}+23 / −3 text lines
local open_term_cmd = string.format( 'split term://%s//%s', cwd, shell ) -- paths in term names seem to be relative to home local relative_cwd = vim.fn.fnamemodify( cwd, ':~' ) local term_name = string.format( 'term://%s//%s', relative_cwd, shell ) local buffers = vim.api.nvim_list_bufs() local existing_term = vim.iter( buffers ):map( function ( buffer_number ) return { buffer_number, vim.api.nvim_buf_get_name( buffer_number ), } end ):filter( function ( buffer ) return string.find( buffer[2], relative_cwd, 1, true ) end ):next() if existing_term then term_name = existing_term[2] end local open_term_cmd = string.format( 'split %s', term_name )+4 / −0 text lines
+0 / −9 text lines
if $env.WIN32 { # TODO: insert scoop cargo path here # $env.CARGO_HOME = ( '~/.cargo' | path expand ) $env.Path = ( $env.Path | prepend '' )} else { $env.CARGO_HOME = ( '~/.cargo' | path expand ) $env.PATH = ( $env.PATH | prepend ( $env.CARGO_HOME | path join 'bin') ) $env.PATH = ( $env.PATH | prepend ( '~/.local/bin'| path expand ) )}+4 / −24 text lines