From b3d7a24c1975fe052cdf3be6c85d508de05e221f Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Tue, 19 Oct 2021 21:04:59 +0700 Subject: [PATCH] Another neovim + chore neovim: - increase timoutlen, ttimeoutlen coz I'm slow - print -> vim.notify chore: use ANSI escape code for 'bunny' script instead of tput (from ncurses) --- home/.config/nvim/lua/mappings.lua | 4 ++-- home/.config/nvim/lua/modules/lsp.lua | 3 ++- home/.config/nvim/lua/modules/pack.lua | 6 +++--- home/.config/nvim/lua/options.lua | 10 +++++----- home/.config/nvim/lua/plugins.lua | 2 +- home/.config/nvim/scripts/install | 15 ++++++++++----- home/.local/bin/bunny | 8 ++++---- 7 files changed, 27 insertions(+), 21 deletions(-) diff --git a/home/.config/nvim/lua/mappings.lua b/home/.config/nvim/lua/mappings.lua index a3362af..7f718f7 100644 --- a/home/.config/nvim/lua/mappings.lua +++ b/home/.config/nvim/lua/mappings.lua @@ -69,12 +69,12 @@ wk.register({ vim.opt.expandtab = false vim.opt.smarttab = false vim.opt.softtabstop = 0 -- reset to default - print('Switched to indent with tabs') + vim.notify('Switched to indent with tabs', vim.log.levels.INFO) else vim.opt.expandtab = true vim.opt.smarttab = true vim.opt.softtabstop = -1 -- fallback to shiftwidth - print('Switched to indent with spaces') + vim.notify('Switched to indent with spaces', vim.log.levels.INFO) end end, 'Switch indent style' diff --git a/home/.config/nvim/lua/modules/lsp.lua b/home/.config/nvim/lua/modules/lsp.lua index 13f156e..d360ad3 100644 --- a/home/.config/nvim/lua/modules/lsp.lua +++ b/home/.config/nvim/lua/modules/lsp.lua @@ -1,3 +1,4 @@ +-- TODO: eslint language server local M = {} function M.lsp_conf() @@ -18,7 +19,7 @@ function M.lsp_conf() buf_set_keymap('n', 'lx', ':lua vim.lsp.buf.signature_help()', opts) buf_set_keymap('n', 'la', ':lua vim.lsp.buf.add_workspace_folder()', opts) buf_set_keymap('n', 'lr', ':lua vim.lsp.buf.remove_workspace_folder()', opts) - buf_set_keymap('n', 'lw', ':lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) + buf_set_keymap('n', 'lw', ':lua vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders()), vim.log.levels.INFO)', opts) buf_set_keymap('n', 'ld', ':lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'ln', ':lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()', opts) diff --git a/home/.config/nvim/lua/modules/pack.lua b/home/.config/nvim/lua/modules/pack.lua index dd1af08..d5aa8ff 100644 --- a/home/.config/nvim/lua/modules/pack.lua +++ b/home/.config/nvim/lua/modules/pack.lua @@ -7,7 +7,7 @@ local present, packer = pcall(require, 'packer') if not present then local packer_dir = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' - print('Cloning packer ...') + vim.notify('Cloning packer ...', vim.log.levels.INFO) -- remove packer_dir before cloning fn.delete(packer_dir, 'rf') fn.system {'git', 'clone', 'https://github.com/wbthomason/packer.nvim', packer_dir} @@ -15,9 +15,9 @@ if not present then present, packer = pcall(require, 'packer') if present then - print('Pakcer cloned successfully.') + vim.notify('Pakcer cloned successfully.', vim.log.levels.INFO) else - error('Git clone error for packer!') + vim.notify('Git clone error for packer!', vim.log.levels.ERROR) end end diff --git a/home/.config/nvim/lua/options.lua b/home/.config/nvim/lua/options.lua index 71f463f..2eaf4ac 100644 --- a/home/.config/nvim/lua/options.lua +++ b/home/.config/nvim/lua/options.lua @@ -96,11 +96,11 @@ function M.load_options() -- opt.wrapscan = true -- Update time - opt.timeout = true - opt.ttimeout = true - opt.timeoutlen = 300 - opt.ttimeoutlen = 10 - opt.updatetime = 150 + -- opt.timeout = true + -- opt.ttimeout = true + opt.timeoutlen = 500 + opt.ttimeoutlen = 25 + opt.updatetime = 1000 -- how frequently writing to swap file is opt.redrawtime = 1500 -- No swapfile diff --git a/home/.config/nvim/lua/plugins.lua b/home/.config/nvim/lua/plugins.lua index cda36fa..48efac2 100644 --- a/home/.config/nvim/lua/plugins.lua +++ b/home/.config/nvim/lua/plugins.lua @@ -438,7 +438,7 @@ return packer.startup(function(use) -- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-bqf, -- nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, tex.nvim, - -- telescope-lsp-handlers.nvim, telescope-dap.nvim + -- telescope-lsp-handlers.nvim, telescope-dap.nvim, fcitx.nvim -- Install plugins if missing packer.install() diff --git a/home/.config/nvim/scripts/install b/home/.config/nvim/scripts/install index 361593a..1002741 100755 --- a/home/.config/nvim/scripts/install +++ b/home/.config/nvim/scripts/install @@ -12,19 +12,24 @@ fi nvim_script_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nvim/scripts if [ "$1" = "-lsp" ]; then - find "${nvim_script_dir}/lsp" -type f -exec '{}' \; + printf "\033[1;33mInstalling lsp servers...\033[0m\n" + find "${nvim_script_dir}/lsp" -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \; elif [ "$1" = '-dap' ]; then - find "${nvim_script_dir}/dap" -type f -exec '{}' \; + printf "\033[1;33mInstalling dap servers...\033[0m\n" + find "${nvim_script_dir}/dap" -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \; elif [ "$1" = '-lint' ]; then - find "${nvim_script_dir}/lint" -type f -exec '{}' \; + printf "\033[1;33mInstalling linters and formatters...\033[0m\n" + find "${nvim_script_dir}/lint" -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \; elif [ "$1" = '-all' ]; then - find "${nvim_script_dir}" -mindepth 2 -type f -exec '{}' \; + printf "\033[1;33mInstalling everything...\033[0m\n" + find "${nvim_script_dir}" -mindepth 2 -type f -exec printf "\033[1;34mRunning \033[1;32m%s\033[1;34m...\033[0m\n" '{}' \; -and -exec '{}' \; else # Each server should have an unique name server_path=$(find "${nvim_script_dir}" -mindepth 2 -type f -name "$1" | head -n 1) if [ -z "${server_path}" ]; then - echo "Incorrect server name." + echo "Incorrect server name $1" exit 1 fi + printf "\033[1;34mInstalling \033[1;32m%s\033[1;34m...\033[0m\n" "$1" exec ${server_path} fi diff --git a/home/.local/bin/bunny b/home/.local/bin/bunny index 066f449..797a099 100755 --- a/home/.local/bin/bunny +++ b/home/.local/bin/bunny @@ -1,7 +1,7 @@ #!/bin/sh -echo "$(tput bold) - $(tput setaf 1)(\ /) $(tput setaf 2)(\_/) $(tput setaf 3) (\-/) $(tput setaf 4)(\\(\\ $(tput setaf 5)(\\_/) $(tput setaf 6) /)/) - $(tput setaf 1)( . .) $(tput setaf 2)(0_0) $(tput setaf 3)(='.'=) $(tput setaf 4)(=':'=) $(tput setaf 5)(>.<) $(tput setaf 6) ( ^.^) - $(tput setaf 1)C(\")(\") $(tput setaf 2)C(\")(\") $(tput setaf 3)(\")-(\")O $(tput setaf 4)(,(\")(\") $(tput setaf 5)(\")_(\") $(tput setaf 6)C(\")(\")$(tput sgr0) +printf " + \033[1;31m(\ /) \033[1;32m(\_/) \033[1;33m (\-/) \033[1;34m(\\(\\ \033[1;35m(\\_/) \033[1;36m /)/) + \033[1;31m( . .) \033[1;32m(0_0) \033[1;33m(='.'=) \033[1;34m(=':'=) \033[1;35m(>.<) \033[1;36m ( ^.^) + \033[1;31mC(\")(\") \033[1;32mC(\")(\") \033[1;33m(\")-(\")O \033[1;34m(,(\")(\") \033[1;35m(\")_(\") \033[1;36mC(\")(\")\033[0m "