From 276cf5dacfd4173cbb15e05461f4323cdc85ecd9 Mon Sep 17 00:00:00 2001 From: Petr Nyc Date: Fri, 10 Feb 2023 09:11:59 +0100 Subject: [PATCH] vim, tmux, zsh and git config files --- .gitconfig | 22 +++++++++ .gitignore | 52 -------------------- .tmux.conf | 70 ++++++++++++++++++++++++++ .vimrc | 78 +++++++++++++++++++++++++++++ .zshenv | 65 ++++++++++++++++++++++++ .zshrc | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 376 insertions(+), 52 deletions(-) create mode 100644 .gitconfig create mode 100644 .tmux.conf create mode 100644 .vimrc create mode 100644 .zshenv create mode 100644 .zshrc diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..849920a --- /dev/null +++ b/.gitconfig @@ -0,0 +1,22 @@ +[diff] + tool = vimdiff + +[core] + pager = less -FRX +[alias] + glog = log --graph + ci = commit + st = status + sglog = log --oneline --decorate --graph --all + co = checkout + out = log --branches --not --remotes +[user] + name = Petr Nyc + email = jet.jetpac@gmail.com + +[merge] + tool = vimdiff + +[user] + email = jet.jetpac@gmail.com + name = Petr Nyc diff --git a/.gitignore b/.gitignore index 20d1911..e7f0915 100644 --- a/.gitignore +++ b/.gitignore @@ -6,58 +6,6 @@ .hgsubstate .hgtags -# ---> JENKINS_HOME -# Learn more about Jenkins and JENKINS_HOME directory for which this file is -# intended. -# -# http://jenkins-ci.org/ -# https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins -# -# Note: secret.key is purposefully not tracked by git. This should be backed up -# separately because configs may contain secrets which were encrypted using the -# secret.key. To back up secrets use 'tar -czf /tmp/secrets.tgz secret*' and -# save the file separate from your repository. If you want secrets backed up -# with configuration, then see the bottom of this file for an example. - -# Ignore all JENKINS_HOME except jobs directory, root xml config, and -# .gitignore file. -/* -!/jobs -!/.gitignore -!/*.xml - -# Ignore all files in jobs subdirectories except for folders. -# Note: git doesn't track folders, only file content. -jobs/** -!jobs/**/ - -# Uncomment the following line to save next build numbers with config. - -#!jobs/**/nextBuildNumber - -# For performance reasons, we want to ignore builds in Jenkins jobs because it -# contains many tiny files on large installations. This can impact git -# performance when running even basic commands like 'git status'. -builds -indexing - -# Exclude only config.xml files in repository subdirectories. -!config.xml - -# Don't track workspaces (when users build on the master). -jobs/**/*workspace - -# Security warning: If secrets are included with your configuration, then an -# adversary will be able to decrypt all encrypted secrets within Jenkins -# config. Including secrets is a bad practice, but the example is included in -# case someone still wants it for convenience. Uncomment the following line to -# include secrets for decryption with repository configuration in Git. - -#!/secret* - -# As a result, only Jenkins settings and job config.xml files in JENKINS_HOME -# will be tracked by git. - # ---> Python # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..deef8a5 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,70 @@ +# List of plugins +set -g @plugin 'tmux-plugins/tpm' +set -g @plugin 'tmux-plugins/tmux-sensible' +set -g @plugin 'tmux-plugins/tmux-sidebar' +set -g @plugin 'tmux-plugins/tmux-pain-control' + +set -g @plugin 'tmux-plugins/tmux-logging' + +set -g @plugin 'tmux-plugins/tmux-copycat' + + +# https://github.com/tmux-plugins/tmux-resurrect +set -g @plugin 'tmux-plugins/tmux-resurrect' +set -g @resurrect-capture-pane-contents 'on' +set -g @resurrect-processes 'ssh neomutt mbsync' +# https://github.com/tmux-plugins/tmux-continuum +set -g @plugin 'tmux-plugins/tmux-continuum' + +set -g @plugin 'seebi/tmux-colors-solarized' + +# too wild, some shortcuts like meta-tab/meta-number are nice though +# set -g @plugin 'ek9/tmux-vim-bindings' + +# set -g @colors-solarized '256' +# set -g @colors-solarized 'light' +set -g @colors-solarized 'dark' + + +# Change prefix to C-a +# C-a hex value: 0x01 +set -g prefix C-a +unbind C-b +bind C-a send-prefix + +# vi copy mode +set -g mode-keys vi +bind Escape copy-mode +unbind p +bind p paste-buffer +bind-key -T copy-mode-vi 'v' send-keys -X begin-selection +bind-key -T copy-mode-vi 'y' send-keys -X copy-selection +bind-key -T copy-mode-vi 'c-v' send-keys -X rectangle-toggle + +# bind-key -n is a shortcut for -T root (table for keys without prefix) +bind-key -n M-1 select-window -t 1 +bind-key -n M-2 select-window -t 2 +bind-key -n M-3 select-window -t 3 +bind-key -n M-4 select-window -t 4 +bind-key -n M-5 select-window -t 5 +bind-key -n M-6 select-window -t 6 +bind-key -n M-7 select-window -t 7 +bind-key -n M-8 select-window -t 8 +bind-key -n M-9 select-window -t 9 +bind-key -n M-0 select-window -t 10 +bind-key -n M-- last-window + +# Number windows and panes starting at 1 so that we can jump to +# them easier. +set -g base-index 1 +set -g pane-base-index 1 + +# Other examples: +# set -g @plugin 'github_username/plugin_name' +# set -g @plugin 'git@github.com:user/plugin' +# set -g @plugin 'git@bitbucket.com:user/plugin' + + +# tpm install: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm +# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf) +run '~/.tmux/plugins/tpm/tpm' diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..fe4449e --- /dev/null +++ b/.vimrc @@ -0,0 +1,78 @@ +" going with vim-plug; has parallel downloading and probably more mature + +" install vim plug: +" curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim + +" The default plugin directory will be as follows: +" " - Vim (Linux/macOS): '~/.vim/plugged' +" " - Vim (Windows): '~/vimfiles/plugged' +" " - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged' +" " You can specify a custom plugin directory by passing it as the argument +" " - e.g. `call plug#begin('~/.vim/plugged')` +" " - Avoid using standard Vim directory names like 'plugin' +" +" " Make sure you use single quotes +" +" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align + +call plug#begin() + +Plug 'tpope/vim-sensible' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-surround' " https://github.com/tpope/vim-surround +Plug 'pedrohdz/vim-yaml-folds' +Plug 'vim-syntastic/syntastic' +Plug 'vim-scripts/vcscommand.vim' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'bling/vim-bufferline' + +" testing +Plug 'tpope/vim-characterize' +Plug 'tpope/vim-endwise' +Plug 'github/copilot.vim' + +call plug#end() + +let g:airline_solarized_bg='dark' +let g:airline_theme='solarized' + +" let g:syntastic__checkers = [''] +let g:syntastic_yaml_checkers = ['yamllint'] + +" " syntastic settings +" set statusline+=%#warningmsg# +" set statusline+=%{SyntasticStatuslineFlag()} +" set statusline+=%* + +" let g:syntastic_always_populate_loc_list = 1 +" let g:syntastic_auto_loc_list = 1 +" let g:syntastic_check_on_open = 1 +" let g:syntastic_check_on_wq = 0 +" let g:pymode_options_max_line_length=120 +" " https://vi.stackexchange.com/questions/10007/how-to-make-syntastic-include-sourced-files-for-bash-syntax-as-shellcheck-x +" let g:syntastic_sh_shellcheck_args = "-x" + +" let g:syntastic_mode_map = { +" \ "mode": "active", +" \ "active_filetypes": [], +" \ "passive_filetypes": ["sh, yaml"] } + +set modeline +set modelines=5 + +set statusline+=%#warningmsg# +set statusline+=%{SyntasticStatuslineFlag()} +set statusline+=%* + +let g:syntastic_always_populate_loc_list = 1 +let g:syntastic_auto_loc_list = 1 +let g:syntastic_check_on_open = 1 +let g:syntastic_check_on_wq = 0 + + + +" copilot config +imap (copilot-next) +imap (copilot-previous) +imap (copilot-dismiss) diff --git a/.zshenv b/.zshenv new file mode 100644 index 0000000..0ec6bee --- /dev/null +++ b/.zshenv @@ -0,0 +1,65 @@ +set -o vi + +export LC_ALL=en_US.UTF-8 + +export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jetpac/work/flutter/bin:$HOME/.rd/bin + +alias oe='open /Applications/Emacs.app' +alias config='/usr/bin/git --git-dir=$HOME/.cfg/.git/ --work-tree=$HOME' +alias -g N="2>&1 " +# export PATH=$HOME/.rd/bin + + +# for gems installed in my home direcotry +# inspiration: https://guides.cocoapods.org/using/getting-started.html#installation +export GEM_HOME=$HOME/.gem +export PATH=$GEM_HOME/bin:$PATH + + +# change iTerm & tmux profile +# doc: +# https://iterm2.com/documentation-escape-codes.html +# https://github.com/tmux/tmux/issues/1502 + +## change color profile in iTerm +##it2prof() { echo -e "\033]50;SetProfile=$1\a" } + +function print_osc() { + if [[ -n $TMUX ]] ; then + printf '\033Ptmux;\033\033]'; + else printf '\033]'; fi +} + +function print_st() { + if [[ -n $TMUX ]] ; then + printf '\a\033\\' + else printf '\a'; fi +} + +function set_iterm_profile() { + readonly profile=${1:?"The port must be specified."} + print_osc + printf "1337;SetProfile=$profile" + print_st +} + +function set_tmux_profile() { + if [[ -n $TMUX ]]; then + profile=${1:?"The port must be specified."} + tmux source-file $HOME/.tmux/plugins/tmux-colors-solarized/tmuxcolors-${profile}.conf + fi +} + +function set_dark() { + set_iterm_profile 'Dark' + set_tmux_profile 'dark' +} + +function set_light() { + set_iterm_profile 'Light' + set_tmux_profile 'light' +} + +export seznam6='2a02:598:2::1222' + +export OPENAI_API_KEY='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' diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..bbd2f3e --- /dev/null +++ b/.zshrc @@ -0,0 +1,141 @@ +# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc. +# Initialization code that may require console input (password prompts, [y/n] +# confirmations, etc.) must go above this block; everything else may go below. +if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then + source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" +fi + +# doesn't work well on remote hosts +# [[ -f .iterm2_shell_integration.zsh ]] && source .iterm2_shell_integration.zsh + +# If you come from bash you might have to change your $PATH. +# export PATH=$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="$HOME/.oh-my-zsh" + +# Set name of the theme to load --- if set to "random", it will +# load a random theme each time oh-my-zsh is loaded, in which case, +# to know which specific one was loaded, run: echo $RANDOM_THEME +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes + +ZSH_THEME="powerlevel10k/powerlevel10k" + +# Set list of themes to pick from when loading at random +# Setting this variable when ZSH_THEME=random will cause zsh to load +# a theme from this variable instead of looking in $ZSH/themes/ +# If set to an empty array, this variable will have no effect. +# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) + +# Uncomment the following line to use case-sensitive completion. +# CASE_SENSITIVE="true" + +# Uncomment the following line to use hyphen-insensitive completion. +# Case-sensitive completion must be off. _ and - will be interchangeable. +# HYPHEN_INSENSITIVE="true" + +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +# zstyle ':omz:update' mode reminder # just remind me to update when it's time + +# Uncomment the following line to change how often to auto-update (in days). +# zstyle ':omz:update' frequency 13 + +# Uncomment the following line if pasting URLs and other text is messed up. +# DISABLE_MAGIC_FUNCTIONS="true" + +# Uncomment the following line to disable colors in ls. +# DISABLE_LS_COLORS="true" + +# Uncomment the following line to disable auto-setting terminal title. +# DISABLE_AUTO_TITLE="true" + +# Uncomment the following line to enable command auto-correction. +# ENABLE_CORRECTION="true" + +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +# COMPLETION_WAITING_DOTS="true" + +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" + +# Uncomment the following line if you want to change the command execution time +# stamp shown in the history command output. +# You can set one of the optional three formats: +# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" +# or set a custom format using the strftime function format specifications, +# see 'man strftime' for details. +# HIST_STAMPS="mm/dd/yyyy" + +# Would you like to use another custom folder than $ZSH/custom? +# ZSH_CUSTOM=/path/to/new-custom-folder + +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(git rsync colorize colored-man-pages vi-mode common-aliases macos themes dircycle iterm2 docker docker-compose zsh-navigation-tools urltools history mercurial tmux ) +# colorize - adds ccat and cless +# common-aliases: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/common-aliases +# themes: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/themes +# dircycle: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dircycle +# ctrl+shift+(left|right) - traverses cd history +# plugins=(git rsync colorize colored-man-pages vi-mode common-aliases macos themes dircycle iterm2 docker docker-compose zsh-navigation-tools) + +# zsh-navigation-tools: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/zsh-navigation-tools +# nkill, nhistory, ncd aliases + +source $ZSH/oh-my-zsh.sh + +# User configuration + +# export MANPATH="/usr/local/man:$MANPATH" + +# You may need to manually set your language environment +# export LANG=en_US.UTF-8 + +# Preferred editor for local and remote sessions +# if [[ -n $SSH_CONNECTION ]]; then +# export EDITOR='vim' +# else +# export EDITOR='mvim' +# fi + +# Compilation flags +# export ARCHFLAGS="-arch x86_64" + +# Set personal aliases, overriding those provided by oh-my-zsh libs, +# plugins, and themes. Aliases can be placed here, though oh-my-zsh +# users are encouraged to define aliases within the ZSH_CUSTOM folder. +# For a full list of active aliases, run `alias`. +# +# Example aliases +# alias zshconfig="mate ~/.zshrc" +# alias ohmyzsh="mate ~/.oh-my-zsh" + +# common aliases defines rm -i - that drives me nuts +unalias rm + +# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh. +[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh +# test -e /Users/jetpac/.iterm2_shell_integration.zsh && source /Users/jetpac/.iterm2_shell_integration.zsh || true + +# +# zsh history is too short +# - https://unix.stackexchange.com/questions/273861/unlimited-history-in-zsh + +HISTFILE=~/.zsh_history +HISTSIZE=999999999 +SAVEHIST=$HISTSIZE + + +### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT) +export PATH="/Users/jetpac/.rd/bin:$PATH" +### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)