commit b97c8620ebfc0f7b313b06d1f7ae97ce07e886d6 Author: bain Date: Sat Aug 26 14:19:53 2023 +0200 initial commit diff --git a/README b/README new file mode 100755 index 0000000..de280f5 --- /dev/null +++ b/README @@ -0,0 +1,16 @@ +#!/bin/sh + +# To install configuration, run this file with a directory name of the config +# example: ./README zsh # installs zsh config + +if ! command -v stow > /dev/null; then + printf 'missing "stow" dependency\n' +fi + +[ -e "$1" ] && stow "$1" || echo "package \"$1\" not found" + +if [ -e "$1.README" ]; then + printf '%s.README\n======\n' "$1" + cat "$1.README" + printf '\n' +fi diff --git a/lvim.README b/lvim.README new file mode 100644 index 0000000..17e1c54 --- /dev/null +++ b/lvim.README @@ -0,0 +1 @@ +install: https://www.lunarvim.org/docs/installation diff --git a/lvim/.config/lvim/config.lua b/lvim/.config/lvim/config.lua new file mode 100644 index 0000000..65b06fa --- /dev/null +++ b/lvim/.config/lvim/config.lua @@ -0,0 +1,84 @@ +lvim.leader = "space" + +-- {{{ Plugins +lvim.plugins = { + { + "andweeb/presence.nvim", + opts = { + main_image = "file", + blacklist = { "bccp" } + }, + config = true, + }, + { + "tiagovla/tokyodark.nvim", + lazy = false, + opts = { + transparent_background = true, + }, + config = true, + }, + { "eandrju/cellular-automaton.nvim" }, + { + 'christoomey/vim-tmux-navigator', + config = function () + vim.g.tmux_navigator_no_mappings = 1 + vim.keymap.set('', '', 'TmuxNavigateLeft') + vim.keymap.set('', '', 'TmuxNavigateDown') + vim.keymap.set('', '', 'TmuxNavigateUp') + vim.keymap.set('', '', 'TmuxNavigateRight') + end, + }, +} +-- }}} + +-- appearance +lvim.colorscheme = "tokyodark" + +lvim.format_on_save = false + +vim.o.foldmethod = "marker" + +-- vertial movement +vim.keymap.set('n', '', '10j', { noremap = true }) +vim.keymap.set('n', '', '10k', { noremap = true }) + +-- cycle buffers +lvim.keys.normal_mode["H"] = "bprevious" +lvim.keys.normal_mode["L"] = "bnext" + +lvim.keys.normal_mode["T"] = "!make" +lvim.builtin.which_key.mappings["lR"] = { "LspRestart", "Restart LSP" } + +vim.opt.expandtab = true +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 + + +vim.keymap.set("n", "fml", "CellularAutomaton make_it_rain") + +-- null-ls +require("lvim.lsp.null-ls.formatters").setup { + { exe = "black", filetypes = { "python" } } +} + +lvim.builtin.terminal.active = false + +lvim.builtin.treesitter.ensure_installed = { + "bash", + "c", + "javascript", + "json", + "lua", + "typescript", + "tsx", + "css", + "rust", + "java", + "yaml", + "python" +} + + +-- lvim.builtin.treesitter.ignore_install = { "haskell", "jsdoc", "comment" } +-- lvim.builtin.treesitter.highlight.enabled = true diff --git a/nvim.README b/nvim.README new file mode 100644 index 0000000..6eb350a --- /dev/null +++ b/nvim.README @@ -0,0 +1 @@ +required: nvim git (nerd font) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua new file mode 100644 index 0000000..af84cf9 --- /dev/null +++ b/nvim/.config/nvim/init.lua @@ -0,0 +1,81 @@ +vim.g.mapleader = " " + +-- {{{ Plugins +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({ + { + 'christoomey/vim-tmux-navigator', + config = function () + vim.g.tmux_navigator_no_mappings = 1 + vim.keymap.set('', '', ':TmuxNavigateLeft') + vim.keymap.set('', '', ':TmuxNavigateDown') + vim.keymap.set('', '', ':TmuxNavigateUp') + vim.keymap.set('', '', ':TmuxNavigateRight') + end, + }, + { + 'nvim-treesitter/nvim-treesitter', + build = ':TSUpdate', + opts = { + ensure_installed = { "lua", "javascript", "html", "python" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }, + config = function (_, opts) + require("nvim-treesitter.configs").setup(opts); + end, + }, + { + "tiagovla/tokyodark.nvim", + opts = { + transparent_background = true, + }, + config = function(_, opts) + require("tokyodark").setup(opts) + vim.cmd [[colorscheme tokyodark]] + end, + }, + { + "nvim-lualine/lualine.nvim", + opts = { + options = { + section_separators = '', + }, + }, + config = true, + }, + { "nvim-tree/nvim-web-devicons", lazy = true }, +}) +-- }}} + +-- folding +vim.opt.foldmethod = "marker" + +-- quick vertical movement +vim.keymap.set('', '', '10j') +vim.keymap.set('', '', '10k') + +-- tabs +vim.opt.expandtab = true +vim.opt.tabstop = 4 +vim.opt.shiftwidth = 4 + +-- buffers +vim.keymap.set('', 'H', 'bprevious'); +vim.keymap.set('', 'L', 'bnext'); + +-- disable modeline +vim.opt.modeline = false diff --git a/nvim/.config/nvim/lazy-lock.json b/nvim/.config/nvim/lazy-lock.json new file mode 100644 index 0000000..2bed539 --- /dev/null +++ b/nvim/.config/nvim/lazy-lock.json @@ -0,0 +1,8 @@ +{ + "lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" }, + "lualine.nvim": { "branch": "master", "commit": "45e27ca739c7be6c49e5496d14fcf45a303c3a63" }, + "nvim-treesitter": { "branch": "master", "commit": "cb74c1c5aefd8b903f1b547d08d4df42be07aa2a" }, + "nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" }, + "tokyodark.nvim": { "branch": "master", "commit": "4bfb42924274abc5de9f5f4779075b77c6112c85" }, + "vim-tmux-navigator": { "branch": "master", "commit": "addb64a772cb4a3ae1f1363583012b2cada2cd66" } +} \ No newline at end of file diff --git a/tmux.README b/tmux.README new file mode 100644 index 0000000..dc1e568 --- /dev/null +++ b/tmux.README @@ -0,0 +1 @@ +required: tmux, tpm (https://github.com/tmux-plugins/tpm#installation) diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf new file mode 100644 index 0000000..f4c76c8 --- /dev/null +++ b/tmux/.config/tmux/tmux.conf @@ -0,0 +1,58 @@ +set-option -sa terminal-overrides ",xterm*:Tc" +set -g mouse on + +# Prefix +unbind C-b +set -g prefix C-space +bind C-Space send-prefix + +# Shift Alt to switch windows +bind -n M-H previous-window +bind -n M-L next-window + +# Czech keyboard split remaps +bind = split-window -h +bind ů split-window -v + +# Start windows and panes at 1, not 0 +set -g base-index 1 +set -g pane-base-index 1 +set-window-option -g pane-base-index 1 +set-option -g renumber-windows on + +# vi-mode +set-window-option -g mode-keys vi +bind-key -T copy-mode-vi v send-keys -X begin-selection +bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle +bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel + +# Theme +set -g @catppuccin_flavour "mocha" +set -g @catppuccin_status_modules "-" + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'" +bind-key -n 'M-h' if-shell "$is_vim" 'send-keys M-h' 'select-pane -L' +bind-key -n 'M-j' if-shell "$is_vim" 'send-keys M-j' 'select-pane -D' +bind-key -n 'M-k' if-shell "$is_vim" 'send-keys M-k' 'select-pane -U' +bind-key -n 'M-l' if-shell "$is_vim" 'send-keys M-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" +bind-key -T copy-mode-vi 'M-h' select-pane -L +bind-key -T copy-mode-vi 'M-j' select-pane -D +bind-key -T copy-mode-vi 'M-k' select-pane -U +bind-key -T copy-mode-vi 'M-l' select-pane -R +bind-key -T copy-mode-vi 'M-\' select-pane -l + +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-yank' +set -g @plugin 'catppuccin/tmux' + +set-environment -g TMUX_PLUGIN_MANAGER_PATH '~/.local/share/tmux/plugins/' +run '~/.local/share/tmux/plugins/tpm/tpm' diff --git a/zsh.README b/zsh.README new file mode 100644 index 0000000..f8ade1a --- /dev/null +++ b/zsh.README @@ -0,0 +1 @@ +required: zsh, oh-my-zsh (https://ohmyz.sh/) diff --git a/zsh/.zprofile b/zsh/.zprofile new file mode 100644 index 0000000..a73d8ad --- /dev/null +++ b/zsh/.zprofile @@ -0,0 +1,3 @@ +export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}" +export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" +export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}" diff --git a/zsh/.zshrc b/zsh/.zshrc new file mode 100644 index 0000000..6c625c9 --- /dev/null +++ b/zsh/.zshrc @@ -0,0 +1,55 @@ +export ZSH="/home/bain/.oh-my-zsh" + +ZSH_THEME="cypher" + +plugins=(git pass) + +source $ZSH/oh-my-zsh.sh + +alias vim="nvim" +alias py="python" +export EDITOR="/usr/bin/nvim" +export VISUAL="/usr/bin/nvim" +alias activate-venv="source venv/bin/activate" +alias rootvenv="source ~/.venv/bin/activate" +alias glvim="lvim -c 'set autoindent noexpandtab tabstop=4 shiftwidth=4'" +alias showkey="ssh-keygen -y -f" + +ffmpeg_compat() { + OUT=$2 + ffmpeg -i "$1" \ + -c:v libx264 -crf 23 -profile:v baseline -level 3.0 -pix_fmt yuv420p \ + -c:a aac -ac 2 -b:a 128k \ + -movflags faststart \ + "${OUT:-$1.mp4}" +} + +on_edit() { + echo "Running:" + echo " $ $2" + echo "on all edits in \"$1\"" + inotifywait -r -m fe -e CREATE -e CLOSE_WRITE -e DELETE -e MOVE $1 \ + | while read dir action file; do echo "$dir $action $file"; $2; done +} + +devenv() { + source .devenv.sh && devenv_$1 +} + +mail_block() { + [ -z "$1" ] && { echo "mail_block add/del email"; return 1; } + ssh virtual docker exec mailserver setup email restrict $1 receive $2 +} + +ipinfo() { + curl "ipinfo.io/$1?token=b43643f2a3c722"; +} + +certinfo() { + echo | \ + openssl s_client -servername $1 -connect $1:443 2>/dev/null | \ + openssl x509 -subject -issuer -nameopt multiline -noout +} + +alias yay="GNUPGHOME=$HOME/.gnupg-yay yay" +alias md2fancyhtml="py -m markdown -x fenced_code -x codehilite"