From 70d7fa533adc4ac0e8e873ff353587b20c536f63 Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Wed, 2 Nov 2022 20:10:32 +0100 Subject: [PATCH] update a bunch of nvim stuff --- .config/fish/conf.d/00-env.fish | 2 +- .config/nvim/init.lua | 1 + .config/nvim/lua/pipe.lua | 27 +++++++++++++++++++++++++ .config/nvim/lua/pluginconf/lspconf.lua | 4 ++++ justfile | 1 + 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/lua/pipe.lua diff --git a/.config/fish/conf.d/00-env.fish b/.config/fish/conf.d/00-env.fish index 6da9e60..7bb862d 100644 --- a/.config/fish/conf.d/00-env.fish +++ b/.config/fish/conf.d/00-env.fish @@ -11,5 +11,5 @@ export CXX=clang++ export EDITOR=nvim # paths -export PATH="$HOME/.cargo/bin:$HOME/.local/bin:$HOME/go/bin:$PATH" +export PATH="$HOME/.mix/escripts:$HOME/.cargo/bin:$HOME/.local/bin:$HOME/go/bin:$PATH" export LUA_CPATH="$HOME/.local/lib/lua/?.so;$HOME/.local/lib/lua/?.lua;;" diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index d80d075..3324caf 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -4,3 +4,4 @@ require "plugins" require "settings" require "maps" require "neovide" +require "pipe" diff --git a/.config/nvim/lua/pipe.lua b/.config/nvim/lua/pipe.lua new file mode 100644 index 0000000..81c1ba3 --- /dev/null +++ b/.config/nvim/lua/pipe.lua @@ -0,0 +1,27 @@ +-- https://gist.github.com/ii14/c5d6c39c1bc7b8553afe76db3350c043 +-- :! replacement that supports char-wise selection +-- from visual mode :Pipe +vim.api.nvim_create_user_command('Pipe', function(ctx) + local ms = vim.api.nvim_buf_get_mark(0, '<') + local me = vim.api.nvim_buf_get_mark(0, '>') + local mt = vim.fn.visualmode() + if mt == '\22' then + error 'blockwise selection not supported' + end + + local lines = vim.api.nvim_buf_get_lines(0, ms[1] - 1, me[1], true) + local input = vim.deepcopy(lines) + if mt == 'v' then + input[#input] = input[#input]:sub(1, me[2] + 1) + input[1] = input[1]:sub(ms[2] + 1) + end + local output = vim.fn.systemlist(ctx.args, input) + if #output == 0 then + output = {''} + end + if mt == 'v' then + output[#output] = output[#output] .. lines[#lines]:sub(me[2] + 2) + output[1] = lines[#lines]:sub(1, ms[2]) .. output[1] + end + vim.api.nvim_buf_set_lines(0, ms[1] - 1, me[1], true, output) +end, { range = true, nargs = '+', complete = 'shellcmd' }) diff --git a/.config/nvim/lua/pluginconf/lspconf.lua b/.config/nvim/lua/pluginconf/lspconf.lua index a883790..f8aeba4 100644 --- a/.config/nvim/lua/pluginconf/lspconf.lua +++ b/.config/nvim/lua/pluginconf/lspconf.lua @@ -12,6 +12,10 @@ table.insert(lua_runtime_path, "lua/?/init.lua") lspc.clangd.setup { capabilities = caps } lspc.cssls.setup { capabilities = caps } +lspc.elixirls.setup { + capabilities = caps, + cmd = { "elixir-ls" }, +} lspc.eslint.setup { capabilities = caps } lspc.haxe_language_server.setup { capabilities = caps } lspc.html.setup { capabilities = caps } diff --git a/justfile b/justfile index 0a914d6..d44e957 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,5 @@ lsps := " +elixir-ls-git eslint lua-language-server rust-analyzer