From 5a339d2f6c9fda89b586f8c4839d466e491076b5 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 00:50:57 +0400 Subject: refactor: improve minimal bash config for vi mode and portability - Add manual bindings for Ctrl-l in vi normal/insert mode - Improve PS1 prompt with exit code handling and color - Comment out slow vi mode indicator suggestion - Add fallback clear alias and remove duplicate vi alias --- config/bash/bashrc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'config') diff --git a/config/bash/bashrc b/config/bash/bashrc index ca2435d..f143fd2 100644 --- a/config/bash/bashrc +++ b/config/bash/bashrc @@ -1,18 +1,28 @@ -# Minimal bash config for servers - set -o vi -stty -ixon # Disable ctrl-s and ctrl-q for freezing prompt -shopt -s autocd # automatically cd into typed directory +# `set show-mode-in-prompt on` is not set, +# indicating vi mode in bash is too slow + +# Ctrl-l is disabled in vi mode, bind it manually +bind -m vi-command '"\C-l": clear-screen' +bind -m vi-insert '"\C-l": clear-screen' -alias vi=vim -alias vi=nvim +stty -ixon # Disable ctrl-s and ctrl-q for freezing prompt +shopt -s autocd # Automatically cd into typed directory -PS1='\e[01;31m$(code=${?##0};echo ${code:+[${code}]" "})\e[00m\u@\H \w % ' +PS1='\[\e[01;31m\]$(code=$?; [ "$code" -ne 0 ] && echo "[${code}] ")\[\e[00m\]\[\e[01;34m\]\u\[\e[00m\]@\H \w % ' if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" ];then source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/aliasrc" +else + # Fallback aliases where aliasrc isn't present (e.g., on servers) + alias \ + vi="vim" \ + vi="nvim" \ + clear="clear -x" + fi if [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functionrc" ];then source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/functionrc" + bind '"\C-o": "\C-ulfcd\n"' fi -- cgit v1.2.3 From 0c748624f05df480060be3c6c3a07ace310866d0 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 00:52:01 +0400 Subject: feat: enhance git config with aliases and GPG signing - Add common aliases (co, br, ci, st) for shorter commands - Rewrite pushall to work reliably across all remotes - Enable GPG signing for commits and tags - Set OpenPGP as the preferred signing format - Add placeholder for signing key under [user] --- config/git/gitconfig | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/git/gitconfig b/config/git/gitconfig index 976d768..8a69554 100644 --- a/config/git/gitconfig +++ b/config/git/gitconfig @@ -1,9 +1,26 @@ [init] defaultBranch = master + [pager] branch = false + [alias] - pushall = !git remote | xargs -L1 git push --all + co = checkout + br = branch + ci = commit + st = status + pushall = "!for r in $(git remote); do git push --all \"$r\"; done" + [user] email = suleyman@farajli.net name = Suleyman Farajli + # signingkey = + +[commit] + gpgSign = true + +[tag] + gpgSign = true + +[gpg] + format = openpgp -- cgit v1.2.3 From a49d7a5867078a67efb00aa383a0b3693b76ba63 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 01:00:37 +0400 Subject: refactor(lfrc): clean up config, improve trash cmd, and update keymaps --- config/lf/lfrc | 51 ++++++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'config') diff --git a/config/lf/lfrc b/config/lf/lfrc index 1b50065..40b6272 100644 --- a/config/lf/lfrc +++ b/config/lf/lfrc @@ -1,51 +1,48 @@ -# Suleyman's gruvbox themed lf config at "https://git.farajli.net/slcf.git" - -# Due to the facts that ueberzug is no longer maintained and adds extra \ -# complexity it is not included in the config +# Due to the fact that ueberzug is no longer maintained and +# adds extra complexity, it is not included in the configuration." # Options set incsearch -set scrolloff 4 #smooth scrolling +set scrolloff 4 # Smooth scrolling -# Key-maps +# Bindings map shell map m push $mkdir map t push $touch map D trash map $lf -remote "send $id select \"$(fzf --reverse)\"" -map x $$f # execute current file (must be executable) +map x $$f # Execute current file (must be executable) map zb :{{ set sortby natural; set info size; set preview; set ratios 5:2; }} map zz :{{ set preview; set ratios 1:2:3; }} -# Directory change -map cd ~ +# Directory change keybinds (some overwrite default ones) +# and might fail on some terminal emulators +map cd ~/ map cd ~/proj map cd ~/tproj -map cd ~/.config -map cd /tmp -map cd /usr/local/bin -map cd ~/music -map cd ~/books - -# Colors -set cursoractivefmt "\033[0;1;7m" #white -# set cursoractivefmt "\033[32;1;7m" #yellowish green -# set cursoractivefmt "\033[33;1;7m" #orange -# set cursoractivefmt "\033[36;1;7m" #green +map cd /tmp +map cd ~/work +# Theme +set cursoractivefmt "\033[0;1;7m" set cursorparentfmt "\033[0;1;7m" set tagfmt "\033[32;1;7m" set rulerfmt "\033[32;1;7m" set promptfmt "\033[48;1;234m %w/%f" -#FIXME: Doesn't overwrite some files cmd trash ${{ - mkdir -p ~/.trash - if [ -z "$fs" ]; then - mv "$f" ~/.trash - else - IFS="$(printf '\n\t')"; mv $fs ~/.trash - fi + set -f + mkdir -p ~/.trash + for entry in $fx; do + trash_path=~/.trash/$(basename -- "${entry}") + if [ -e "${trash_path}" ]; then + printf '%s exists\n' "${trash_path}" >&2 + trash_path="${trash_path}_$(date +%s)_$RANDOM" + printf 'moving to %s\n' "${trash_path}" >&2 + fi + + mv -- "${entry}" "${trash_path}" + done }} -- cgit v1.2.3 From 226b3c808393b5e91e3eb6c6c591f5bc5e5d9775 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 01:01:15 +0400 Subject: refactor(input.conf): reorder keys and improve ab-loop/loop-file bindings --- config/mpv/input.conf | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/mpv/input.conf b/config/mpv/input.conf index 192a14c..8c32fe8 100644 --- a/config/mpv/input.conf +++ b/config/mpv/input.conf @@ -1,7 +1,8 @@ -l seek 5 -h seek -5 , seek -60 . seek 60 +h seek -5 +l seek 5 + S cycle sub -L ab-loop -J cycle-values loop-file "inf" "no" +Ctrl+l ab-loop +L cycle-values loop-file "inf" "no" -- cgit v1.2.3 From 09d70e1bc0bf1e5c54b3faf2918a3e14c4fc4cfc Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 01:07:18 +0400 Subject: refactor: improve Neovim config for better readability and functionality - Switch to Lua API options for setting vim options instead of vim.cmd - Add autocmd to trim trailing whitespace on save (except markdown) - Disable auto-comments via autocmd for all filetypes - Enhance and standardize key mappings with noremap and silent flags - Clean up plugin config indentation and comments --- config/nvim/init.lua | 83 ++++++++++++++++++++++++++++++++------------- config/nvim/lua/plugins.lua | 24 ++++++------- 2 files changed, 70 insertions(+), 37 deletions(-) (limited to 'config') diff --git a/config/nvim/init.lua b/config/nvim/init.lua index df90607..ea8a3d2 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -1,15 +1,14 @@ require("plugins") -vim.cmd("let mapleader = ' '") -vim.cmd("set relativenumber") -vim.cmd("set number") -vim.cmd("colorscheme duskfox") -vim.cmd("set nowrap") -vim.cmd("set clipboard=unnamedplus") -- Use system clipboard -vim.cmd("set background=dark") -vim.cmd("set shm+=I") -- Disable intro message -vim.cmd("autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o") -- Disable auto-comment --- vim.cmd("set list") -- Show spaces tabs etc. +vim.g.mapleader = ' ' +vim.opt.background = "dark" +vim.opt.clipboard = "unnamedplus" -- Use system clipboard +vim.opt.list = true -- Show spaces, tabs, etc. +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.shortmess:append("I") -- Disable intro message +vim.opt.wrap = false +vim.cmd.colorscheme("duskfox") vim.opt.fillchars = { vert = "|", @@ -22,16 +21,54 @@ vim.opt.fillchars = { foldclose = ">", } -vim.keymap.set('n', '', ':w!') -vim.keymap.set('n', 'q', ':wq!') -vim.keymap.set('n', '', ':tabnew') -vim.keymap.set('n', 'J', ':tabn') -vim.keymap.set('n', 'K', ':tabp') -vim.keymap.set('n', '', ':vsplit') -vim.keymap.set('n', 'H', ':wincmd h') -vim.keymap.set('n', 'L', ':wincmd l') -vim.keymap.set('n', 'e', ':Neotree toggle right') -vim.keymap.set('n', 'o', 'w') -vim.keymap.set('i', '', '') -vim.keymap.set('i', '', '') -vim.keymap.set('i', '', '') +-- Remove trailing whitespace on all lines before saving, excluding markdown files +vim.api.nvim_create_autocmd("BufWritePre", { + pattern = "*", + callback = function() + if vim.bo.filetype == "markdown" then + return + end + vim.cmd([[%s/\s\+$//e]]) + end, +}) + +-- Disable auto-comment +vim.api.nvim_create_autocmd("FileType", { + pattern = "*", + callback = function() + vim.opt_local.formatoptions:remove({ "c", "r", "o" }) + end, +}) + + +-- NOTE: On some terminal emulators, the keybinds +-- and don't work either in normal or insert mode. + +-- Tabs +vim.keymap.set('n', '', 'tabnew' , { noremap = true, silent = true }) +vim.keymap.set('n', 'H' , 'wincmd h', { noremap = true, silent = true }) +vim.keymap.set('n', 'J' , 'tabn' , { noremap = true, silent = true }) +vim.keymap.set('n', 'K' , 'tabp' , { noremap = true, silent = true }) +vim.keymap.set('n', 'L' , 'wincmd l', { noremap = true, silent = true }) + +-- Windows +vim.keymap.set('n', '' , 'split' , { noremap = true, silent = true }) +vim.keymap.set('n', '', 'vsplit', { noremap = true, silent = true }) +vim.keymap.set('n', '' , 'h' , { noremap = true }) +vim.keymap.set('n', '' , 'j' , { noremap = true }) +vim.keymap.set('n', '' , 'k' , { noremap = true }) +vim.keymap.set('n', '' , 'l' , { noremap = true }) + +-- Imitate normal mode in insert mode +vim.keymap.set('i', '' , '' , { noremap = true }) +vim.keymap.set('i', '' , '', { noremap = true }) +vim.keymap.set('i', '' , '' , { noremap = true }) +vim.keymap.set('i', '' , '' , { noremap = true }) +vim.keymap.set('i', '', '' , { noremap = true }) + +-- Plugins +vim.keymap.set('n', 'e', 'Neotree toggle right', { noremap = true, silent = true }) + +-- Other +vim.keymap.set('n', '', 'w!' , { noremap = true, silent = true }) +vim.keymap.set('n', 'q' , 'wq!', { noremap = true, silent = true }) diff --git a/config/nvim/lua/plugins.lua b/config/nvim/lua/plugins.lua index 911a4d7..7b00b1c 100644 --- a/config/nvim/lua/plugins.lua +++ b/config/nvim/lua/plugins.lua @@ -33,18 +33,18 @@ require("lazy").setup({ }) require("Comment").setup{ - padding = true, -- Add a space b/w comment and the line - sticky = true, -- Whether the cursor should stay at its position - ignore = nil, -- Lines to be ignored while (un)comment + padding = true, -- Add a space b/w comment and the line + sticky = true, -- Whether the cursor should stay at its position + ignore = nil, -- Lines to be ignored while (un)comment -- LHS of toggle mappings in NORMAL mode toggler = { - line = 'cc', --Line-comment toggle keymap - block = 'cb', -- Block-comment toggle keymap + line = 'cc', --Line-comment toggle keymap + block = 'cb', -- Block-comment toggle keymap }, -- LHS of operator-pending mappings in NORMAL and VISUAL mode opleader = { - line = 'cc', --Line-comment keymap - block = 'cb', --Block-comment keymap + line = 'cc', --Line-comment keymap + block = 'cb', --Block-comment keymap }, } @@ -72,25 +72,21 @@ require("neo-tree").setup({ } } }, - --Indent Markers default_component_configs = { indent = { + --Indent Markers with_markers = true, indent_marker = "│", last_indent_marker = "└", indent_size = 2, - }, - }, - --Expanders - default_component_configs = { - indent = { + -- Expanders with_expanders = false, --Not active expander_collapsed = ">", expander_expanded = "", expander_highlight = "NeoTreeExpander", + }, }, - }) require("nvim-autopairs").setup({ -- cgit v1.2.3 From 86e41aa7d35073f1cf675e50fa2c9f138d417f63 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 01:08:00 +0400 Subject: fix(picom): correct wintypes syntax and clean config formatting --- config/picom/picom.conf | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'config') diff --git a/config/picom/picom.conf b/config/picom/picom.conf index 58188aa..a5583a0 100644 --- a/config/picom/picom.conf +++ b/config/picom/picom.conf @@ -1,16 +1,13 @@ -# Minimal picom config - backend = "glx"; shadow = false; fading = false; - vsync = true; - wintypes: - { - tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; - dock = { shadow = false; clip-shadow-above = true; } - dnd = { shadow = false; } - popup_menu = { opacity = 0.8; } - dropdown_menu = { opacity = 0.8; } - }; +wintypes: +{ + tooltip = { shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { shadow = false; clip-shadow-above = true; }; + dnd = { shadow = false; }; + popup_menu = { opacity = 0.8; }; + dropdown_menu = { opacity = 0.8; }; +}; -- cgit v1.2.3 From db0dfe5ce621ab346046a8e144407e8b151123c9 Mon Sep 17 00:00:00 2001 From: Suleyman Farajli Date: Thu, 19 Jun 2025 01:09:11 +0400 Subject: chore(qutebrowser): clean up theme, bookmarks and startpage - Move themes in themes/ folder - Update startpage/index.html: fix height to 100vh, set font to JetBrains Mono 11px, remove unused stylesheet link - Add new themes: ayu_light and nord - Use `current_theme.py` sym-link for selection of themes --- config/qutebrowser/bookmarks/bookmarks.txt | 1 + config/qutebrowser/bookmarks/urls | 2 -- config/qutebrowser/config.py | 2 +- config/qutebrowser/current_theme.py | 1 + config/qutebrowser/gruvbox.py | 16 ---------------- config/qutebrowser/startpage/index.html | 6 +++--- config/qutebrowser/themes/ayu_light.py | 16 ++++++++++++++++ config/qutebrowser/themes/gruvbox.py | 16 ++++++++++++++++ config/qutebrowser/themes/nord.py | 16 ++++++++++++++++ 9 files changed, 54 insertions(+), 22 deletions(-) create mode 120000 config/qutebrowser/bookmarks/bookmarks.txt delete mode 100755 config/qutebrowser/bookmarks/urls create mode 120000 config/qutebrowser/current_theme.py delete mode 100644 config/qutebrowser/gruvbox.py mode change 100644 => 100755 config/qutebrowser/startpage/index.html create mode 100644 config/qutebrowser/themes/ayu_light.py create mode 100644 config/qutebrowser/themes/gruvbox.py create mode 100644 config/qutebrowser/themes/nord.py (limited to 'config') diff --git a/config/qutebrowser/bookmarks/bookmarks.txt b/config/qutebrowser/bookmarks/bookmarks.txt new file mode 120000 index 0000000..526f096 --- /dev/null +++ b/config/qutebrowser/bookmarks/bookmarks.txt @@ -0,0 +1 @@ +../../sites/bookmarks.txt \ No newline at end of file diff --git a/config/qutebrowser/bookmarks/urls b/config/qutebrowser/bookmarks/urls deleted file mode 100755 index 0711a66..0000000 --- a/config/qutebrowser/bookmarks/urls +++ /dev/null @@ -1,2 +0,0 @@ -yewtu.be -onion.tube diff --git a/config/qutebrowser/config.py b/config/qutebrowser/config.py index faaf7f2..fa84b4e 100755 --- a/config/qutebrowser/config.py +++ b/config/qutebrowser/config.py @@ -1,4 +1,4 @@ -from gruvbox import * +from current_theme import * # Text color of the completion widget. May be a single color to use for # all columns or a list of three colors, one for each column. diff --git a/config/qutebrowser/current_theme.py b/config/qutebrowser/current_theme.py new file mode 120000 index 0000000..f9e5462 --- /dev/null +++ b/config/qutebrowser/current_theme.py @@ -0,0 +1 @@ +themes/nord.py \ No newline at end of file diff --git a/config/qutebrowser/gruvbox.py b/config/qutebrowser/gruvbox.py deleted file mode 100644 index d06e346..0000000 --- a/config/qutebrowser/gruvbox.py +++ /dev/null @@ -1,16 +0,0 @@ -base00 = "#282828" -base01 = "#3c3836" -base02 = "#504945" -base03 = "#665c54" -base04 = "#bdae93" -base05 = "#d5c4a1" -base06 = "#ebdbb2" -base07 = "#fbf1c7" -base08 = "#fb4934" -base09 = "#fe8019" -base0A = "#fabd2f" -base0B = "#b8bb26" -base0C = "#8ec07c" -base0D = "#83a598" -base0E = "#d3869b" -base0F = "#d65d0e" diff --git a/config/qutebrowser/startpage/index.html b/config/qutebrowser/startpage/index.html old mode 100644 new mode 100755 index b848797..05a074f --- a/config/qutebrowser/startpage/index.html +++ b/config/qutebrowser/startpage/index.html @@ -3,14 +3,14 @@ - startpage