diff options
26 files changed, 267 insertions, 532 deletions
diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 6cc88c5..4f85a38 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -1,7 +1,24 @@ vim.g.mapleader = ' ' vim.g.maplocalleader = ',' -require 'plugins' +-- plugins +if vim.fn.executable 'git' == 0 then + require 'noplugins' +else + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) + end + vim.opt.rtp:prepend(lazypath) + require 'lazy'.setup("plugins", {}) +end -- options local options = { diff --git a/dot_config/nvim/lua/bindings.lua b/dot_config/nvim/lua/bindings.lua index 42c5896..8c6e82e 100644 --- a/dot_config/nvim/lua/bindings.lua +++ b/dot_config/nvim/lua/bindings.lua @@ -1,37 +1,16 @@ ----@diagnostic disable:undefined-global +-- general bindings that aren't specific to a plugin +require 'which-key'.register { + -- diagnostics + ['<leader>'] = { + e = { vim.diagnostic.open_float, 'diag float' }, + q = { vim.diagnostic.setloclist, 'diag locations' }, + }, + ['[d'] = { vim.diagnostic.goto_prev, 'prev diag' }, + [']d'] = { vim.diagnostic.goto_next, 'next diag' }, -local util = require 'util' - -local env = vim.env - --- TODO: write a wrapper for both -if not util.hp 'which-key.nvim' then - -- minimal bindings for a no-plugin environment - local km = vim.keymap.set - km('n', '<leader>sv', function() dofile(env.MYVIMRC) end, { desc = 'source vimrc'}) - km('n', '<leader>s%', '<cmd>source %<cr>', { desc = 'source current file'}) -else - -- general bindings that aren't specific to a plugin - require 'which-key'.register { - -- diagnostics - ['<leader>'] = { - e = { vim.diagnostic.open_float, 'diag float' }, - q = { vim.diagnostic.setloclist, 'diag locations' }, - }, - ['[d'] = { vim.diagnostic.goto_prev, 'prev diag' }, - [']d'] = { vim.diagnostic.goto_next, 'next diag' }, - - -- source - ['<leader>s'] = { - name = '+source', - v = { function() dofile(env.MYVIMRC) end, 'Vimrc' }, - ['%'] = { '<cmd>source %<cr>', 'Current File' }, - }, - - -- document missing builtins - ['g'] = { - t = 'Next tab', - T = 'Previous tab', - }, - } -end + -- document missing builtins + ['g'] = { + t = 'Next tab', + T = 'Previous tab', + }, +} diff --git a/dot_config/nvim/lua/blackhole.lua b/dot_config/nvim/lua/blackhole.lua deleted file mode 100644 index c57c300..0000000 --- a/dot_config/nvim/lua/blackhole.lua +++ /dev/null @@ -1,6 +0,0 @@ --- black hole object --- you can access and call and set things however you want --- it will never do anything - -local f = function (self) return self end -return setmetatable({}, {__call = f, __index = f, __newindex = f}) diff --git a/dot_config/nvim/lua/ipacker.lua b/dot_config/nvim/lua/ipacker.lua deleted file mode 100644 index 389e168..0000000 --- a/dot_config/nvim/lua/ipacker.lua +++ /dev/null @@ -1,24 +0,0 @@ --- init packer = ipacker --- returns packer or blackhole --- sets ipacker global to # depending on bootstrap level --- ipacker = - -- 0 = no packer present - -- 1 = bootstrapped just now - -- 2 = already present -local fn = vim.fn -local ipath = fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' -local repo = 'https://github.com/wbthomason/packer.nvim' - -ipacker = 0 -if #fn.findfile('packer.lua', ipath .. '**') == 0 then - if fn.executable 'git' == 0 then - return require 'blackhole' - end - fn.system {'git', 'clone', '--depth', '1', repo, ipath} - vim.cmd [[packloadall!]] - ipacker = 1 -else - ipacker = 2 -end - -return require 'packer' diff --git a/dot_config/nvim/lua/noplugins.lua b/dot_config/nvim/lua/noplugins.lua new file mode 100644 index 0000000..2126a4a --- /dev/null +++ b/dot_config/nvim/lua/noplugins.lua @@ -0,0 +1 @@ +-- TODO diff --git a/dot_config/nvim/lua/plugins.lua b/dot_config/nvim/lua/plugins.lua deleted file mode 100644 index f0bd53c..0000000 --- a/dot_config/nvim/lua/plugins.lua +++ /dev/null @@ -1,107 +0,0 @@ -local packer = require 'ipacker' -local compiled = vim.fn.stdpath 'data' .. '/packer_compiled.lua' - -local function plugn(plug) -- plug name - return plug:gsub([[^.*/([^./]*)%.?.*$]], '%1') -end - -local function plugi(conf) -- plug initialization string - -- you can pass it the plugin spec - if conf:find '/' then conf = plugn(conf) end - return 'plugins.' .. conf -end - -local sust = {} -colors = { - default = 'default', -- in case of no packer - scheme = 'onedark', -- in case of yes packer - lualine = 'onedark', -- per plugin stuff from here on -} -packer.startup({function(iuse) - local tf = require 'transformer' - local use = tf(iuse) - - local sus = tf(function(spec) - table.insert(sust, plugi(spec[1])) - iuse(spec) - end) - local kbd = sus { requires = {'folke/which-key.nvim'} } - - use 'wbthomason/packer.nvim' - use 'Olical/aniseed' - - -- colors - use 'folke/tokyonight.nvim' - use 'olimorris/onedarkpro.nvim' - - -- editor - use { run = function() - require 'nvim-treesitter.install'.update { with_sync = true } - end } - { config = function() require 'nvim-treesitter.configs'.setup { - ensure_installed = 'all', - sync_install = true, - highlight = { - enable = true, - }, - } end } - 'nvim-treesitter/nvim-treesitter' - sus 'neovim/nvim-lspconfig' - kbd 'echasnovski/mini.nvim' - - sus 'linty-org/readline.nvim' - sus 'nvim-lualine/lualine.nvim' - use 'folke/which-key.nvim' - - -- completion, signatures, and snippets - sus 'hrsh7th/nvim-cmp' - use 'hrsh7th/cmp-nvim-lsp' - use 'PaterJason/cmp-conjure' - - use 'hrsh7th/cmp-buffer' - use 'hrsh7th/cmp-cmdline' - use 'hrsh7th/cmp-path' - - use 'dcampos/nvim-snippy' - use 'dcampos/cmp-snippy' - - use 'ray-x/lsp_signature.nvim' - - -- interactive features - use { run = 'make' } 'nvim-telescope/telescope-fzf-native.nvim' - kbd { requires = 'nvim-lua/plenary.nvim' } 'nvim-telescope/telescope.nvim' - kbd 'kyazdani42/nvim-tree.lua' - - kbd 'ggandor/leap.nvim' - kbd 'Olical/conjure' - - -- language features - use { ft = 'janet' } 'janet-lang/janet.vim' - use { ft = {'scm', 'janet', 'clojure', 'fennel' } } - 'gpanders/nvim-parinfer' -end, config = { - compile_path = compiled, -}}) - -local function configure() - vim.cmd(':colo ' .. colors.scheme) - for _, v in ipairs(sust) do require(v) end - require 'which-key'.setup{} - require 'bindings' -end - -if ipacker == 0 then - -- no packer - vim.cmd(':colo ' .. colors.default) -elseif ipacker == 1 then - -- run sync and wait for it before configuring - packer.sync() - vim.api.nvim_create_autocmd({'User PackerComplete'}, { callback = function() - configure() - end }) -else - -- run things normally - if vim.fn.filereadable(compiled) > 0 then dofile(compiled) end - configure() -end - diff --git a/dot_config/nvim/lua/plugins/bindings/init.lua b/dot_config/nvim/lua/plugins/bindings/init.lua new file mode 100644 index 0000000..dea963f --- /dev/null +++ b/dot_config/nvim/lua/plugins/bindings/init.lua @@ -0,0 +1,7 @@ +return { + { + 'folke/which-key.nvim', + lazy = true, + opts = {}, + }, +} diff --git a/dot_config/nvim/lua/plugins/color.lua b/dot_config/nvim/lua/plugins/color.lua new file mode 100644 index 0000000..8d711fc --- /dev/null +++ b/dot_config/nvim/lua/plugins/color.lua @@ -0,0 +1,10 @@ +return { + { + 'olimorris/onedarkpro.nvim', + lazy = false, + priority = 1000, + config = function() + vim.cmd [[:color onedark]] + end, + }, +} diff --git a/dot_config/nvim/lua/plugins/conjure.lua b/dot_config/nvim/lua/plugins/conjure.lua deleted file mode 100644 index 0062b12..0000000 --- a/dot_config/nvim/lua/plugins/conjure.lua +++ /dev/null @@ -1,30 +0,0 @@ ----@diagnostic disable:undefined-global -local prefix = '<localleader>e' -vim.g['conjure#mapping#prefix'] = prefix -vim.g['conjure#extract#tree_sitter#enabled'] = true --- disabling: lua, python, rust -vim.g['conjure#filetypes'] = { - 'clojure', - 'fennel', - 'hy', - 'janet', - 'julia', - 'lisp', - 'racket', - 'scheme', -} -vim.g['conjure#filetype#fennel'] = 'conjure.client.fennel.stdio' - --- TODO: only do this in affected buffers --- how? -local wk = require 'which-key' -wk.register({ - name = '+conjure', - e = { - name = '+eval', - c = { name = '+comment' }, - }, - g = { name = '+get' }, - l = { name = '+log' }, - r = { name = '+reset' }, -}, {prefix = prefix}) diff --git a/dot_config/nvim/lua/plugins/init.lua b/dot_config/nvim/lua/plugins/init.lua new file mode 100644 index 0000000..da7c167 --- /dev/null +++ b/dot_config/nvim/lua/plugins/init.lua @@ -0,0 +1,30 @@ +-- simple stuff that doesn't need any handling +-- and doesn't fit in elsewhere +return { + { 'folke/lazy.nvim', version = false }, + 'Olical/aniseed', + { + 'Olical/conjure', + config = function(_, opts) + for k, v in pairs(opts) do + vim.g['conjure#' .. k] = v + end + end, + opts = { + ['mapping#prefix'] = '<localleader>e', + ['extract#tree_sitter#enabled'] = true, + -- disabling lua, python, rust + filetypes = { + 'clojure', + 'fennel', + 'hy', + 'janet', + 'julia', + 'lisp', + 'racket', + 'scheme', + }, + ['filetype#fennel'] = 'conjure.client.fennel.stdio', + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/langs.lua b/dot_config/nvim/lua/plugins/langs.lua new file mode 100644 index 0000000..e7e1499 --- /dev/null +++ b/dot_config/nvim/lua/plugins/langs.lua @@ -0,0 +1,41 @@ +-- language support +return { + -- treesitter + { + 'nvim-treesitter/nvim-treesitter', + version = false, + lazy = false, + build = ':TSUpdateSync', + -- event = { 'BufReadPost', 'BufNewFile' }, + config = function(_, opts) + require 'nvim-treesitter.configs'.setup(opts) + end, + dependencies = { + 'nvim-treesitter/nvim-treesitter-textobjects', + }, + opts = { + ensure_installed = 'all', + sync_intall = true, + highlight = { + enable = true, + }, + }, + }, + + -- non-treesitter languages + { + 'janet-lang/janet.vim', + ft = 'janet', + }, + + -- helpers for lisps + { + 'gpanders/nvim-parinfer', + ft = { + 'clojure', + 'fennel', + 'janet', + 'scm', + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/leap.lua b/dot_config/nvim/lua/plugins/leap.lua deleted file mode 100644 index c2a2e70..0000000 --- a/dot_config/nvim/lua/plugins/leap.lua +++ /dev/null @@ -1,13 +0,0 @@ -local leap = require 'leap' -leap.set_default_keymaps() - -local api = vim.api -local hl = api.nvim_set_hl -local auto = api.nvim_create_autocmd - -local wk = require 'which-key' -wk.register { - ['g'] = { - s = 'Leap across windows', - }, -} diff --git a/dot_config/nvim/lua/plugins/lsp/attach.lua b/dot_config/nvim/lua/plugins/lsp/attach.lua new file mode 100644 index 0000000..66d5a44 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp/attach.lua @@ -0,0 +1,36 @@ +return function(c, b) + local lsp = vim.lsp + local lbf = lsp.buf + local wk = require 'which-key' + vim.api.nvim_buf_set_option(b, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + wk.register({ + name = '+lsp', + D = {lbf.declaration, 'goto declaration'}, + d = {lbf.definition, 'goto definition'}, + k = {lbf.hover, 'hover'}, + K = {lbf.signature_help, 'signature help'}, + i = {lbf.implementation, 'goto implementation'}, + t = {lbf.type_definition, 'goto type definition'}, + r = {lbf.rename, 'rename'}, + c = {lbf.code_action, 'code action'}, + R = {lbf.references, 'list references'}, + w = { + name = '+workspace', + a = {lbf.add_workspace_folder, 'add folder'}, + r = {lbf.remove_workspace_folder, 'remove folder'}, + l = { + function() print(vim.inspect(lbf.list_workspace_folders())) end, + 'list folders' + }, + }, + }, { + prefix = '<localleader><localleader>', + buffer = b, + }) + wk.register({ + ['<leader>F'] = { + function() vim.lsp.buf.format {async = true} end, + 'run format', + }, + }, { buffer = b }) +end diff --git a/dot_config/nvim/lua/plugins/lsp/capabilities.lua b/dot_config/nvim/lua/plugins/lsp/capabilities.lua new file mode 100644 index 0000000..15e53c4 --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp/capabilities.lua @@ -0,0 +1 @@ +return nil diff --git a/dot_config/nvim/lua/plugins/lsp/init.lua b/dot_config/nvim/lua/plugins/lsp/init.lua new file mode 100644 index 0000000..01fb34a --- /dev/null +++ b/dot_config/nvim/lua/plugins/lsp/init.lua @@ -0,0 +1,41 @@ +local attach = require 'plugins.lsp.attach' +local caps = require 'plugins.lsp.capabilities' + +return { + { + 'neovim/nvim-lspconfig', + config = function(_, opts) + for k, v in pairs(opts) do + v.on_attach = v.on_attach or attach + if type(caps) == 'table' then + v.capabilities = v.capabilities or caps + end + local s = require 'lspconfig'[k] + local c = v.cmd or s.document_config.default_config.cmd + if vim.fn.executable(c[1]) ~= 0 then + s.setup(v) + end + end + end, + opts = function() + local plist = function(...) + local p = require 'lspconfig.util'.root_pattern(...) + return function(f) return p(f) end + end + return { + clojure_lsp = { + root_dir = plist('project.clj', 'deps.edn', 'bb.edn', 'build.boot', 'shadow-cljs.edn', '.git'), + }, + denols = { + root_dir = plist('deno.json', 'deno.jsonc'), + }, + gopls = {}, + ltex = {}, + lua_ls = {}, + tsserver = { + root_dir = plist('tsconfig.json', 'package.json'), + }, + } + end + }, +} diff --git a/dot_config/nvim/lua/plugins/lualine.lua b/dot_config/nvim/lua/plugins/lualine.lua deleted file mode 100644 index ccac089..0000000 --- a/dot_config/nvim/lua/plugins/lualine.lua +++ /dev/null @@ -1,11 +0,0 @@ -require 'lualine'.setup { - theme = colors.lualine, - tabline = { - lualine_a = {'buffers'}, - lualine_b = {}, - lualine_c = {}, - lualine_x = {}, - lualine_y = {}, - lualine_z = {'tabs'} - }, -} diff --git a/dot_config/nvim/lua/plugins/mini.lua b/dot_config/nvim/lua/plugins/mini.lua deleted file mode 100644 index 44c5e2b..0000000 --- a/dot_config/nvim/lua/plugins/mini.lua +++ /dev/null @@ -1,3 +0,0 @@ -require 'mini.align'.setup{} -require 'mini.comment'.setup{} -require 'mini.move'.setup{} diff --git a/dot_config/nvim/lua/plugins/mini/init.lua b/dot_config/nvim/lua/plugins/mini/init.lua new file mode 100644 index 0000000..aba0de0 --- /dev/null +++ b/dot_config/nvim/lua/plugins/mini/init.lua @@ -0,0 +1,30 @@ +return { + { + 'echasnovski/mini.nvim', + version = false, -- beta + config = function(_, opts) + for k, v in pairs(opts) do + require ("mini." .. k).setup(v) + end + end, + opts = { + ai = {}, + align = {}, + animate = {}, + basics = {}, + bracketed = {}, + comment = {}, + completion = {}, + cursorword = {}, + indentscope = {}, + jump2d = {}, + move = {}, + splitjoin = {}, + starter = {}, + statusline = {}, + surround = {}, + tabline = {}, + trailspace = {}, + } + }, +} diff --git a/dot_config/nvim/lua/plugins/neo-tree.lua b/dot_config/nvim/lua/plugins/neo-tree.lua new file mode 100644 index 0000000..5194d99 --- /dev/null +++ b/dot_config/nvim/lua/plugins/neo-tree.lua @@ -0,0 +1,21 @@ +return { + { + 'nvim-neo-tree/neo-tree.nvim', + cmd = 'Neotree', + dependencies = { + 'nvim-lua/plenary.nvim', + 'MunifTanjim/nui.nvim', + }, + keys = { + { + '<leader>n', + function() + require 'neo-tree.command'.execute { toggle = true } + end, + desc = 'Neotree', + }, + }, + opts = { + }, + }, +} diff --git a/dot_config/nvim/lua/plugins/nvim-cmp.lua b/dot_config/nvim/lua/plugins/nvim-cmp.lua deleted file mode 100644 index 197d830..0000000 --- a/dot_config/nvim/lua/plugins/nvim-cmp.lua +++ /dev/null @@ -1,47 +0,0 @@ ----@diagnostic disable:undefined-global - -local cmp = require 'cmp' -local snp = require 'snippy' - -local mappings = require('snippy.mapping') -vim.keymap.set('i', '<Tab>', mappings.expand_or_advance('<Tab>'), - { desc = 'snippy next' }) -vim.keymap.set('s', '<Tab>', mappings.next('<Tab>'), - { desc = 'snippy next' }) -vim.keymap.set({ 'i', 's' }, '<S-Tab>', mappings.previous('<S-Tab>'), - { desc = 'snippy prev' }) -vim.keymap.set('x', '<Tab>', mappings.cut_text, - { remap = true, desc = 'snippy cut' }) -vim.keymap.set('n', 'g<Tab>', mappings.cut_text, - { remap = true, desc = 'snippy cut' }) - -cmp.setup { - mapping = cmp.mapping.preset.insert { - ['<C-b>'] = cmp.mapping.scroll_docs(-4), - ['<C-f>'] = cmp.mapping.scroll_docs(4), - ['<C-Space>'] = cmp.mapping.complete(), - ['<C-e>'] = cmp.mapping.abort(), - ['<CR>'] = cmp.mapping.confirm { select = true }, - }, - snippet = { - expand = function(args) - snp.expand_snippet(args.body) - end, - }, - window = { - }, - sources = cmp.config.sources { - { name = 'nvim_lsp' }, - -- { name = 'conjure' }, - { name = 'snippy' }, - }, -} - -cmp.setup.cmdline(':', { - mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' }, - }, { - { name = 'cmdline' }, - }) -}) diff --git a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua deleted file mode 100644 index bdde781..0000000 --- a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua +++ /dev/null @@ -1,88 +0,0 @@ ----@diagnostic disable: undefined-global - -local lspc = require 'lspconfig' -local lspu = require 'lspconfig.util' - -local function plist(...) - local p = lspu.root_pattern(...) - return function(f) return p(f) end -end - --- completion -local cap = require 'cmp_nvim_lsp'.default_capabilities() - --- mappings -local wk = require 'which-key' - --- signature help -local sg = require 'lsp_signature' -local sgconf = { - zindex = 50, - hint_enable = false, - extra_trigger_chars = {' '}, - toggle_key = '<M-x>', -} - ----@diagnostic disable-next-line: unused-local -local on_attach = function(c, b) - local lsp = vim.lsp - local lbf = lsp.buf - vim.api.nvim_buf_set_option(b, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - sg.on_attach(sgconf, b) - wk.register({ - name = '+lsp', - D = {lbf.declaration, 'goto declaration'}, - d = {lbf.definition, 'goto definition'}, - k = {lbf.hover, 'hover'}, - K = {lbf.signature_help, 'signature help'}, - i = {lbf.implementation, 'goto implementation'}, - t = {lbf.type_definition, 'goto type definition'}, - r = {lbf.rename, 'rename'}, - c = {lbf.code_action, 'code action'}, - R = {lbf.references, 'list references'}, - w = { - name = '+workspace', - a = {lbf.add_workspace_folder, 'add folder'}, - r = {lbf.remove_workspace_folder, 'remove folder'}, - l = { - function() print(vim.inspect(lbf.list_workspace_folders())) end, - 'list folders' - }, - }, - }, { - prefix = '<localleader><localleader>', - buffer = b, - }) - wk.register({ - ['<leader>F'] = { - function() vim.lsp.buf.format {async = true} end, - 'run format', - }, - }, { buffer = b }) -end - --- configs -local common = { on_attach = on_attach, capabilities = cap } -local clojure = vim.deepcopy(common) -local deno = vim.deepcopy(common) -local tss = vim.deepcopy(common) -clojure.root_dir = plist('project.clj', 'deps.edn', 'bb.edn', 'build.boot', 'shadow-cljs.edn', '.git') -deno.root_dir = plist('deno.json', 'deno.jsonc') -tss.root_dir = plist('tsconfig.json', 'package.json') - --- servers -local function enable(name, opts) - opts = opts or common - local s = lspc[name] - local c = opts.cmd or s.document_config.default_config.cmd - if vim.fn.executable(c[1]) ~= 0 then - s.setup(opts) - end -end - -enable('clojure_lsp', clojure) -enable('denols', deno) -enable 'gopls' -enable 'ltex' -enable 'lua_ls' -enable('tsserver', tss) diff --git a/dot_config/nvim/lua/plugins/nvim-tree.lua b/dot_config/nvim/lua/plugins/nvim-tree.lua deleted file mode 100644 index 129721d..0000000 --- a/dot_config/nvim/lua/plugins/nvim-tree.lua +++ /dev/null @@ -1,45 +0,0 @@ -require 'nvim-tree'.setup { - filters = { - dotfiles = true, - }, - git = { - enable = true, - ignore = true, - }, - renderer = { - icons = { - glyphs = { - default = '-', - symlink = '→', - folder = { - arrow_closed = '▶', - arrow_open = '▼', - - default = '📁', - open = '📂', - - symlink = '📁', - symlink_open = '📂', - - empty = '📁', - empty_open = '📂', - }, - git = { - deleted = '-', -- unused - unstaged = '±', - untracked = '+', - unmerged = 'U', - }, - }, - }, - }, -} - -local api = require 'nvim-tree.api' -local wk = require 'which-key' -local km = vim.keymap.set -wk.register { - ['<leader>'] = { - n = { api.tree.toggle, 'nvim-tree' }, - } -} diff --git a/dot_config/nvim/lua/plugins/readline.lua b/dot_config/nvim/lua/plugins/readline.lua deleted file mode 100644 index 66ace95..0000000 --- a/dot_config/nvim/lua/plugins/readline.lua +++ /dev/null @@ -1,10 +0,0 @@ -local readline = require 'readline' -vim.keymap.set('!', '<M-f>', readline.forward_word) -vim.keymap.set('!', '<M-b>', readline.backward_word) -vim.keymap.set('!', '<C-a>', readline.dwim_beginning_of_line) -vim.keymap.set('!', '<C-e>', readline.end_of_line) -vim.keymap.set('!', '<M-d>', readline.kill_word) -vim.keymap.set('!', '<M-BS>', readline.backward_kill_word) -vim.keymap.set('!', '<C-w>', readline.unix_word_rubout) -vim.keymap.set('!', '<C-k>', readline.kill_line) -vim.keymap.set('!', '<C-u>', readline.dwim_backward_kill_line) diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua index 219e80b..8849542 100644 --- a/dot_config/nvim/lua/plugins/telescope.lua +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -1,22 +1,17 @@ -local ts = require 'telescope' - -ts.setup { - -- pickers = {}, - -- extensions = {}, -} - -ts.load_extension 'fzf' - -local tb = require 'telescope.builtin' -local wk = require 'which-key' -wk.register { - ['<leader>f'] = { - name = '+find', - f = { tb.find_files, 'Find File' }, - g = { tb.live_grep, 'Live Grep' }, - b = { tb.buffers, 'Find Buffer' }, - h = { tb.help_tags, 'Find Help' }, - c = { tb.commands, 'Find Command' }, - t = { tb.treesitter, 'Find Treesitter' }, - } +return { + { + 'nvim-telescope/telescope.nvim', + dependencies = { + 'nvim-lua/plenary.nvim', + { + 'nvim-telescope/telescope-fzf-native.nvim', + build = 'make', + }, + }, + config = function(_, opts) + local ts = require 'telescope' + ts.setup(opts) + ts.load_extension 'fzf' + end, + }, } diff --git a/dot_config/nvim/lua/transformer.lua b/dot_config/nvim/lua/transformer.lua deleted file mode 100644 index a479826..0000000 --- a/dot_config/nvim/lua/transformer.lua +++ /dev/null @@ -1,80 +0,0 @@ ---[[ - Transformer.lua - A transforming meta-flow originally built for packer. - - TL;DR you have a function to which you want to eventually pass a table. - With this, you can construct the table piece by piece. - It will finally call out once you pass () or a string. - The string will *prepend* itself to the object. - - Merging rules are a bit complicated: - For tables, we merge the ipairs in order (left to right). - The final '' is an exception. - Then we merge the map-like keys recursively. - If the target is a table but the merged key isn't, we append it. - Otherwise we always overwrite. -]]-- - ----@diagnostic disable-next-line: unused-vararg -local function tables(...) - for i=1,select('#') do - if type(select(i)) ~= 'table' then return false end - end - return true -end - -local function imerge(t1, t2) -- mutates t1 - for _, v in ipairs(t2) do table.insert(t1, v) end -end - -local bigmerge -- forward declaration - -local function kmerge(t1, t2) -- mutates t2 - for k, v in pairs(t2) do - if type(k) == 'number' and k >= 1 and k <= #t1 then - -- skip, we did this in imerge - else - if t1[k] and type(t1[k]) == 'table' then - if type(v) == 'table' then - t1[k] = bigmerge(t1[k], v) - else - table.insert(t1[k], v) - end - else - t1[k] = v - end - end - end -end - -bigmerge = function(t1, t2) - assert(tables(t1, t2)) - local out = {} - imerge(out, t1) - imerge(out, t2) - kmerge(out, t1) - kmerge(out, t2) - return out -end - -local function tgen(use) return function (self, obj) - if obj == nil then return use(self) end - - if type(obj) == 'string' then - local out = { obj } - imerge(out, self) - kmerge(out, self) - return setmetatable(out, getmetatable(self))() - elseif type(obj) == 'table' then - local out = bigmerge(self, obj) - return setmetatable(out, getmetatable(self)) - - else - error 'Invalid argument.' - end - -end end - -return function(use) - return setmetatable({}, { __call = tgen(use) }) -end diff --git a/dot_config/nvim/lua/util.lua b/dot_config/nvim/lua/util.lua deleted file mode 100644 index aa114d8..0000000 --- a/dot_config/nvim/lua/util.lua +++ /dev/null @@ -1,10 +0,0 @@ --- hasplug -local function hp(plug) - return packer_plugins and - packer_plugins[plug] and - packer_plugins[plug].loaded -end - -return { - hp = hp, -} |
