summaryrefslogtreecommitdiff
path: root/dot_config/nvim/lua/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config/nvim/lua/plugins')
-rw-r--r--dot_config/nvim/lua/plugins/conjure.lua17
-rw-r--r--dot_config/nvim/lua/plugins/leap.lua13
-rw-r--r--dot_config/nvim/lua/plugins/lualine.lua11
-rw-r--r--dot_config/nvim/lua/plugins/mini.lua1
-rw-r--r--dot_config/nvim/lua/plugins/nvim-lspconfig.lua71
-rw-r--r--dot_config/nvim/lua/plugins/nvim-tree.lua45
-rw-r--r--dot_config/nvim/lua/plugins/readline.lua10
-rw-r--r--dot_config/nvim/lua/plugins/telescope.lua22
8 files changed, 190 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/plugins/conjure.lua b/dot_config/nvim/lua/plugins/conjure.lua
new file mode 100644
index 0000000..f74e862
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/conjure.lua
@@ -0,0 +1,17 @@
+local prefix = '<localleader>e'
+vim.g['conjure#mapping#prefix'] = prefix
+vim.g['conjure#extract#tree_sitter#enabled'] = true
+
+-- 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/leap.lua b/dot_config/nvim/lua/plugins/leap.lua
new file mode 100644
index 0000000..c2a2e70
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/leap.lua
@@ -0,0 +1,13 @@
+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/lualine.lua b/dot_config/nvim/lua/plugins/lualine.lua
new file mode 100644
index 0000000..ccac089
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/lualine.lua
@@ -0,0 +1,11 @@
+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
new file mode 100644
index 0000000..ebf75f3
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/mini.lua
@@ -0,0 +1 @@
+require 'mini.comment'.setup{}
diff --git a/dot_config/nvim/lua/plugins/nvim-lspconfig.lua b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua
new file mode 100644
index 0000000..af45a49
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/nvim-lspconfig.lua
@@ -0,0 +1,71 @@
+---@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
+
+-- mappings
+local wk = require 'which-key'
+---@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')
+ 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 }
+local deno = vim.deepcopy(common)
+local tss = vim.deepcopy(common)
+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('denols', deno)
+enable 'gopls'
+enable 'ltex'
+enable 'sumneko_lua'
+enable('tsserver', tss)
diff --git a/dot_config/nvim/lua/plugins/nvim-tree.lua b/dot_config/nvim/lua/plugins/nvim-tree.lua
new file mode 100644
index 0000000..129721d
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/nvim-tree.lua
@@ -0,0 +1,45 @@
+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
new file mode 100644
index 0000000..66ace95
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/readline.lua
@@ -0,0 +1,10 @@
+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
new file mode 100644
index 0000000..219e80b
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,22 @@
+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' },
+ }
+}