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)
This commit is contained in:
FollieHiyuki 2021-10-19 21:04:59 +07:00
parent d483163cda
commit b3d7a24c19
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
7 changed files with 27 additions and 21 deletions

View File

@ -69,12 +69,12 @@ wk.register({
vim.opt.expandtab = false vim.opt.expandtab = false
vim.opt.smarttab = false vim.opt.smarttab = false
vim.opt.softtabstop = 0 -- reset to default 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 else
vim.opt.expandtab = true vim.opt.expandtab = true
vim.opt.smarttab = true vim.opt.smarttab = true
vim.opt.softtabstop = -1 -- fallback to shiftwidth 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
end, end,
'Switch indent style' 'Switch indent style'

View File

@ -1,3 +1,4 @@
-- TODO: eslint language server
local M = {} local M = {}
function M.lsp_conf() function M.lsp_conf()
@ -18,7 +19,7 @@ function M.lsp_conf()
buf_set_keymap('n', '<leader>lx', ':lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap('n', '<leader>lx', ':lua vim.lsp.buf.signature_help()<CR>', opts)
buf_set_keymap('n', '<leader>la', ':lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap('n', '<leader>la', ':lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<leader>lr', ':lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) buf_set_keymap('n', '<leader>lr', ':lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
buf_set_keymap('n', '<leader>lw', ':lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap('n', '<leader>lw', ':lua vim.notify(vim.inspect(vim.lsp.buf.list_workspace_folders()), vim.log.levels.INFO)<CR>', opts)
buf_set_keymap('n', '<leader>ld', ':lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap('n', '<leader>ld', ':lua vim.lsp.buf.type_definition()<CR>', opts)
buf_set_keymap('n', '<leader>ln', ':lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap('n', '<leader>ln', ':lua vim.lsp.buf.rename()<CR>', opts)
buf_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()<CR>', opts) buf_set_keymap('n', 'gr', ':lua vim.lsp.buf.references()<CR>', opts)

View File

@ -7,7 +7,7 @@ local present, packer = pcall(require, 'packer')
if not present then if not present then
local packer_dir = fn.stdpath('data') .. '/site/pack/packer/opt/packer.nvim' 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 -- remove packer_dir before cloning
fn.delete(packer_dir, 'rf') fn.delete(packer_dir, 'rf')
fn.system {'git', 'clone', 'https://github.com/wbthomason/packer.nvim', packer_dir} 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') present, packer = pcall(require, 'packer')
if present then if present then
print('Pakcer cloned successfully.') vim.notify('Pakcer cloned successfully.', vim.log.levels.INFO)
else else
error('Git clone error for packer!') vim.notify('Git clone error for packer!', vim.log.levels.ERROR)
end end
end end

View File

@ -96,11 +96,11 @@ function M.load_options()
-- opt.wrapscan = true -- opt.wrapscan = true
-- Update time -- Update time
opt.timeout = true -- opt.timeout = true
opt.ttimeout = true -- opt.ttimeout = true
opt.timeoutlen = 300 opt.timeoutlen = 500
opt.ttimeoutlen = 10 opt.ttimeoutlen = 25
opt.updatetime = 150 opt.updatetime = 1000 -- how frequently writing to swap file is
opt.redrawtime = 1500 opt.redrawtime = 1500
-- No swapfile -- No swapfile

View File

@ -438,7 +438,7 @@ return packer.startup(function(use)
-- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-bqf, -- TODO: rust-tools.nvim, crates.nvim, go.nvim, clojure-vim/*, nvim-bqf,
-- nvim-comment-frame, nvim-revJ.lua, nvim-remote-containers, tex.nvim, -- 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 -- Install plugins if missing
packer.install() packer.install()

View File

@ -12,19 +12,24 @@ fi
nvim_script_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nvim/scripts nvim_script_dir=${XDG_CONFIG_HOME:-$HOME/.config}/nvim/scripts
if [ "$1" = "-lsp" ]; then 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 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 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 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 else
# Each server should have an unique name # Each server should have an unique name
server_path=$(find "${nvim_script_dir}" -mindepth 2 -type f -name "$1" | head -n 1) server_path=$(find "${nvim_script_dir}" -mindepth 2 -type f -name "$1" | head -n 1)
if [ -z "${server_path}" ]; then if [ -z "${server_path}" ]; then
echo "Incorrect server name." echo "Incorrect server name $1"
exit 1 exit 1
fi fi
printf "\033[1;34mInstalling \033[1;32m%s\033[1;34m...\033[0m\n" "$1"
exec ${server_path} exec ${server_path}
fi fi

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
echo "$(tput bold) printf "
$(tput setaf 1)(\ /) $(tput setaf 2)(\_/) $(tput setaf 3) (\-/) $(tput setaf 4)(\\(\\ $(tput setaf 5)(\\_/) $(tput setaf 6) /)/) \033[1;31m(\ /) \033[1;32m(\_/) \033[1;33m (\-/) \033[1;34m(\\(\\ \033[1;35m(\\_/) \033[1;36m /)/)
$(tput setaf 1)( . .) $(tput setaf 2)(0_0) $(tput setaf 3)(='.'=) $(tput setaf 4)(=':'=) $(tput setaf 5)(>.<) $(tput setaf 6) ( ^.^) \033[1;31m( . .) \033[1;32m(0_0) \033[1;33m(='.'=) \033[1;34m(=':'=) \033[1;35m(>.<) \033[1;36m ( ^.^)
$(tput setaf 1)C(\")(\") $(tput setaf 2)C(\")(\") $(tput setaf 3)(\")-(\")O $(tput setaf 4)(,(\")(\") $(tput setaf 5)(\")_(\") $(tput setaf 6)C(\")(\")$(tput sgr0) \033[1;31mC(\")(\") \033[1;32mC(\")(\") \033[1;33m(\")-(\")O \033[1;34m(,(\")(\") \033[1;35m(\")_(\") \033[1;36mC(\")(\")\033[0m
" "