1
Fork 0

Initial commit

This commit is contained in:
Hadeed 2023-08-21 14:56:16 +05:00
commit da119d8b51
25 changed files with 538 additions and 0 deletions

55
bin/stow.py Executable file
View file

@ -0,0 +1,55 @@
#! /usr/bin/env python3
import os
import re
import shutil
import sys
DOTS = os.getenv("DOTS", os.getcwd())
def stow(pkg, stow_dir):
pkg_path = os.path.join(DOTS, pkg)
for root, dirs, files in os.walk(pkg_path):
files = [f for f in files if not f.startswith(".")]
dirs[:] = [d for d in dirs if not d.startswith(".")]
symlink_dir = root.replace(pkg_path, stow_dir)
if not os.path.exists(symlink_dir):
os.makedirs(symlink_dir)
for file in files:
source = os.path.join(root, file)
target = os.path.join(symlink_dir, re.sub("^dot-", ".", file))
if os.path.exists(target):
os.remove(target)
os.symlink(source, target)
def get_pkgs():
pkgs = []
if len(sys.argv) > 1:
for pkg in sys.argv[1:]:
if os.path.isdir(os.path.join(DOTS, pkg)):
pkgs.append(pkg)
else:
print(f"The package {pkg} is not a valid package.", file=sys.stderr)
else:
pkgs = [d for d in os.listdir(DOTS) if not d.startswith(".")]
return pkgs
def get_stow_dir(pkg):
return os.path.expanduser({
"home" : "~",
"bin" : "~/bin",
"config" : "~/.config"
}.get(pkg, f"~/.config/{pkg}"))
if __name__ == "__main__":
for pkg in get_pkgs():
if pkg in ["docs"]: continue
stow(pkg, get_stow_dir(pkg))

5
config/starship.toml Normal file
View file

@ -0,0 +1,5 @@
[python]
symbol=" "
[lua]
symbol=" "

15
config/user-dirs.dirs Normal file
View file

@ -0,0 +1,15 @@
# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run.
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
XDG_DESKTOP_DIR="$HOME"
XDG_DOWNLOAD_DIR="$HOME/dl"
XDG_TEMPLATES_DIR="$HOME"
XDG_PUBLICSHARE_DIR="$HOME"
XDG_DOCUMENTS_DIR="$HOME/docs"
XDG_MUSIC_DIR="$HOME"
XDG_PICTURES_DIR="$HOME/pics"
XDG_VIDEOS_DIR="$HOME"

11
docs/pacman_pkgs.txt Normal file
View file

@ -0,0 +1,11 @@
bat
exa
fd
kitty
neovim
qmk
ripgrep
starship
unclutter
xclip
zsh

23
git/config Normal file
View file

@ -0,0 +1,23 @@
[init]
defaultBranch = main
[user]
email = hadeedji@gmail.com
name = Hadeed Ahmad
[alias]
s = status -u
a = add
aa = add -A
c = commit
ca = commit --amend --no-edit
p = push
pf = push -f
ac = !git aa && git c
aca = !git aa && git ca
acp = !git ac && git p
acap = !git aca && git pf
l = log --all --decorate --oneline --graph -n 20
cfc = !git clone $(xclip -out -sel clip)
# vim: filetype=gitconfig

5
home/dot-zshenv Normal file
View file

@ -0,0 +1,5 @@
export ZDOTDIR="$HOME/.config/zsh"
[ -e "$ZDOTDIR/.zshenv" ] && . "$ZDOTDIR/.zshenv"
# vim: filetype=zsh

26
kitty/keys.conf Normal file
View file

@ -0,0 +1,26 @@
clear_all_shortcuts yes
kitty_mod ctrl+shift
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
map kitty_mod+p scroll_line_up
map kitty_mod+n scroll_line_down
map kitty_mod+u scroll_page_up
map kitty_mod+d scroll_page_down
map kitty_mod+g show_last_command_output
map kitty_mod+equal change_font_size all +1.0
map kitty_mod+minus change_font_size all -1.0
map kitty_mod+backspace change_font_size all 0
map kitty_mod+enter new_window
map kitty_mod+k next_window
map kitty_mod+j previous_window
map kitty_mod+w close_window
map kitty_mod+t new_tab
map kitty_mod+l next_tab
map kitty_mod+h previous_tab
map kitty_mod+o select_tab
map kitty_mod+q close_tab

14
kitty/kitty.conf Normal file
View file

@ -0,0 +1,14 @@
font_family JetBrains Mono
font_size 12.0
enable_audio_bell no
disable_ligatures cursor
scrollback_lines 4096
enabled_layouts tall
tab_bar_style hidden
hide_window_decorations yes
include keys.conf
include themes/gruvbox.conf

5
kitty/ssh.conf Normal file
View file

@ -0,0 +1,5 @@
env ZDOTDIR=$HOME/.config/zsh
env REMOTE_HOST=1
copy --dest .config/zsh --exclude 'dot-' $DOTS/zsh
copy --dest .config/zsh/.zshenv $DOTS/zsh/dot-zshenv
copy --dest .config/zsh/.zshrc $DOTS/zsh/dot-zshrc

