initial commit

This commit is contained in:
bain 2023-08-26 14:19:53 +02:00
commit b97c8620eb
Signed by: bain
GPG key ID: 31F0F25E3BED0B9B
11 changed files with 309 additions and 0 deletions

16
README Executable file
View file

@ -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

1
lvim.README Normal file
View file

@ -0,0 +1 @@
install: https://www.lunarvim.org/docs/installation

View file

@ -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('', '<M-h>', '<cmd>TmuxNavigateLeft<cr>')
vim.keymap.set('', '<M-j>', '<cmd>TmuxNavigateDown<cr>')
vim.keymap.set('', '<M-k>', '<cmd>TmuxNavigateUp<cr>')
vim.keymap.set('', '<M-l>', '<cmd>TmuxNavigateRight<cr>')
end,
},
}
-- }}}
-- appearance
lvim.colorscheme = "tokyodark"
lvim.format_on_save = false
vim.o.foldmethod = "marker"
-- vertial movement
vim.keymap.set('n', '<C-j>', '10j', { noremap = true })
vim.keymap.set('n', '<C-k>', '10k', { noremap = true })
-- cycle buffers
lvim.keys.normal_mode["H"] = "<cmd>bprevious<cr>"
lvim.keys.normal_mode["L"] = "<cmd>bnext<cr>"
lvim.keys.normal_mode["T"] = "<cmd>!make<cr>"
lvim.builtin.which_key.mappings["lR"] = { "<cmd>LspRestart<cr>", "Restart LSP" }
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.keymap.set("n", "<leader>fml", "<cmd>CellularAutomaton make_it_rain<CR>")
-- 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

1
nvim.README Normal file
View file

@ -0,0 +1 @@
required: nvim git (nerd font)

View file

@ -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('', '<M-h>', ':<C-U>TmuxNavigateLeft<cr>')
vim.keymap.set('', '<M-j>', ':<C-U>TmuxNavigateDown<cr>')
vim.keymap.set('', '<M-k>', ':<C-U>TmuxNavigateUp<cr>')
vim.keymap.set('', '<M-l>', ':<C-U>TmuxNavigateRight<cr>')
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('', '<C-j>', '10j')
vim.keymap.set('', '<C-k>', '10k')
-- tabs
vim.opt.expandtab = true
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
-- buffers
vim.keymap.set('', 'H', '<cmd>bprevious<cr>');
vim.keymap.set('', 'L', '<cmd>bnext<cr>');
-- disable modeline
vim.opt.modeline = false

View file

@ -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" }
}

1
tmux.README Normal file
View file

@ -0,0 +1 @@
required: tmux, tpm (https://github.com/tmux-plugins/tpm#installation)

View file

@ -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'

1
zsh.README Normal file
View file

@ -0,0 +1 @@
required: zsh, oh-my-zsh (https://ohmyz.sh/)

3
zsh/.zprofile Normal file
View file

@ -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}"

55
zsh/.zshrc Normal file
View file

@ -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"