misc: some settings

This commit is contained in:
Klesh Wong 2022-09-24 15:59:11 +08:00
parent eab3612862
commit 5a347f6f5b
7 changed files with 58 additions and 13 deletions

11
bin/nnnedit Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
MIMETYPE=$(xdg-mime query filetype "$1")
case "$MIMETYPE" in
image/*)
gimp "$1"
;;
*)
"$EDITOR" "$1"
;;
esac

2
bin/sc
View File

@ -4,7 +4,7 @@ set -e
VIRTMON=virtmon
SC_FONT=${SC_FONT:-'WenQuanYi-Micro-Hei'}
PID_FILE="/tmp/recording.pid"
OUTPUT_DIR="/home/klesh/Videos"
OUTPUT_DIR="$HOME/Videos"
_stop_recording() {
killall screenkey 2>/dev/null || true

View File

@ -25,6 +25,7 @@ if status is-interactive
set -gx LS_COLORS 'ow=34;42;40'
# === nnn configuration
set -gx VISUAL nnnedit
set -gx NNN_PLUG 'c:fzcd;m:nmount;x:!chmod +x $nnn;X:!chmod -x $nnn;d:dragdrop;p:preview-tui'
set -gx NNN_FIFO /tmp/nnn.fifo
set -gx NNN_ARCHIVE '\.(7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|rar|rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)$'

View File

@ -32,6 +32,7 @@ case "$PM" in
sudo pacman -S --noconfirm --needed nnn ueberzug
mkdir -p "$NNN_CONFIG_DIR/plugins"
cp -r /usr/share/nnn/plugins/* "$NNN_CONFIG_DIR/plugins"
yay -S dragon-drop
;;
esac

View File

@ -1,15 +1,15 @@
-- global options
vim.g.mapleader = ";"
vim.g.clipboard = {
name = "sysclip",
copy = {
["+"] = {"xsel", "-b"},
["*"] = {"xsel", "-b"},
},
paste = {
["+"] = {"xsel", "-b"},
["*"] = {"xsel", "-b"},
},
name = "sysclip",
copy = {
["+"] = { "xsel", "-b" },
["*"] = { "xsel", "-b" },
},
paste = {
["+"] = { "xsel", "-b" },
["*"] = { "xsel", "-b" },
},
}
-- general options
@ -38,8 +38,8 @@ require("plugins")
local gruvbox_ok, _ = pcall(require, "gruvbox")
if gruvbox_ok then
vim.o.background = "dark"
vim.cmd [[
vim.o.background = "dark"
vim.cmd [[
colorscheme gruvbox
highlight Normal ctermbg=None guibg=none
highlight CursorLine ctermbg=240
@ -47,4 +47,15 @@ if gruvbox_ok then
end
-- format on save
vim.cmd [[autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()]]
-- open quickfix buffer after :grep or :vimgrep
vim.cmd [[
augroup quickfix
autocmd!
autocmd QuickFixCmdPost [^l]* cwindow
autocmd QuickFixCmdPost l* lwindow
augroup END
]]

View File

@ -51,6 +51,7 @@ keymap(NORMAL, '<leader>tm', ':Telescope media_files<cr>', { noremap = true })
keymap(NORMAL, '<leader>gc', ':Telescope git_branches<cr>', { noremap = true })
keymap(NORMAL, '<leader>gr', ':Telescope lsp_references<cr>', { noremap = true })
keymap(NORMAL, '<leader>gds', ':Telescope lsp_document_symbols<cr>', { noremap = true })
keymap(NORMAL, '<leader>ca', ':lua vim.lsp.buf.code_action', { noremap = true })
keymap(NORMAL, '<leader>gs', ':Git<cr>', { noremap = true })
keymap(NORMAL, '<leader>gp', ':Git push<cr>', { noremap = true })
keymap(NORMAL, '<leader>gg', ':Git pull<cr>', { noremap = true })

View File

@ -148,11 +148,12 @@ end
-- end
-- golangci
-- go install https://github.com/klesh/golangci-lint-langserver
local configs = require 'lspconfig/configs'
if not configs.golangcilsp then
configs.golangcilsp = {
default_config = {
cmd = { 'golangci-lint-langserver' },
cmd = { 'golangci-lint-langserver', "--debug" },
root_dir = lspconfig.util.root_pattern('.git', 'go.mod'),
init_options = {
command = { "golangci-lint", "run", "--out-format", "json",
@ -164,3 +165,22 @@ end
lspconfig.golangci_lint_ls.setup {
filetypes = { 'go', 'gomod' }
}
--
-- local function nvim_create_augroups(definitions)
-- for group_name, definition in pairs(definitions) do
-- vim.api.nvim_command('augroup ' .. group_name)
-- vim.api.nvim_command('autocmd!')
-- for _, def in ipairs(definition) do
-- local command = table.concat(vim.tbl_flatten { 'autocmd', def }, ' ')
-- vim.api.nvim_command(command)
-- end
-- vim.api.nvim_command('augroup END')
-- end
-- end
--
-- nvim_create_augroups({
-- go_save = {
-- { "BufWritePre", "*.go", "lua goimports(1000)" },
-- }
-- })