Some user configs

- neovim:
    + update lspkind icons for completion
    + start migrating config for nvim-tree.lua
    + update lsp config for sumneko_lua
- scripts:
    + add POSIX clients for PurritoBin (https://bsd.ac)
    + add script to upload to https://0x0.st
This commit is contained in:
FollieHiyuki 2021-09-29 20:55:01 +07:00
parent 12e151d3e1
commit 9b81f9b07b
No known key found for this signature in database
GPG Key ID: 813CF484F4993419
8 changed files with 87 additions and 33 deletions

View File

@ -34,10 +34,10 @@ function M.cmp_conf()
Folder = '', Folder = '',
EnumMember = '', EnumMember = '',
Constant = '', Constant = '',
Struct = '', Struct = '',
Event = '', Event = '',
Operator = '', Operator = '',
TypeParameter = '' TypeParameter = ''
} }
-- load lspkind icons -- load lspkind icons
vim_item.kind = string.format('%s %s', lspkind_icons[vim_item.kind], vim_item.kind) vim_item.kind = string.format('%s %s', lspkind_icons[vim_item.kind], vim_item.kind)

View File

@ -92,7 +92,6 @@ function M.lsp_conf()
local runtime_path = vim.split(package.path, ';') local runtime_path = vim.split(package.path, ';')
table.insert(runtime_path, 'lua/?.lua') table.insert(runtime_path, 'lua/?.lua')
table.insert(runtime_path, 'lua/?/init.lua') table.insert(runtime_path, 'lua/?/init.lua')
lspconf.sumneko_lua.setup { lspconf.sumneko_lua.setup {
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
@ -103,21 +102,16 @@ function M.lsp_conf()
}, },
settings = { settings = {
Lua = { Lua = {
diagnostics = { diagnostics = {globals = {'vim'}},
globals = {'vim'} runtime = {version = 'LuaJIT', path = runtime_path},
},
runtime = {
version = 'LuaJIT',
path = runtime_path
},
workspace = { workspace = {
library = vim.api.nvim_get_runtime_file('', true), library = vim.api.nvim_get_runtime_file('', true),
maxPreload = 100000, maxPreload = 1500,
preloadFileSize = 100000 preloadFileSize = 150
}, },
telemetry = { completion = {callSnippet = 'Replace'},
enable = false hint = {enable = true},
} telemetry = {enable = false}
} }
} }
} }

View File

@ -332,14 +332,19 @@ function M.bufferline_conf()
} }
end end
-- FIX: wait for config migration to setup()
function M.nvimtree_conf() function M.nvimtree_conf()
vim.g.nvim_tree_width = 35 vim.g.nvim_tree_gitignore = 1
vim.g.nvim_tree_ignore = {'.git', '.hg', '.svn', 'node_modules'} vim.g.nvim_tree_ignore = {'.git', '.hg', '.svn', 'node_modules'}
vim.g.nvim_tree_auto_ignore_ft = {'dashboard'} vim.g.nvim_tree_auto_ignore_ft = {'dashboard', 'alpha'}
vim.g.nvim_tree_respect_buf_cwd = 1
vim.g.nvim_tree_indent_markers = 1 vim.g.nvim_tree_indent_markers = 1
vim.g.nvim_tree_git_hl = 1 vim.g.nvim_tree_git_hl = 1
vim.g.nvim_tree_add_trailing = 0 vim.g.nvim_tree_highlight_opened_files = 1
-- vim.g.nvim_tree_add_trailing = 1
-- vim.g.nvim_tree_disable_window_picker = 1
-- vim.g.nvim_tree_symlink_arrow = ' ➛ '
vim.g.nvim_tree_respect_buf_cwd = 1
-- vim.g.nvim_tree_create_in_closed_folder = 1
vim.g.nvim_tree_icons = { vim.g.nvim_tree_icons = {
default = '', default = '',
symlink = '', symlink = '',
@ -369,6 +374,28 @@ function M.nvimtree_conf()
error = '' error = ''
} }
} }
require('nvim-tree').setup {
open_on_setup = false,
auto_close = true,
hijack_cursor = true,
update_cwd = true,
lsp_diagnostics = true,
update_focused_file = {
enable = true,
update_cwd = false,
ignore_list = {}
},
system_open = {
cmd = 'xdg-open',
args = {}
},
view = {
width = 35,
side = 'left',
auto_resize = false
}
}
end end
function M.whichkey_conf() function M.whichkey_conf()

View File

@ -35,20 +35,7 @@ return packer.startup(function(use)
use { use {
'kyazdani42/nvim-tree.lua', 'kyazdani42/nvim-tree.lua',
cmd = 'NvimTreeToggle', cmd = 'NvimTreeToggle',
setup = ui.nvimtree_conf, config = ui.nvimtree_conf
-- FIX: when all the options are migrated to setup()
config = function()
require('nvim-tree').setup {
open_on_setup = false,
auto_close = true,
hijack_cursor = true,
update_cwd = true,
lsp_diagnostics = true,
view = {
auto_resize = false
}
}
end
} }
use { use {
'folke/which-key.nvim', 'folke/which-key.nvim',

4
home/.local/bin/0x0 Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
website=$(curl -F"file=@${1:--}" "${WEBSITE:-https://0x0.st}")
echo "$website"

16
home/.local/bin/meow Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# POSIX shell client for PurritoBin to upload encrypted message
: "${P_SERVER=https://bsd.ac}"
: "${P_PORT=42069}"
: "${P_MAXTIME=30}"
# generate a 256 byte random key
# for using the aes-256-cbc cipher
key="$(openssl rand -hex 32)"
iv="$(openssl rand -hex 16)"
# calculate its encryption and upload it
url="$(openssl enc -aes-256-cbc -K ${key} -iv ${iv} -e -base64 -A < ${1:-/dev/stdin} | purr)"
printf %s\\n "${url%\/*}/paste.html#${url##*\/}_${key}_${iv}"
unset key iv url

16
home/.local/bin/meowd Executable file
View File

@ -0,0 +1,16 @@
#!/bin/sh
# POSIX shell client for PurritoBin to decrypt the message
: "${P_SERVER=https://bsd.ac}"
: "${P_PORT=42069}"
: "${P_MAXTIME=30}"
url="$1"
baseurl="${url%\/*}"
vals="${url##*\#}"
paste=$(printf %s\\n "${vals}" | cut -d'_' -f1)
key=$(printf %s\\n "${vals}" | cut -d'_' -f2)
iv=$(printf %s\\n "${vals}" | cut -d'_' -f3)
curl --max-time "${P_MAXTIME}" --write-out "\n" --silent "${baseurl}/${paste}" | openssl enc -aes-256-cbc -base64 -d -K ${key} -iv ${iv}
unset url baseurl vals paste key iv

10
home/.local/bin/purr Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# POSIX shell client for PurritoBin to upload standard message
: "${P_SERVER=https://bsd.ac}"
: "${P_PORT=42069}"
: "${P_MAXTIME=30}"
: "${P_TIME=week}" # can be set to day/week/month/<lifetime-in-minutes>
curl --silent --max-time "${P_MAXTIME}" --data-binary "@${1:-/dev/stdin}" "${P_SERVER}:${P_PORT}/${P_TIME}"