minor updates

This commit is contained in:
Arthur Khachaturov 2024-09-19 04:25:07 +03:00
parent e3790a4f3f
commit 628baf3eea
No known key found for this signature in database
GPG key ID: CAC2B7EB6DF45D55
32 changed files with 655 additions and 123 deletions

View file

@ -1,8 +1,18 @@
systemctl --user import-environment DISPLAY
export TERMINAL=/usr/bin/alacritty
export TERM=/usr/bin/alacritty
export _JAVA_AWT_WM_NONREPARENTING=1
export AWT_TOOLKIT=MToolkit
set -a
TERMINAL=/usr/bin/alacritty
TERM=/usr/bin/alacritty
_JAVA_AWT_WM_NONREPARENTING=1
AWT_TOOLKIT=MToolkit
MOZ_USE_XINPUT2=1
XDG_CURRENT_DESKTOP="gtk"
XDG_SESSION_DESKTOP="$XDG_CURRENT_DESKTOP"
WINDOW_MANAGER="dwm"
set +a
# vim: ft=bash

View file

@ -3,15 +3,15 @@
declare -A cases
while read -r element; do
case "$element" in
"#Open"*)
cases["open"]+=$element
;;
"#Mark as read"*)
cases["read"]+=$element
;;
*) cases["$element"]="$element"
esac
case "$element" in
"#Open"*)
cases["open"]+=$element
;;
"#Mark as read"*)
cases["read"]+=$element
;;
*) cases["$element"]="$element"
esac
done

View file

@ -1,15 +1,29 @@
-- Remap leader key to <Space>
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Load modules
-- Load basic configuration
require("config")
require("utils.lazy").lazy_init()
-- Init lazy.nvim plugin manager
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
-- Load plugins
require("lazy").setup("plugins", {
change_detection = {
enabled = false,
notify = false,
},
})
-- Load lsp configuration
require("lsp")

View file

@ -1,5 +1,14 @@
-- Set proper tabstop for go
vim.api.nvim_create_autocmd('FileType', {
pattern = "go",
command = "setlocal tabstop=4",
command = "setlocal tabstop=4 noexpandtab",
})
-- Remove trailing whitespaces on save
vim.api.nvim_create_autocmd('BufWritePre', {
callback = function ()
local view = vim.fn.winsaveview()
vim.cmd('%s/\\s\\+$//e')
vim.fn.winrestview(view)
end
})

View file