29
kitty/themes/gruvbox.conf Normal file
View file

@ -0,0 +1,29 @@
foreground #ebdbb2
background #272727
selection_foreground #655b53
selection_background #ebdbb2
url_color #d65c0d
color0 #272727
color8 #928373
color1 #cc231c
color9 #fb4833
color2 #989719
color10 #b8ba25
color3 #d79920
color11 #fabc2e
color4 #448488
color12 #83a597
color5 #b16185
color13 #d3859a
color6 #689d69
color14 #8ec07b
color7 #a89983
color15 #ebdbb2

View file

@ -0,0 +1,2 @@
vim.keymap.set("i", "<C-CR>", "<CMD>x<CR>", { buffer=true })
vim.cmd('startinsert')

3
nvim/ftplugin/lua.lua Normal file
View file

@ -0,0 +1,3 @@
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2

32
nvim/init.lua Normal file
View file

@ -0,0 +1,32 @@
require("options")
require("keymaps")
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", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("plugins")
vim.filetype.add({
filename = {
["user-dirs.dirs"] = "conf",
["gruvbox.conf"] = "kitty",
["keys.conf"] = "kitty",
["kitty.conf"] = "kitty",
["dot-zshenv"] = "zsh",
["dot-zshrc"] = "zsh"
},
pattern = {
[".*/git/config"] = "gitconfig"
}
})

31
nvim/lua/keymaps.lua Normal file
View file

@ -0,0 +1,31 @@
local function swap(a, b)
vim.keymap.set("", a, b)
vim.keymap.set("", b, a)
end
swap(";", ":")
swap("'", "`")
vim.keymap.set("", "<leader>q", "<CMD>conf q<CR>")
vim.keymap.set("", "<leader>w", "<CMD>w<CR>")
vim.keymap.set("", "<leader>x", "<CMD>x<CR>")
vim.keymap.set("n", "J", "mzJ`z")
vim.keymap.set("n", "n", "nzz")
vim.keymap.set("n", "N", "Nzz")
vim.keymap.set("n", "<C-U>", "<C-U>zz")
vim.keymap.set("n", "<C-D>", "<C-D>zz")
vim.keymap.set("n", "<C-N>", "<CMD>nohls<CR>")
vim.keymap.set("n", "<leader>w", "<C-W>")
local function window_map(key, mapping)
local k = '<M-'..key..'>'
local m = '<CMD>wincmd ' .. (mapping or key) .. '<CR>'
vim.keymap.set({'n', 'i', 't'}, k, m)
end
window_map("h")
window_map("j")
window_map("k")
window_map("l")

37
nvim/lua/options.lua Normal file
View file

@ -0,0 +1,37 @@
vim.g.mapleader = " "
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
vim.opt.hidden = true
vim.opt.backup = false
vim.opt.swapfile = false
vim.opt.splitright = true
vim.opt.splitbelow = true
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.cursorline = true
vim.opt.colorcolumn = '80'
vim.opt.signcolumn = 'yes'
vim.opt.laststatus = 3
vim.opt.ignorecase = true
vim.opt.smartcase = true
vim.opt.incsearch = true
vim.opt.inccommand = 'nosplit'
vim.opt.scrolloff = 5
vim.opt.wrap = false
vim.opt.termguicolors = true
vim.opt.timeoutlen = 400
vim.opt.list = true
vim.opt.listchars = "eol:↲,tab:» ,trail:.,"
vim.opt.exrc = true

24
nvim/lua/plugins.lua Normal file
View file

@ -0,0 +1,24 @@
return {
{
"ellisonleao/gruvbox.nvim",
config = function()
vim.cmd.colorscheme("gruvbox")
end
},
{
"ggandor/leap.nvim",
config = function()
require("leap").set_default_keymaps()
vim.api.nvim_set_hl(0, 'LeapBackdrop', { link = 'Comment' })
end
},
{ "abecodes/tabout.nvim", dependencies = { "nvim-treesitter" }, config = true },
{ "numToStr/Comment.nvim", config = true },
{ "nvim-lualine/lualine.nvim", config = true },
{ "windwp/nvim-autopairs", config = true },
"fladson/vim-kitty"
}

View file

@ -0,0 +1,34 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-nvim-lua",
"hrsh7th/cmp-path"
},
config = function()
local cmp = require("cmp")
cmp.setup {
mapping = cmp.mapping.preset.insert {
["<C-K>"] = function(fallback)
if cmp.visible() then
cmp.confirm { select=true }
else
fallback()
end
end
},
sources = {
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "buffer" },
{ name = "path" }
},
experimental = {
native_menu = false,
ghost_text = { hl_group = "Comment" }
}
}
end
}

View file

