From 2a62792e2bdda9fb129acdc365c6327cb2f104fb Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Thu, 23 Sep 2021 01:21:54 +0700 Subject: [PATCH] Bunch of changes neovim: add more plugins nushell, xonsh: update startup hook for starship --- home/.config/nu/config.toml | 13 ++++++------- home/.config/nvim/lua/colors/nord.lua | 2 -- home/.config/nvim/lua/mappings.lua | 7 +++++++ home/.config/nvim/lua/modules/editor.lua | 10 ++++++++++ home/.config/nvim/lua/modules/tools.lua | 16 ++++++++++++++++ home/.config/nvim/lua/plugins.lua | 24 ++++++++++++++++++------ home/.config/xonsh/rc.xsh | 2 +- 7 files changed, 58 insertions(+), 16 deletions(-) diff --git a/home/.config/nu/config.toml b/home/.config/nu/config.toml index 6f85737..0a93761 100644 --- a/home/.config/nu/config.toml +++ b/home/.config/nu/config.toml @@ -1,12 +1,11 @@ skip_welcome_message = true startup = [ - "mkdir ~/.cache/nu", - "zoxide init nushell --hook prompt | save ~/.cache/nu/zoxide.nu", - "source ~/.cache/nu/zoxide.nu", - "starship init nu | save ~/.cache/nu/starship.nu", - "source ~/.cache/nu/starship.nu" - ] -prompt = "__zoxide_hook; starship prompt" + "zoxide init nushell --hook prompt | save ~/.local/share/nu/zoxide.nu", + "source ~/.local/share/nu/zoxide.nu", + "starship init nu | save ~/.local/share/nu/starship.nu", + "source ~/.local/share/nu/starship.nu" +] +prompt = "starship_prompt" [line_editor] completion_type = "list" diff --git a/home/.config/nvim/lua/colors/nord.lua b/home/.config/nvim/lua/colors/nord.lua index 28cc337..f34c497 100644 --- a/home/.config/nvim/lua/colors/nord.lua +++ b/home/.config/nvim/lua/colors/nord.lua @@ -1,5 +1,3 @@ --- Credit: https://github.com/shaunsingh/nord.nvim - local M = {} M.colors = { diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index fd157d2..ca1f25d 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -239,6 +239,13 @@ wk.register({ n = {':NnnPicker %:p:h', 'File picker'}, + r = { + name = 'REST', + c = {'RestNvim', 'Run request under cursor'}, + p = {'RestNvimPreview', 'Preview request cURL command'}, + l = {'RestNvimLast', 'Re-run last request'} + }, + s = { name = 'Find/Replace', o = {':lua require("spectre").open()', 'Open spectre'}, diff --git a/home/.config/nvim/lua/modules/editor.lua b/home/.config/nvim/lua/modules/editor.lua index 5d3e706..07c599b 100644 --- a/home/.config/nvim/lua/modules/editor.lua +++ b/home/.config/nvim/lua/modules/editor.lua @@ -69,6 +69,16 @@ function M.treesitter_conf() vim.api.nvim_command('set foldmethod=expr') vim.api.nvim_command('set foldexpr=nvim_treesitter#foldexpr()') + -- Additional parser for rest.nvim (*.http files) + local parser_configs = require('nvim-treesitter.parsers').get_parser_configs() + parser_configs.http = { + install_info = { + url = 'https://github.com/NTBBloodbath/tree-sitter-http', + files = { 'src/parser.c' }, + branch = 'main' + } + } + require('nvim-treesitter.configs').setup { ensure_installed = 'maintained', highlight = {enable = true}, diff --git a/home/.config/nvim/lua/modules/tools.lua b/home/.config/nvim/lua/modules/tools.lua index 56cff64..6daf042 100644 --- a/home/.config/nvim/lua/modules/tools.lua +++ b/home/.config/nvim/lua/modules/tools.lua @@ -91,6 +91,22 @@ function M.markdown_preview_conf() -- vim.g.mkdp_echo_preview_url = 1 end +function M.rest_conf() + require('rest-nvim').setup({ + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + -- Jump to request line on run + jump_to_request = false, + }) +end + function M.zenmode_conf() require('zen-mode').setup { window = { diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index e68b71a..dfa6034 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -135,6 +135,11 @@ return require('packer').startup( 'editorconfig/editorconfig-vim', ft = {'go', 'rust', 'python', 'c', 'cpp', 'javascript', 'typescript', 'vim', 'zig'} } + use { -- TODO: move to nvim-parinfer (lua) + 'eraserhd/parinfer-rust', + run = 'cargo build --release', + ft = {'clojure', 'lisp', 'scheme'} + } --------- -- LSP -- @@ -275,10 +280,7 @@ return require('packer').startup( use { 'TimUntersberger/neogit', cmd = 'Neogit', - wants = { - 'diffview.nvim', - 'plenary.nvim' - }, + wants = {'diffview.nvim', 'plenary.nvim'}, requires = { { 'sindrets/diffview.nvim', @@ -372,13 +374,23 @@ return require('packer').startup( run = 'bash ./install.sh 1', cmd = 'SnipRun' } + use { + 'NTBBloodbath/rest.nvim', + keys = {'RestNvim', 'RestNvimPreview', 'RestNvimLast'}, + wants = {'plenary.nvim', 'nvim-treesitter'}, + run = ':TSInstall http', + config = tools.rest_conf + } + -- use { -- TODO: mappings + -- 'rktjmp/hotpot.nvim', + -- config = function() require('hotpot') end + -- } use { 'sbdchd/neoformat', cmd = 'Neoformat' } use {'tweekmonster/startuptime.vim', cmd = 'StartupTime'} -- Just for benchmarking - -- TODO: rest.nvim, parinfer.nvim, conjure, dial.nvim, hotpot.nvim, - -- rust-tools.nvim, crates.nvim, go.nvim + -- TODO: conjure + cmp-conjure, dial.nvim, rust-tools.nvim, crates.nvim, go.nvim end ) diff --git a/home/.config/xonsh/rc.xsh b/home/.config/xonsh/rc.xsh index 1491fb0..9405c7c 100644 --- a/home/.config/xonsh/rc.xsh +++ b/home/.config/xonsh/rc.xsh @@ -1,2 +1,2 @@ execx($(zoxide init xonsh), 'exec', __xonsh__.ctx, filename='zoxide') -execx($(starship init xonsh)) +execx($(starship init xonsh --print-full-init))