@ -1,5 +1,10 @@
local map = vim.keymap.set
-- Remap leader to <Space>
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
map({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
-- Unbind keys
map('n', '<C-q>', '<NOP>')
map({ 'n', 'v' }, 'H', '<NOP>')
@ -28,6 +33,10 @@ map({ 'n', 'v' }, '<leader>m', '<C-w>10>')
map({ 'n', 'v' }, '<leader>N', '<C-w>6-')
map({ 'n', 'v' }, '<leader>M', '<C-w>6+')
-- quickfix buffer
map('n', '<M-n>', ':cn<CR>', { silent = true })
map('n', '<M-p>', ':cp<CR>', { silent = true })
-- Remap <M-BS> to remove last word
map('i', '<M-BS>', '<C-w>')

View file

@ -16,7 +16,7 @@ vim.o.autoindent = true
vim.o.smartindent = true
vim.o.smarttab = true
vim.o.breakindent = true
vim.o.softtabstop = -1
vim.o.softtabstop = 4
-- Save undo history
vim.o.undofile = true

View file

@ -6,6 +6,8 @@ local servers = {
rust_analyzer = {},
bashls = {},
hls = {},
eslint = {},
ts_ls = {},
}
vim.lsp.set_log_level("debug")
@ -43,7 +45,15 @@ for server_name, config in pairs(servers) do
lspconfig[server_name].setup({
capabilities = capabilities,
on_attach = on_attach,
settings = { [server_name] = config },
settings = {
[server_name] = config ~= {} and {
settings = {
[server_name] = {
config
}
}
} or {}
},
})
end

View file

@ -1,10 +1,11 @@
return {
settings = {
['lua_ls'] = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
}
}
Lua = {
workspace = {
checkThirdParty = true,
library = {
vim.env.VIMRUNTIME
}
},
telemetry = { enable = false },
},
}

View file

@ -1,11 +1,13 @@
return {
'rcarriga/nvim-notify',
'psliwka/vim-smoothie',
'stefandtw/quickfix-reflector.vim',
'tpope/vim-sleuth',
{ 'akinsho/bufferline.nvim', opts = {}, dependencies = { 'navarasu/onedark.nvim' } },
{ 'ethanholz/nvim-lastplace', opts = {} },
{ 'kylechui/nvim-surround', version = '*', event = 'VeryLazy', opts = {} },
{ 'lukas-reineke/indent-blankline.nvim', main = 'ibl', opts = {} },
{ 'norcalli/nvim-colorizer.lua', opts={'*'}, dependencies = { 'navarasu/onedark.nvim' } },
{ 'norcalli/nvim-colorizer.lua', opts={ '*' }, dependencies = { 'navarasu/onedark.nvim' } },
{ 'wakatime/vim-wakatime', event = 'VeryLazy' },
{ 'williamboman/mason.nvim', opts = {} },
}

View file

@ -36,6 +36,6 @@ return {
vim.keymap.set('n', '<leader>of', require('telescope.builtin').oldfiles)
vim.keymap.set('n', '<leader>af', require('telescope.builtin').git_files)
vim.keymap.set('n', '<leader>sf', require('telescope.builtin').find_files)
vim.keymap.set('n', '<leader>sw', require('telescope.builtin').grep_string)
vim.keymap.set('n', '<leader>fw', require('telescope.builtin').grep_string)
end
}

View file

@ -3,11 +3,9 @@ return {
opts = {},
cmd = "Trouble",
keys = {
{ "<leader>xx", "<cmd>Trouble diagnostics toggle<cr>" }, -- ??
{ "<leader>xX", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>" }, -- useless?
{ "<leader>cs", "<cmd>Trouble symbols toggle focus=false<cr>" }, -- nice as well
{ "<leader>cl", "<cmd>Trouble lsp toggle focus=false win.position=right<cr>" }, -- nicee
{ "<leader>xL", "<cmd>Trouble loclist toggle<cr>" }, -- ??
{ "<leader>xQ", "<cmd>Trouble qflist toggle<cr>" }, -- ??
{ "<leader>ew", "<cmd>Trouble diagnostics toggle<cr>" },
{ "<leader>ef", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>" },
{ "<leader>cs", "<cmd>Trouble symbols toggle focus=false<cr>" },
{ "<leader>cl", "<cmd>Trouble lsp toggle focus=false win.position=right<cr>" },
},
}

View file

@ -1,15 +0,0 @@
local M = { }
function M.close_buffer(force)
if #vim.fn.filter(vim.fn.range(1, vim.fn.bufnr '$'), 'buflisted(v:val)') <= 1 then
vim.api.nvim_command("qa" .. (force and "!" or ""))
else
local tree = require("nvim-tree.api").tree
tree.toggle({ focus = false })
vim.api.nvim_command("bd" .. (force and "!" or ""))
tree.toggle({ focus = false })
end
end
return M

View file

@ -1,18 +0,0 @@
local M = { }
function M.lazy_init()
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not vim.loop.fs_stat(lazypath) then
vim.fn.system {
'git',
'clone',
'--filter=blob:none',
'https://github.com/folke/lazy.nvim.git',
'--branch=stable',
lazypath,
}
end
vim.opt.rtp:prepend(lazypath)
end
return M

View file

@ -21,8 +21,8 @@ bind ';' "command-prompt"
bind C-r "source-file ~/.config/tmux/tmux.conf"
# Session binds
bind C-n "new-session -c '#{pane_current_path}' -s '#{b:pane_current_path}'"
bind C-x "set-option -g detach-on-destroy on; kill-session"
# bind C-n "new-session -c '#{pane_current_path}' -s '#{b:pane_current_path}'"
# bind C-x "set-option -g detach-on-destroy on; kill-session"
bind X "set-option -g detach-on-destroy off; kill-session; set-option -g detach-on-destroy on"
# Select mode

View file

@ -9,8 +9,8 @@ set -g @batt_icon_charge_tier6 ' '
set -g @batt_icon_charge_tier5 ' '
set -g @batt_icon_charge_tier4 ' '
set -g @batt_icon_charge_tier3 ' '
set -g @batt_icon_charge_tier2 ''
set -g @batt_icon_charge_tier1 '! !'
set -g @batt_icon_charge_tier2 ''
set -g @batt_icon_charge_tier1 ''
# better-mouse-mode
set -g @emulate-scroll-for-no-mouse-alternate-buffer "on"

View file

@ -13,10 +13,11 @@ set -g status-justify "left"
# status
set -g status-left-length 0
set -g status-left "#[bg=#{@theme-active-bg},fg=#{@theme-active-fg}]#{?client_prefix,[#{session_name}],#[bg=#{@theme-bg},fg=#{@theme-fg}][#{session_name}]}#[bg=#{@theme-bg},fg=#{@theme-fg}] "
set -g status-right "#{battery_icon_charge} #{battery_percentage} | %a %m/%d %I:%M %P"
set -g status-right "#(sb-battery -s) | %a %m/%d %I:%M %P"
set -g window-status-format " #I:#W "
set -g window-status-current-format "#[bg=#{@theme-active-bg},fg=#{@theme-active-fg}, bold]#{?window_zoomed_flag, #I:#W 󰊓 , #I:#W }"
set -g window-status-style "bg=#{@theme-bg},fg=#{@theme-fg}"
set -g status-interval "5"
# pane styles
set -g pane-border-style "fg=#{@theme-active-bg}"

View file

@ -28,6 +28,9 @@ setw -g pane-base-index 1
set -g visual-activity off
set -g monitor-activity off
# number windows with respect for base-index
set -g renumber-windows on
# Resize all windows to max size?
setw -g aggressive-resize on

View file

@ -1,4 +1,5 @@
# if [ -z "$SSH_AUTH_SOCK" ]; then
# eval "$(ssh-agent -s)"
# fi
systemctl --user import-environment XDG_CURRENT_DESKTOP

View file

@ -1,7 +1,7 @@
set -a
PATH="$HOME/.local/share/go/bin:$PATH"
PATH="${$(find -L ~/.local/bin -type d -printf %p:)%%:}:$PATH"
PATH="${$(find -L ~/.local/bin ! -name '.*' -type d -printf %p:)%%:}:$PATH"
# lc vars
LANGUAGE="en_US.UTF-8"
@ -26,11 +26,6 @@ GPG_TTY="$(tty)"
MANPAGER="sh -c 'col -bx | batcat -l man -p'"
MANROFFOPT="-c"
MTR_OPTIONS="-t"
MOZ_USE_XINPUT2=1
XDG_CURRENT_DESKTOP="gtk"
XDG_SESSION_DESKTOP="$XDG_CURRENT_DESKTOP"
WINDOW_MANAGER="dwm"
SUDO_ASKPASS="${HOME}/.local/bin/scripts/dmenu_askpass"
SSH_ASKPASS="${HOME}/.local/bin/scripts/ssh-askpass"

View file

@ -1,8 +1,7 @@
[[ $- != *i* ]] && return
[ "$TERM" = "linux" ] && export TERM=fbterm
# [[ $- != *i* ]] && return # idk why would it be tho...
. ~/.cargo/env
. ~/.config/zsh/modes.sh
# ls colors
eval "$(dircolors -b)"
@ -40,7 +39,7 @@ bindkey "^[n" backward-word
bindkey "^[m" forward-word
# completions
autoload -Uz compinit
autoload -Uz compinit
compinit
zstyle ':completion:*' menu select
@ -86,6 +85,7 @@ alias 7z="7zz" # for whatever reason 7z provides 7zz binary in debian
alias wt="watch -d -cn 0.1 "
alias cal="ncal -b"
alias .e="source .env"
alias tp="taskell ${HOME}/.projects.md"
# function aliases
bl() { brightnessctl set "$1"% &> /dev/null; }
@ -126,4 +126,4 @@ alias ta="tmux a -t"
stty -ixon
# print tasks on startup
cat ~/.taskell.md
cat ~/.taskell.md | grep -v '>.*'

62
.config/zsh/modes.sh Normal file
View file

@ -0,0 +1,62 @@
mode::enable() {
local mode_path="${HOME}/.config/zsh/modes/$1.sh"
[ ! -f "$mode_path" ] && echo "Mode not found!" && return 1
export MODE__ACTIVE_MODE="$1"
export MODE__OLD_PS1="$PS1"
export PS1="($1) $PS1"
# shellcheck disable=SC1090
source "$mode_path"
}
mode::disable() {
export PS1="${MODE__OLD_PS1}"
local mode_path="${HOME}/.config/zsh/modes/$MODE__ACTIVE_MODE.sh"
unset -v "MODE__OLD_PS1"
unset -v "MODE__ACTIVE_MODE"
for mode_variable in $(perl -ne '/^(?>declare\s+(?>--?\w+\s*)+\s*)?\s*([\x21-\x3c\x3e-\x7e]+)=.*$/ && print "$1\n"' < "$mode_path"); do
unset "$mode_variable"
done
for mode_function in $(perl -ne '/^(?>function\s+)?([\x21-\x7e]+)\s*\(\)/ && print "$1\n"' < "$mode_path"); do
unset -f "$mode_function"
done
for mode_alias in $(perl -ne '/^alias ([\x21-\x3c\x3e-\x7e]+)=/ && print "$1\n"'< "$mode_path"); do
unalias "$mode_alias"
done
}
mode::help() {
echo "USAGE"
echo " mode [-h]"
echo " mode <MODENAME>"
echo " mode"
echo
echo "OPTIONS"
echo " -h for help lol"
echo
echo "AVAILABLE MODES"
for mode in ~/.config/zsh/modes/*; do
printf " %s\n" "$(basename "${mode%.sh}")"
done
}
m() {
[ -n "$MODE__ACTIVE_MODE" ] && mode::disable && return
local cmd="${1:?}"
case "$cmd" in
"-h"|"--help")
mode::help
;;
*)
mode::enable "$cmd" || mode::help >&2
;;
esac
}

18
.config/zsh/modes/cpp.sh Normal file
View file

@ -0,0 +1,18 @@
# shellcheck disable=SC2139
CPP_MODE__BUILD_DIR="./cmake-build"
alias cb="cmake --build ${CPP_MODE__BUILD_DIR}"
alias cg="cmake -B ${CPP_MODE__BUILD_DIR} -DCMAKE_EXPORT_COMPILE_COMMANDS=1 && ln -sf ${CPP_MODE__BUILD_DIR}/compile_commands.json ."
cpp_mode::find_exec() {
find "${CPP_MODE__BUILD_DIR}/$1" -maxdepth 1 -type f -executable
}
ct() {
eval "$(cpp_mode::find_exec "tests")"
}
cr() {
eval "$(cpp_mode::find_exec)"
}