@ -0,0 +1,56 @@
return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"kyazdani42/nvim-web-devicons",
"nvim-telescope/telescope-file-browser.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" }
},
config = function()
local telescope = require("telescope")
local fb_actions = require("telescope").extensions.file_browser.actions
telescope.setup({
pickers = {
man_pages = {
sections = {"ALL"}
}
},
extensions = {
file_browser = {
grouped = true,
hide_parent_dir = true,
hijack_netrw = true,
initial_mode = "normal",
respect_gitignore = "false",
sorting_strategy = "ascending",
layout_config = {
prompt_position = "top"
},
mappings = {
n = {
["h"] = fb_actions.goto_parent_dir,
["l"] = "select_default",
["g"] = fb_actions.toggle_hidden
}
}
}
}
})
telescope.load_extension("file_browser")
telescope.load_extension("fzf")
local builtin = require("telescope.builtin")
vim.keymap.set("", "<leader>tf", builtin.find_files)
vim.keymap.set("", "<leader>th", builtin.help_tags)
vim.keymap.set("", "<leader>tr", builtin.buffers)
vim.keymap.set("", "<leader>ts", telescope.extensions.file_browser.file_browser)
vim.keymap.set("", "<leader>tt", builtin.builtin)
vim.keymap.set("", "<leader>tc", function() builtin.find_files({
cwd = "$DOTS",
prompt_title = "< Dotfiles >"
}) end)
end,
}

View file

@ -0,0 +1,14 @@
return {
"akinsho/toggleterm.nvim",
opts = {
open_mapping = "<C-t>",
direction = "float",
size = function(term)
if term.direction == "vertical" then
return 80
else
return 12
end
end
}
}

View file

@ -0,0 +1,15 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = {
ensure_installed = "all",
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
indent = {
enable = true
}
},
main = "nvim-treesitter.configs",
build = ":TSUpdate"
}

9
zsh/dot-zshenv Normal file
View file

@ -0,0 +1,9 @@
typeset -U path
path+="$HOME/bin"
export DOTS="$HOME/repos/dots"
export VISUAL="nvim"
export EDITOR="nvim"
# vim: filetype=zsh

26
zsh/dot-zshrc Normal file
View file

@ -0,0 +1,26 @@
function create_dir() [ ! -d "$1" ] && mkdir -p "$1"
function safe_source() [ -f "$1" ] && source "$1"
function zsh_add_file() safe_source "$ZDOTDIR/$1"
zsh_add_file "zsh-aliases"
zsh_add_file "zsh-functions"
zsh_add_file "zsh-options"
zsh_add_plugin "Aloxaf/fzf-tab"
zsh_add_plugin "ahmubashshir/zinsults"
zsh_add_plugin "zdharma-continuum/fast-syntax-highlighting"
zsh_add_plugin "zsh-users/zsh-autosuggestions"
zsh_add_plugin "zsh-users/zsh-completions"
create_dir "$HOME/.cache/zsh"
autoload -Uz compinit && compinit -d "$HOME/.cache/zsh/zcompdump"
zmodload zsh/complist
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
autoload -z edit-command-line
zle -N edit-command-line
bindkey "^V" edit-command-line
bindkey '^K' autosuggest-execute
# vim: filetype=zsh

21
zsh/zsh-aliases Normal file
View file

@ -0,0 +1,21 @@
alias p='sudo pacman -S'
alias pu='sudo pacman -Syu'
alias vi='nvim'
alias vif='nvim +"norm 1 tf" +startinsert'
alias vic='nvim +"norm 1 tc" +startinsert'
alias l='exa -x --group-directories-first --icons'
alias ll='l -lbh --git --no-time'
alias lt='ll --tree'
alias la='l -a'
alias lla='ll -a'
alias lta='lt -a --ignore-glob=".git"'
alias cc='noglob cc'
alias wcl='wc -l'
alias s='kitty +kitten ssh'
# vim: filetype=zsh

19
zsh/zsh-functions Normal file
View file

@ -0,0 +1,19 @@
function zsh_add_plugin() {
PLUGIN_NAME=$(echo $1 | cut -d "/" -f 2)
[ ! -d "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME" ] &&
git clone "https://github.com/$1.git" "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME"
safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.plugin.zsh"
safe_source "$HOME/.local/share/zsh/plugins/$PLUGIN_NAME/$PLUGIN_NAME.zsh"
}
function cc() python -c "from math import *; print($*)"
function mkcd() mkdir -p -- $1 && cd -- $1
function serve() {
gem list -i '^webrick$' > /dev/null || gem install webrick
ruby -run -e httpd . -p 3000
}
# vim: filetype=zsh

27
zsh/zsh-options Normal file
View file

@ -0,0 +1,27 @@
create_dir "$HOME/.local/state/zsh"
HISTFILE="$HOME/.local/state/zsh/history"
HISTSIZE=65536
SAVEHIST=$HISTSIZE
setopt AUTO_CD
setopt HIST_IGNORE_DUPS
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt RM_STAR_SILENT
setopt NO_BEEP
stty stop undef
zle_highlight=("paste:none")
if command -v starship &> /dev/null; then
eval "$(starship init zsh)"
else
[ ! -d "$HOME/.local/share/zsh/plugins/pure" ] &&
git clone "https://github.com/sindresorhus/pure" "$HOME/.local/share/zsh/plugins/pure"
fpath+="$HOME/.local/share/zsh/plugins/pure"
safe_source "$HOME/.local/share/zsh/plugins/pure/pure.zsh"
fi
# vim: filetype=zsh