From e12c8c6d7207ed3c03f6b291f841a3cca7dfffc9 Mon Sep 17 00:00:00 2001 From: kuwoyuki Date: Sat, 6 Dec 2025 08:14:32 +0000 Subject: [PATCH] _ --- .Xresources | 40 +++++++++++ .bashrc | 96 +++++++++++++++++++++++++ .xinitrc | 18 +++++ bspwm/bspwmrc | 18 +++++ nvim/init.vim | 54 ++++++++++++++ nvim/lua/my/dashboard.lua | 61 ++++++++++++++++ nvim/lua/my/init.lua | 8 +++ nvim/lua/my/lsp.lua | 98 +++++++++++++++++++++++++ sxhkd/sxhkdrc | 146 ++++++++++++++++++++++++++++++++++++++ 9 files changed, 539 insertions(+) create mode 100755 .Xresources create mode 100644 .bashrc create mode 100755 .xinitrc create mode 100755 bspwm/bspwmrc create mode 100755 nvim/init.vim create mode 100755 nvim/lua/my/dashboard.lua create mode 100755 nvim/lua/my/init.lua create mode 100755 nvim/lua/my/lsp.lua create mode 100755 sxhkd/sxhkdrc diff --git a/.Xresources b/.Xresources new file mode 100755 index 0000000..d7eb0f1 --- /dev/null +++ b/.Xresources @@ -0,0 +1,40 @@ +! Kaolin Dark theme +! Dark jade theme inspired by Sierra.vim + +! special +*.foreground: #e4e4e8 +*.background: #18181b +*.cursorColor: #e4e4e8 + +! black +*.color0: #4b5254 +*.color8: #879193 + +! red +*.color1: #cd5c60 +*.color9: #e36d5b + +! green +*.color2: #6fb593 +*.color10: #72ccba + +! yellow +*.color3: #dbac66 +*.color11: #f2c866 + +! blue +*.color4: #91b9c7 +*.color12: #97b8de + +! magenta +*.color5: #845a84 +*.color13: #8c629c + +! cyan +*.color6: #4d9391 +*.color14: #5096ab + +! white +*.color7: #e4e4e8 +*.color15: #efeff1 + diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..52b221a --- /dev/null +++ b/.bashrc @@ -0,0 +1,96 @@ +# /etc/bash/bashrc +# +# This file is sourced by all *interactive* bash shells on startup, +# including some apparently interactive shells such as scp and rcp +# that can't tolerate any output. So make sure this doesn't display +# anything or bad things will happen! + +# Return immediately for non-interactive shells (scp, rcp etc.) +if [[ $- != *i* ]] ; then + # Shell is non-interactive. Be done now! + return +fi + +# Shell options +shopt -s checkwinsize # Update window size after each command +shopt -s globstar 2>/dev/null # Enable ** recursive globbing +shopt -s no_empty_cmd_completion # Disable completion on empty line + +# History settings +shopt -s histappend # Append to history instead of overwriting +shopt -s cmdhist # Save multi-line commands as one command +PROMPT_COMMAND='history -a' # Record each line as it gets issued +HISTSIZE=500000 +HISTFILESIZE=100000 +HISTCONTROL="erasedups:ignoreboth" +export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear" +HISTTIMEFORMAT='%F %T ' +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' +bind '"\e[C": forward-char' +bind '"\e[D": backward-char' + +# Change the window title of X terminals +case ${TERM} in + [aEkx]term*|rxvt*|gnome*|konsole*|interix|tmux*) + PS1='\[\033]0;\u@\h:\w\007\]' + ;; + screen*) + PS1='\[\033_\u@\h:\w\033\\\]' + ;; + *) + unset PS1 + ;; +esac + +PROMPT_DIRTRIM=2 + +# Color support +use_color=false +if type -P dircolors >/dev/null; then + LS_COLORS= + if [[ -f ~/.dir_colors ]]; then + eval "$(dircolors -b ~/.dir_colors)" + elif [[ -f /etc/DIR_COLORS ]]; then + eval "$(dircolors -b /etc/DIR_COLORS)" + else + eval "$(dircolors -b)" + fi + + [[ -n ${LS_COLORS:+set} ]] && use_color=true || unset LS_COLORS +else + case ${TERM} in + [aEkx]term*|rxvt*|gnome*|konsole*|screen|tmux|cons25|*color) + use_color=true + ;; + esac +fi + +if ${use_color}; then + if [[ ${EUID} == 0 ]]; then + PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] ' # root + else + PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' # normal user + fi + + #BSD#@export CLICOLOR=1 + alias ls='ls --color=auto' + alias grep='grep --colour=auto' +else + PS1+='\u@\h \w \$ ' +fi + +# Additional features +bind Space:magic-space # Enable history expansion with space +bind "set completion-ignore-case on" # Perform file completion in a case insensitive fashion +bind "set completion-map-case on" # Treat hyphens and underscores as equivalent +bind "set show-all-if-ambiguous on" # Display matches for ambiguous patterns at first tab press +bind "set mark-symlinked-directories on" # Immediately add a trailing slash when autocompleting symlinks to directories + +# Source additional configs +for sh in /etc/bash/bashrc.d/*; do + [[ -r ${sh} ]] && source "${sh}" +done + +# Try to keep environment pollution down, EPA loves us. +unset use_color sh diff --git a/.xinitrc b/.xinitrc new file mode 100755 index 0000000..823434b --- /dev/null +++ b/.xinitrc @@ -0,0 +1,18 @@ +#!/bin/sh + +[ -f "$HOME/.profile" ] && . "$HOME/.profile" +[ -f "$HOME/.Xresources" ] && xrdb -merge "$HOME/.Xresources" +[ -f "$HOME/.Xmodmap" [ && xmodmap "$HOME/.Xmodmap" + +xsetroot -cursor_name left_ptr +xset r rate 300 50 +xset -b + +sxhkd & +dunst & + +# wp +[ -f "$HOME/.local/share/wallpapers/current" ] && \ + xwallpaper --zoom "$HOME/.local/share/wallpapers/current" + +exec dbus-run-session bspwm diff --git a/bspwm/bspwmrc b/bspwm/bspwmrc new file mode 100755 index 0000000..ab87d7f --- /dev/null +++ b/bspwm/bspwmrc @@ -0,0 +1,18 @@ +#! /bin/sh + +pgrep -x sxhkd > /dev/null || sxhkd & + +bspc monitor -d I II III IV V VI VII VIII IX X + +bspc config border_width 2 +bspc config window_gap 12 + +bspc config split_ratio 0.52 +bspc config borderless_monocle true +bspc config gapless_monocle true + +bspc rule -a Gimp desktop='^8' state=floating follow=on +bspc rule -a Chromium desktop='^2' +bspc rule -a mplayer2 state=floating +bspc rule -a Kupfer.py focus=on +bspc rule -a Screenkey manage=off diff --git a/nvim/init.vim b/nvim/init.vim new file mode 100755 index 0000000..1453849 --- /dev/null +++ b/nvim/init.vim @@ -0,0 +1,54 @@ +" ~/.config/nvim/init.vim + +" General Settings +scriptencoding utf8 +set encoding=utf-8 +set mouse=a +set clipboard+=unnamedplus + +" Indentation & Formatting +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set smarttab +set autoindent +set wrap +set breakindent +set textwidth=90 + +" Search Settings +set incsearch +set ignorecase +set smartcase +set hlsearch +set grepprg=rg\ --vimgrep + +" Visual Settings +set termguicolors +set number +set list +set listchars=trail:»,tab:»- +set showtabline=0 +set nocursorline +set nocursorcolumn + +" Performance Settings +set scrolljump=5 +set lazyredraw +set redrawtime=10000 +set synmaxcol=180 +set re=1 + +" File Management +set undofile +set undodir=/tmp +set backspace=indent,eol,start +set foldlevel=0 + +" Initialize Lua Configuration +lua require('my.init').setup() + +" Package Management (Native) +packloadall " Load all packages +silent! helptags ALL " Generate help tags for all packages diff --git a/nvim/lua/my/dashboard.lua b/nvim/lua/my/dashboard.lua new file mode 100755 index 0000000..5b98701 --- /dev/null +++ b/nvim/lua/my/dashboard.lua @@ -0,0 +1,61 @@ +local M = {} + +function M.setup() + local alpha = require('alpha') + local dashboard = require('alpha.themes.dashboard') + + dashboard.section.header.val = + {[[ ⠄⠄⣼⡟⣿⠏⢀⣿⣇⣿⣏⣿⣿⣿⣿⣿⣿⣿⢸⡇⣿⣿⣿⣟⣿⣿⣿⣿ ]], + [[ ⡆⣸⡟⣼⣯⠏⣾⣿⢸⣿⢸⣿⣿⣿⣿⣿⣿⡟⠸⠁⢹⡿⣿⣿⢻⣿⣿⣿ ]], + [[ ⡇⡟⣸⢟⣫⡅⣶⢆⡶⡆⣿⣿⣿⣿⣿⢿⣛⠃⠰⠆⠈⠁⠈⠙⠈⠻⣿⢹ ]], + [[ ⣧⣱⡷⣱⠿⠟⠛⠼⣇⠇⣿⣿⣿⣿⣿⣿⠃⣰⣿⣿⡆⠄⠄⠄⠄⠄⠉⠈ ]], + [[ ⡏⡟⢑⠃⡠⠂⠄⠄⠈⣾⢻⣿⣿⡿⡹⡳⠋⠉⠁⠉⠙⠄⢀⠄⠄⠄⠄⠄ ]], + [[ ⡇⠁⢈⢰⡇⠄⠄⡙⠂⣿⣿⣿⣿⣱⣿⡗⠄⠄⠄⢀⡀⠄⠈⢰⠄⠄⠄⠐ ]], + [[ ⠄⠄⠘⣿⣧⠴⣄⣡⢄⣿⣿⣿⣷⣿⣿⡇⢀⠄⠤⠈⠁⣠⣠⣸⢠⠄⠄⠄ ]], + [[ ⢀⠄⠄⣿⣿⣷⣬⣵⣿⣿⣿⣿⣿⣿⣿⣷⣟⢷⡶⢗⡰⣿⣿⠇⠘⠄⠄⠄ ]], + [[ ⣿⠄⠄⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣾⣿⣿⡟⢀⠃⠄⢸⡄ ]], + [[ ⣿⠄⠄⠘⢿⣿⣿⣿⣿⣿⣿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⢄⡆⠄⢀⣪⡆ ]], + [[ ⡟⠄⠄⠄⠄⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣟⣻⣩⣾⣃⣴⣿⣿⡇ ]]} + + -- Set menu + dashboard.section.buttons.val = {dashboard.button("n", " New file", ":enew "), + dashboard.button("s", " Settings", ":e $MYVIMRC "), + dashboard.button("q", " Quit NVIM", ":qa")} + + -- Set footer + local function footer() + local datetime = os.date("%H:%M") + local version = vim.version() + local nvim_version_info = "v" .. version.major .. "." .. version.minor .. "." .. version.patch + + return string.format("%s %s", datetime, nvim_version_info) + end + + dashboard.section.footer.val = footer() + + -- set layout + dashboard.config.layout = {{ + type = "padding", + val = 1 + }, dashboard.section.header, { + type = "padding", + val = 2 + }, dashboard.section.buttons, { + type = "padding", + val = 1 + }, dashboard.section.footer} + + -- autostart + vim.api.nvim_create_autocmd("VimEnter", { + callback = function() + if vim.fn.argc() == 0 then + require("alpha").start() + end + end + }) + + dashboard.config.opts.noautocmd = true + alpha.setup(dashboard.config) +end + +return M diff --git a/nvim/lua/my/init.lua b/nvim/lua/my/init.lua new file mode 100755 index 0000000..85944cb --- /dev/null +++ b/nvim/lua/my/init.lua @@ -0,0 +1,8 @@ +local M = {} + +function M.setup() + require('my.lsp').initialize() + require('my.dashboard').setup() +end + +return M diff --git a/nvim/lua/my/lsp.lua b/nvim/lua/my/lsp.lua new file mode 100755 index 0000000..b1f2511 --- /dev/null +++ b/nvim/lua/my/lsp.lua @@ -0,0 +1,98 @@ +local lspconfig = require "lspconfig" + +local function on_attach(client, bufnr) + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") + vim.api.nvim_buf_set_var(bufnr, "vcm_tab_complete", "omni") + + local function command(name, command) + vim.api.nvim_buf_create_user_command(bufnr, name, command, {}) + end + + local function map(mode, lhs, rhs) + vim.keymap.set(mode, lhs, rhs, { + buffer = bufnr + }) + end + + local augroup_id = vim.api.nvim_create_augroup("LSPAttach", { + clear = false + }) + local function autocmd(event, callback) + vim.api.nvim_create_autocmd(event, { + group = augroup_id, + buffer = bufnr, + callback = callback + }) + end + vim.api.nvim_clear_autocmds({ + buffer = bufnr, + group = augroup_id + }) + + command("References", function() + local function on_list(options) + vim.fn.setqflist({}, "r", options) + vim.api.nvim_command("cfirst") + end + vim.lsp.buf.references(nil, { + on_list = on_list + }) + end) + + map("n", "gD", vim.lsp.buf.declaration) + map("n", "gd", vim.lsp.buf.definition) + map("n", "K", vim.lsp.buf.hover) + map("n", "", vim.lsp.buf.signature_help) + map("n", "lc", vim.lsp.buf.code_action) + map("n", "li", vim.lsp.buf.implementation) + map("n", "lr", vim.lsp.buf.rename) + + autocmd("CursorHold", function() + vim.lsp.buf.document_highlight() + vim.diagnostic.open_float({ + bufnr = bufnr + }, { + focus = false + }) + end) + autocmd("CursorMoved", vim.lsp.buf.clear_references) +end + +local settings = { + clangd = { + cmd = {"clangd", "--background-index", "--suggest-missing-includes", "--clang-tidy", "--header-insertion=iwyu"} + } +} + +local lsp = {} + +function lsp.initialize() + vim.diagnostic.config({ + float = { + focusable = false + } + }) + + for lss, lss_params in pairs(settings) do + local params = { + on_attach = on_attach, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + signs = false, + virtual_text = false, + underline = true + }), + ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { + silent = true, + focusable = false + }), + ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { + focusable = false + }) + } + } + lspconfig[lss].setup(vim.tbl_deep_extend("force", params, lss_params)) + end +end + +return lsp diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc new file mode 100755 index 0000000..6c517f7 --- /dev/null +++ b/sxhkd/sxhkdrc @@ -0,0 +1,146 @@ +# +# wm independent hotkeys +# + +# terminal emulator +super + Return + kitty + +# program launcher +super + @space + dmenu_run + +# make sxhkd reload its configuration files: +super + Escape + pkill -USR1 -x sxhkd + +# backlight controls +XF86MonBrightnessUp + brightnessctl set +5% + +XF86MonBrightnessDown + brightnessctl set 5%- + +# selection screenshot +Print + ~/.local/bin/screenshot + +# full screenshot +shift + Print + ~/.local/bin/screenshot -f + +ctrl + Print + ~/.local/bin/screenshot -u + +ctrl + shift + Print + ~/.local/bin/screenshot -uf + +# date + bat +super + shift + i + notify-send "$(date '+%Y-%m-%d %H:%M') | Battery:$(acpi -b | cut -d',' -f2,2)" + +# +# bspwm hotkeys +# + +# quit/restart bspwm +super + alt + {q,r} + bspc {quit,wm -r} + +# close and kill +super + {_,shift + }w + bspc node -{c,k} + +# alternate between the tiled and monocle layout +super + m + bspc desktop -l next + +# send the newest marked node to the newest preselected node +super + y + bspc node newest.marked.local -n newest.!automatic.local + +# swap the current node and the biggest window +super + g + bspc node -s biggest.window + +# +# state/flags +# + +# set the window state +super + {t,shift + t,s,f} + bspc node -t {tiled,pseudo_tiled,floating,fullscreen} + +# set the node flags +super + ctrl + {m,x,y,z} + bspc node -g {marked,locked,sticky,private} + +# +# focus/swap +# + +# focus the node in the given direction +super + {_,shift + }{h,j,k,l} + bspc node -{f,s} {west,south,north,east} + +# focus the node for the given path jump +super + {p,b,comma,period} + bspc node -f @{parent,brother,first,second} + +# focus the next/previous window in the current desktop +super + {_,shift + }c + bspc node -f {next,prev}.local.!hidden.window + +# focus the next/previous desktop in the current monitor +super + bracket{left,right} + bspc desktop -f {prev,next}.local + +# focus the last node/desktop +super + {grave,Tab} + bspc {node,desktop} -f last + +# focus the older or newer node in the focus history +super + {o,i} + bspc wm -h off; \ + bspc node {older,newer} -f; \ + bspc wm -h on + +# focus or send to the given desktop +super + {_,shift + }{1-9,0} + bspc {desktop -f,node -d} '^{1-9,10}' + +# +# preselect +# + +# preselect the direction +super + ctrl + {h,j,k,l} + bspc node -p {west,south,north,east} + +# preselect the ratio +super + ctrl + {1-9} + bspc node -o 0.{1-9} + +# cancel the preselection for the focused node +super + ctrl + space + bspc node -p cancel + +# cancel the preselection for the focused desktop +super + ctrl + shift + space + bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel + +# +# move/resize +# + +# expand a window by moving one of its side outward +super + alt + {h,j,k,l} + bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0} + +# contract a window by moving one of its side inward +super + alt + shift + {h,j,k,l} + bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0} + +# move a floating window +super + {Left,Down,Up,Right} + bspc node -v {-20 0,0 20,0 -20,20 0}