aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Tay <nkt@outlook.kr>2021-04-09 18:00:27 +1000
committerNicholas Tay <nkt@outlook.kr>2021-04-09 18:00:27 +1000
commit42506d1606fea81a67530a0ff6ed93ec816a1594 (patch)
treec18e9ea4ca28035e680b206d0386ffcad8c2e1f4
downloaddotlite-42506d1606fea81a67530a0ff6ed93ec816a1594.tar.gz
dotlite-42506d1606fea81a67530a0ff6ed93ec816a1594.tar.bz2
dotlite-42506d1606fea81a67530a0ff6ed93ec816a1594.zip
Initial lite config
-rw-r--r--.bash_profile5
-rw-r--r--.bashrc18
-rw-r--r--.config/aliasrc61
-rw-r--r--.config/git/config18
-rw-r--r--.config/nvim/init.vim47
-rw-r--r--.gitignore19
-rw-r--r--.profile19
-rw-r--r--.zshrc130
-rw-r--r--README.md18
9 files changed, 335 insertions, 0 deletions
diff --git a/.bash_profile b/.bash_profile
new file mode 100644
index 0000000..9df1d19
--- /dev/null
+++ b/.bash_profile
@@ -0,0 +1,5 @@
+# Nick's light .bash_profile
+# Load generic profile + bashrc
+
+[ -f ~/.profile ] && . ~/.profile
+[ -f ~/.bashrc ] && . ~/.bashrc
diff --git a/.bashrc b/.bashrc
new file mode 100644
index 0000000..1678c21
--- /dev/null
+++ b/.bashrc
@@ -0,0 +1,18 @@
+# Nick's light .bashrc
+# Basically the same as the full version (light already)
+
+# If not running interactively, don't do anything
+[[ $- != *i* ]] && return
+
+# Our prompt (user@computer: >>)
+PS1="\[\033[38;5;14m\]\u\[$(tput sgr0)\]\[\033[38;5;243m\]@\[$(tput sgr0)\]\[\033[38;5;194m\]\h\[$(tput sgr0)\]\[\033[38;5;243m\]:\[$(tput sgr0)\]\[\033[38;5;15m\]\w \[$(tput sgr0)\]"
+
+[ ! -z "$SSH_CLIENT" ] && PS1="(SSH) $PS1"
+
+export HISTFILE="$HOME/.local/share/bash_history"
+
+# cd by name only is ok
+shopt -s autocd
+
+# Load our aliases
+[ -f $HOME/.config/aliasrc ] && . $HOME/.config/aliasrc
diff --git a/.config/aliasrc b/.config/aliasrc
new file mode 100644
index 0000000..822d6d5
--- /dev/null
+++ b/.config/aliasrc
@@ -0,0 +1,61 @@
+# Nick's light shell aliases
+
+# General utility
+command -v doas >/dev/null \
+ && alias sudo="doas " \
+ || alias sudo="sudo "
+alias cp="cp -iv"
+alias mv="mv -iv"
+
+# Utility colours
+alias ls="ls --color=auto --group-directories-first"
+alias grep="grep --color=auto"
+alias diff="diff --color=auto"
+
+# dotfiles management
+alias d="git --git-dir=$HOME/.dotlite.git --work-tree=$HOME"
+
+# Shortcuts
+alias v="$EDITOR"
+alias vi="$EDITOR"
+alias vim="$EDITOR"
+alias e="$FILE"
+alias r="ranger"
+alias g="git"
+alias o="xdg-open"
+
+# Utility quick commands
+alias mem="ps axch -o cmd:15,%mem --sort=-%mem | sed 10q"
+alias cpu="ps axch -o cmd:15,%cpu --sort=-%cpu | sed 10q"
+alias rcp="rsync -vzrh --times --stats --progress --itemize-changes"
+
+# Arch
+# pacman
+alias p="sudo pacman"
+alias pS="sudo pacman -S"
+alias pR="sudo pacman -R"
+alias pU="sudo pacman -Syu"
+alias pQ="pacman -Q"
+# yay (AUR)
+alias y="yay"
+alias yS="yay -S"
+alias yR="yay -R"
+alias yU="yay -Syu"
+
+# Fedora
+alias dI="sudo dnf install"
+alias dR="sudo dnf remove"
+alias dU="sudo dnf upgrade"
+alias dQ="rpm -qa"
+
+# Utility functions
+# Fuzzy find file + open in editor
+vf() { fzf | xargs -r -I % $EDITOR % ;}
+
+# Config files
+alias cfb="$EDITOR $HOME/.bashrc"
+alias cfz="$EDITOR $HOME/.zshrc"
+alias cfp="$EDITOR $HOME/.profile"
+alias cfv="$EDITOR $HOME/.config/nvim/init.vim"
+alias cfa="$EDITOR $HOME/.config/aliasrc"
+alias cfg="$EDITOR $HOME/.config/git/config"
diff --git a/.config/git/config b/.config/git/config
new file mode 100644
index 0000000..daf47b0
--- /dev/null
+++ b/.config/git/config
@@ -0,0 +1,18 @@
+[user]
+ name = Nicholas Tay
+ email = nkt@outlook.kr
+[alias]
+ c = commit
+ p = push
+ s = status
+ su = status --untracked-files=normal
+ sua = status -u
+ rv = remote -v
+ a = add
+ aa = add .
+ co = checkout
+ cam = commit -a -m
+ cm = commit -m
+ d = diff
+ cob = checkout -b
+ l = log
diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim
new file mode 100644
index 0000000..cbeece5
--- /dev/null
+++ b/.config/nvim/init.vim
@@ -0,0 +1,47 @@
+" Nick's light (n)vimrc
+" No plug stuff, just the basics
+
+let mapleader="\\"
+
+set nocompatible
+filetype plugin on
+syntax on
+set encoding=utf-8
+set number relativenumber
+
+set nohlsearch
+set splitbelow splitright
+set scrolloff=6
+
+colorscheme industry
+
+set tabstop=4
+set softtabstop=0 noexpandtab
+set shiftwidth=4
+
+set mouse=a
+
+" Jump to a placeholder character
+map <leader><leader> <Esc>/<++><Enter>"_d4lzzi
+nnoremap <leader><leader> <Esc>/<++><Enter>"_d4lzzi
+inoremap <leader><leader> <Esc>/<++><Enter>"_d4lzzi
+
+" Splits
+map <C-h> <C-w>h
+map <C-j> <C-w>j
+map <C-k> <C-w>k
+map <C-l> <C-w>l
+
+" Copy + paste
+vnoremap <leader>c "+y
+vnoremap <leader>x "*y
+map <leader>v "+P
+
+" Paste mode
+set pastetoggle=<F12>
+
+" Replace all
+nnoremap S :%s//g<Left><Left>
+
+" Nice little helper for saving sudo when forget
+cmap w!! w !sudo tee >/dev/null %
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..90a3103
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+# Ignore all
+/*
+
+
+# Exclusions
+# Allow dotfiles in ~, but don't allow folders starting with dot
+!.*
+.*/
+
+# Folders (and their subdirs)
+!/.config/
+
+# Ignore back again
+/.config/nvim/.netrwhist
+/.Xauthority
+/.xsession-errors
+/.viminfo
+/.bash_history
+/.bash_logout
diff --git a/.profile b/.profile
new file mode 100644
index 0000000..0794099
--- /dev/null
+++ b/.profile
@@ -0,0 +1,19 @@
+# Nick's light .profile
+# Quite a lot of exports cut down, as we don't include the X programs ones here,
+# just enough for cli
+
+export PATH=$PATH:$HOME/.local/bin
+
+# Programs
+command -v nvim >/dev/null \
+ && export EDITOR="nvim" \
+ || export EDITOR="vim"
+export VISUAL="$EDITOR"
+export FILE="ranger"
+
+# Home dot cleanup
+export LESSHISTFILE="-"
+export VIMINIT=":source $HOME/.config/nvim/init.vim"
+
+# Tool config
+export FZF_DEFAULT_OPTS="--layout=reverse --height 85%"
diff --git a/.zshrc b/.zshrc
new file mode 100644
index 0000000..3607e25
--- /dev/null
+++ b/.zshrc
@@ -0,0 +1,130 @@
+# Nick's light .zshrc
+
+# Setup the prompt (PS1)
+PS1="%F{015}%n%f%F{243}@%f%F{176}%m%f%F{243}:%f%(5~|%-1~//%3~|%4~) "
+[ "$TERM" = "linux" ] && PS1="%F{cyan}%n%f%F{white}@%f%F{magenta}%m%f%F{white}:%f%(5~|%-1~//%3~|%4~)$ "
+[ ! -z $SSH_CLIENT ] && PS1="(SSH) $PS1"
+
+# History
+HISTFILE="$HOME/.local/share/zsh_history"
+HISTSIZE=1000
+SAVEHIST=1000
+
+# Some misc options
+setopt auto_cd
+setopt share_history
+setopt menu_complete
+setopt cdable_vars
+# Automatically push dirs to stack so we can quickly flip between dirs
+setopt auto_pushd
+# For above, minus should mean reverse (at least to me?)
+setopt pushd_minus
+# Don't auto tab complete fill
+setopt nomenucomplete
+
+
+# Use vim keys
+bindkey -v
+KEYTIMEOUT=1
+
+# Vim key fixes
+# Backspace in viins
+bindkey -v '^?' backward-delete-char
+# Ctrl-r
+bindkey '^R' history-incremental-search-backward
+bindkey '^S' history-incremental-search-forward
+# Delete
+bindkey '^[[3~' delete-char # xterm
+bindkey '^[[P' delete-char # st
+# Home/End in vicmd
+bindkey -a '^[[H' beginning-of-line
+bindkey -a '^[[F' end-of-line # xterm
+bindkey -a '^[[4~' end-of-line # st
+
+
+# don't do this for non-tty
+if [ "$TERM" != "linux" ]; then
+
+# Use beam cursor
+# Code 6 for static (not blinking), also for all new prompts, do this too
+_beam_cursor() { echo -ne '\e[6 q' ;}
+precmd_functions+=(_beam_cursor)
+
+# Update correct cursors for zsh vi editing (from luke's)
+# Except use 2 & 6 for statics
+function zle-keymap-select {
+ if [[ ${KEYMAP} == vicmd ]] ||
+ [[ $1 = 'block' ]]; then
+ echo -ne '\e[2 q'
+
+ elif [[ ${KEYMAP} == main ]] ||
+ [[ ${KEYMAP} == viins ]] ||
+ [[ ${KEYMAP} = '' ]] ||
+ [[ $1 = 'beam' ]]; then
+ echo -ne '\e[6 q'
+ fi
+}
+zle -N zle-keymap-select
+zle-line-init() {
+ zle -K viins # initiate `vi insert` as keymap (can be removed if `bindkey -V` has been set elsewhere)
+ echo -ne "\e[6 q"
+}
+zle -N zle-line-init
+
+
+# Dynamic xtitle
+# https://wiki.archlinux.org/index.php/Zsh#xterm_title
+autoload -Uz add-zsh-hook
+function xterm_title_precmd () {
+ print -Pn -- '\e]2;%n@%m:%~\a'
+ [[ "$TERM" == 'screen'* ]] && print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-}:\005{B}%~\005{-}\e\\'
+}
+function xterm_title_preexec () {
+ print -Pn -- '\e]2;' && print -n -- "${(q)1}\a"
+ [[ "$TERM" == 'screen'* ]] && { print -Pn -- '\e_\005{g}%n\005{-}@\005{m}%m\005{-}:\005{B}%~\005{-} %# ' && print -n -- "${(q)1}\e\\"; }
+}
+if [[ "$TERM" == (screen*|xterm*|rxvt*|tmux*|putty*|konsole*|gnome*|st*|alacritty*) ]]; then
+ add-zsh-hook -Uz precmd xterm_title_precmd
+ add-zsh-hook -Uz preexec xterm_title_preexec
+fi
+
+
+# Autosuggestion plugin
+source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null \
+ || source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh 2>/dev/null # fedora
+ZSH_AUTOSUGGEST_USE_ASYNC=1
+ZSH_AUTOSUGGEST_STRATEGY=(completion history)
+bindkey '^K' autosuggest-execute
+
+fi
+
+
+# Load our common aliases
+source $HOME/.config/aliasrc
+
+# Syntax highlighting plugin
+# Must be loaded last
+source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null \
+ || source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh 2>/dev/null && { \
+ # Add some color changes from the default green (to lighter)
+ ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=114,underline
+ ZSH_HIGHLIGHT_STYLES[precommand]=fg=114,underline
+ ZSH_HIGHLIGHT_STYLES[arg0]=fg=114
+ }
+
+
+# History substring search
+# Must be loaded after the syntax highlighting plugin
+source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh 2>/dev/null && { \
+ # Binds
+ # Up/down arrows
+ bindkey '^[[A' history-substring-search-up
+ bindkey '^[[B' history-substring-search-down
+ # vi mode
+ bindkey -M vicmd 'k' history-substring-search-up
+ bindkey -M vicmd 'j' history-substring-search-down
+ # Reset search formatting - magenta bg is too jarring
+ # Instead just use a nice bold
+ HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND=bold
+ HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND=fg=red,bold
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..61ae91a
--- /dev/null
+++ b/README.md
@@ -0,0 +1,18 @@
+# dotlite
+
+Lightweight dotfiles with git bare repo - trimmed down from my main dots so it can be put on servers and/or work computers.
+
+Probably will have some basic CLI setup + a really simple i3 config with i3status.
+
+```
+$ git clone --bare https://github.com/nicholastay/dotlite.git ~/.dotlite.git
+$ git --git-dir=$HOME/.dotlite.git/ --work-tree=$HOME checkout
+$ git --git-dir=$HOME/.dotlite.git/ --work-tree=$HOME config --local status.showUntrackedFiles no
+
+# To add more files (once aliases loaded)
+# May need to add to gitignore to not use -f (safety)
+$ d a ~/.config/...
+
+# Any other git operations
+$ d ...
+```