From 7f1ddd1d21e8d444f742cc5819fa0a959f5534d2 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 5 Mar 2020 17:33:50 +0100 Subject: Removing tmux, profile Refactoring zsh and vim config --- .my.tmuxtheme | 64 ------------------------- .pluggins.vim | 53 +++++---------------- .profile | 5 -- .tmux.conf | 35 -------------- .vimrc | 140 +++++++++++++++++++++++-------------------------------- .zsh_aliases | 57 +++++++++++++++++++++++ .zshrc | 146 ++++++++++++++-------------------------------------------- Makefile | 30 +++++------- xmonad.hs | 24 ++++++++++ 9 files changed, 195 insertions(+), 359 deletions(-) delete mode 100644 .my.tmuxtheme delete mode 100644 .profile delete mode 100644 .tmux.conf create mode 100644 .zsh_aliases create mode 100644 xmonad.hs diff --git a/.my.tmuxtheme b/.my.tmuxtheme deleted file mode 100644 index ba03f56..0000000 --- a/.my.tmuxtheme +++ /dev/null @@ -1,64 +0,0 @@ -# -# Powerline Gray Block - Tmux Theme -# Created by Jim Myhrberg . -# -# Inspired by vim-powerline: https://github.com/Lokaltog/powerline -# -# Requires terminal to be using a powerline compatible font, find one here: -# https://github.com/Lokaltog/powerline-fonts -# - -# Status update interval -set -g status-interval 1 - -# Basic status bar colors -set -g status-style fg=colour238,bg=colour233 - -# Left side of status bar -set -g status-left-style bg=colour233,fg=colour243 -set -g status-left-length 40 -set -g status-left "#[fg=colour232,bg=colour245,bold] #S #[fg=colour245,bg=colour240,nobold]#[fg=colour233,bg=colour240] #(whoami) #[fg=colour240,bg=colour235]#[fg=colour240,bg=colour235] #I:#P #[fg=colour235,bg=colour233,nobold]" - -# Right side of status bar -set -g status-right-style bg=colour233,fg=colour243 -set -g status-right-length 150 -set -g status-right "#[fg=colour235,bg=colour233]#[fg=colour240,bg=colour235] %H:%M:%S #[fg=colour240,bg=colour235]#[fg=colour233,bg=colour240] %d-%b-%y #[fg=colour245,bg=colour240]#[fg=colour232,bg=colour245,bold] #H " - -# Window status -set -g window-status-format " #I:#W#F " -set -g window-status-current-format " #I:#W#F " - -# Current window status -set -g window-status-current-style bg=colour245,fg=colour232 - -# Window with activity status -set -g window-status-activity-style bg=colour233,fg=colour245 - -# Window separator -set -g window-status-separator "" - -# Window status alignment -set -g status-justify centre - -# Pane border -set -g pane-border-style bg=default,fg=colour235 - -# Active pane border -set -g pane-active-border-style bg=default,fg=colour240 - -# Pane number indicator -set -g display-panes-colour colour233 -set -g display-panes-active-colour colour245 - -# Clock mode -set -g clock-mode-colour colour240 -set -g clock-mode-style 24 - -# Message -set -g message-style bg=colour245,fg=colour232 - -# Command message -set -g message-command-style bg=colour233,fg=colour250 - -# Mode -set -g mode-style bg=colour243,fg=colour232 diff --git a/.pluggins.vim b/.pluggins.vim index 35c0918..45d0976 100644 --- a/.pluggins.vim +++ b/.pluggins.vim @@ -1,45 +1,14 @@ " plugins call plug#begin() - Plug 'scrooloose/nerdtree' " file tree - " Plug 'scrooloose/nerdcommenter' " comment multiple line - "Plug 'vim-airline/vim-airline' " status bar - Plug 'itchyny/lightline.vim' " minimal status bar - " Plug 'jiangmiao/auto-pairs' " pair stuff autocomplete - " Plug 'yuttie/comfortable-motion.vim' " scroll - Plug 'ctrlpvim/ctrlp.vim' " Ctrl-P similar to vsc - "Plug 'lervag/vimtex' " LaTex improvement - " better highlight syntax - Plug 'justinmk/vim-syntax-extra' - "Plug 'junegunn/goyo.vim' " focus mode - " Plug 'w0rp/ale' " lint - Plug 'maximbaz/lightline-ale' - Plug 'romainl/vim-cool' " disable highlight after search - "Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app & yarn install' } " markdown preview with math typeset - Plug 'vim-scripts/awk.vim' - Plug 'sheerun/vim-polyglot' " better syntax highlighting - " Plug 'neovimhaskell/haskell-vim' " vim haskell highlighting - Plug 'haya14busa/incsearch.vim' " better incsearch - - - " themes - "Plug 'mhartington/oceanic-next' - Plug 'joshdick/onedark.vim' - " Plug 'morhetz/gruvbox' - Plug 'shinchu/lightline-gruvbox.vim' - Plug 'dracula/vim', { 'as': 'dracula' } - "Plug 'jdkanani/vim-material-theme' - Plug 'ayu-theme/ayu-vim' - "Plug 'vim-airline/vim-airline-themes' - Plug 'connorholyday/vim-snazzy' - Plug 'chriskempson/base16-vim' - - Plug 'tomtom/tcomment_vim' " other min commenter - " Plug 'tpope/vim-commentary' " minimalistic commenter - Plug 'tpope/vim-surround' " surround stuff - Plug 'tpope/vim-eunuch' " command in vim - - "Plug 'terryma/vim-multiple-cursors' - "Plug 'Valloric/YouCompleteMe' " autocomplete - "Plug 'fatih/vim-go' - "Plug 'Yggdroot/indentLine' " indent guide + Plug 'joshdick/onedark.vim' " theme + Plug 'ctrlpvim/ctrlp.vim' " Ctrl-P similar to vsc + Plug 'tpope/vim-eunuch' " basic unix command in vim + Plug 'tomtom/tcomment_vim' " mininal commenter + Plug 'itchyny/lightline.vim' " minimal status bar + + " bloat?? + Plug 'romainl/vim-cool' " disable highlight after search + Plug 'haya14busa/incsearch.vim' " better incsearch + Plug 'justinmk/vim-syntax-extra' " better syntax highlight + Plug 'sheerun/vim-polyglot' " better syntax highlight call plug#end() diff --git a/.profile b/.profile deleted file mode 100644 index b3a0a28..0000000 --- a/.profile +++ /dev/null @@ -1,5 +0,0 @@ -if [ -z $TMUX ]; then - redshift -c $HOME/.dotfiles/redshift.conf & -fi - -export PATH=$PATH:/usr/local/go/bin diff --git a/.tmux.conf b/.tmux.conf deleted file mode 100644 index ac350d7..0000000 --- a/.tmux.conf +++ /dev/null @@ -1,35 +0,0 @@ -unbind C-b -set -g prefix C-f -bind C-f send-prefix - -set -g default-terminal "screen.xterm-256color" -set -g mouse on -setw -g mode-keys vi - -bind '"' split-window -c "#{pane_current_path}" -bind ù split-window -h -c "#{pane_current_path}" -bind c new-window -c "#{pane_current_path}" - -unbind [ -bind y copy-mode -unbind p -bind p paste-buffer -# bind-key -t vi-copy 'v' begin-selection -# bind-key -t vi-copy 'y' copy-selection -# bind-key -t vi-copy 'r' rectangle-toggle - -# bind -t vi-copy y copy-pipe "xclip -sel clip -i" - -source-file $HOME/dotfiles/.my.tmuxtheme - -set -sg escape-time 0 - -unbind l -bind k select-pane -U -bind j select-pane -D -bind l select-pane -R -bind h select-pane -L - -bind v previous-window - -unbind m diff --git a/.vimrc b/.vimrc index 318546a..6b8dd5b 100644 --- a/.vimrc +++ b/.vimrc @@ -1,122 +1,98 @@ -so $HOME/dotfiles/.pluggins.vim " source pluggins +"""""""""" +" vimrc " +"""""""""" + +" source pluggins +source $HOME/dotfiles/.pluggins.vim + + +" common +let mapleader = ' ' " set leader key to space +syntax enable " enable syntax +set hidden " keep change in buffer when quitting window +set noswapfile " disable swap files +set nocompatible " not compatible with vi +filetype plugin indent on " allow to add specific rules for certain type of file +set number relativenumber " line number relative to cursor +set cursorline " highlight current line +set noshowmatch " dont jump to pair bracket +set autoread " reload files when changes happen outside vim +set scrolloff=2 " line padding when scrolling +set encoding=utf-8 " utf-8 encoding +set textwidth=89 " when line wrap occurs -let mapleader = ' ' - -syntax enable -set hidden -set noswapfile -set nocompatible -filetype plugin indent on " add specific rules for certain file type -set number relativenumber " browse list with tab set wildmode=longest,list,full -set wildmenu -set path+=** " for recursive :find -" more intuitif split opening +set wildmenu " tab to cycle through completion options +set path+=** " recursive :find + +" intuitif split opening set splitbelow set splitright -set fcs+=vert:\ " split separator -" easier split navigation +set fcs+=vert:\ " no split separator + +" split navigation nnoremap nnoremap nnoremap nnoremap + " spit resizing nnoremap zh > nnoremap zl < nnoremap zj - nnoremap zk + -" tab to space -set expandtab -set tabstop=4 + +" tab +set expandtab " tab to space +set tabstop=4 " tab size set shiftwidth=4 set smarttab set autoindent set smartindent -" search -set ignorecase + +" file search +set ignorecase " case insensitive set smartcase -set hlsearch +set hlsearch " match highlight set incsearch -" other -set ruler -set laststatus=2 " always a statusline -set scrolloff=2 " 2 line above scroll -set showcmd -set cursorline " highlight current line -set noshowmode " unnecessary with status bar" -set noshowmatch - -set autoread " reload files when changes happen outside vim - -" where to place the .swp files -" set backupdir=~/.vim-tmp,~/.tmp,~/tmp,~/var/tmp -" set directory=~/.vim-tmp,~/.tmp,~/tmp,~/var/tmp -" directory to ignore when searching in file tree (works with ctrlp) + +" status +set laststatus=2 " always a statusline (all window) +set showcmd " show current partial command in the bottom right +set noshowmode " dont show current mode (i.e --INSERT--) + + +" ctrlp pluggin +" directory to ignore when searching in file tree set wildignore=*/tmp/*,*.o,*.so,*.swp,*.zip,*/node_modules/*,*/vendor/*,.bundle/*,bin/*,.git/* " ctrlp ignore all stuff in the .gitignore let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard'] -" ALE -" highlight clear ALEErrorSign -" highlight clear ALEWarningSign -" let g:ale_sign_error = '>' -" let g:ale_sign_warning = '-' -" let g:ale_lint_on_text_changed = 'never' -" let g:ale_lint_on_enter = 0 -" let g:ale_echo_msg_error_str = 'E' -" let g:ale_echo_msg_warning_str = 'W' -" let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' -" let g:ale_linters = { -" \ 'python': ['flake8'] -" \ } -" let g:ale_fixers = { -" \ 'python': ['autopep8'] -" \ } - -" let g:gruvbox_italic=1 -" let g:gruvbox_contrast_dark="hard" +" colorscheme let g:onedark_terminal_italics=1 colorscheme onedark -" set background=dark let g:lightline = {} -let g:lightline.colorscheme = 'one' - -let base16colorspace=256 - -" NERDTree shortcut -" map d :NERDTreeToggle -" map f :NERDTreeFocus - -" Global copy and paste -vnoremap "+y -noremap "+P +let g:lightline.colorscheme = 'one' " lightline theme to onedark +" mappings " 'Y' yank to the end of the line noremap Y y$ -" remove trailing white space on save -autocmd BufWritePre * %s/\s\+$//e - " solves annoying delay went exiting insert mode imap +" jj or kk to exit insert mode imap jj imap kk - " remove visual mode keybinding map Q - -" c source and header files comment formats for vim-commentary -" autocmd Filetype c setlocal commentstring=// %s -" autocmd Filetype h setlocal commentstring=// %s - -autocmd Filetype c setlocal noexpandtab - -set encoding=utf-8 - -set textwidth=89 " when line wrap occurs - -" incsearch mapping +" incsearch map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) + +" remove trailing white space on save +autocmd BufWritePre * %s/\s\+$//e + +" real tab in c file for school projects +autocmd Filetype c setlocal noexpandtab diff --git a/.zsh_aliases b/.zsh_aliases new file mode 100644 index 0000000..9d3e4db --- /dev/null +++ b/.zsh_aliases @@ -0,0 +1,57 @@ +############### +# zsh aliases # +############### + +# color +alias ls="ls --color" +alias grep="grep --color=auto" +alias tree="tree -C" + +# common commands +alias less="less -N" +alias v="vim" +alias mkdir="mkdir -p" +alias gdb="gdb -q" + +# ls +alias ll="ls -lFh" +alias la="ls -a" +alias lla="ls -al" +alias lss="ls -Ssh" + +# tree +alias t="tree" +alias t1="tree -L 1" +alias t2="tree -L 2" +alias t3="tree -L 3" +alias treeI="tree -I '__pycache__' -I '*.o' -I vendor" + +# man +alias m="man" +alias m2="man 2" +alias m3="man 3" + +# git +alias ga="git add" +alias gaa="git add --all" +alias gc="git commit" +alias gc!="git commit --amend" +alias gcmsg="git commit --message" +alias gd="git diff" +alias gds="git diff --staged" +alias gl="git pull" +alias glg="git log --stat" +alias glgg="git log --graph" +alias gp="git push" +alias gcl="git clone --recurse-submodules" +alias gst="git status" +alias gco="git checkout" + +# edit config files +alias zshrc="vim $DOTFILES/.zshrc && source $DOTFILES/.zshrc" +alias vimrc="vim $DOTFILES/.vimrc" +alias vimplugrc="vim $DOTFILES/.pluggins.vim" + +# helper to switch between dual and single monitor setup +alias dual='xrandr --output LVDS1 --primary --left-of VGA1 --output VGA1 --auto' +alias single='xrandr --output VGA1 --off' diff --git a/.zshrc b/.zshrc index 23c3df3..d3e78b2 100644 --- a/.zshrc +++ b/.zshrc @@ -1,85 +1,39 @@ -#!/usr/bin/zsh - -#export ZSH="$HOME/.oh-my-zsh" - -ZSH_THEME="pure" -# ZSH_THEME="robbyrussell" -HYPHEN_INSENSITIVE="true" -DISABLE_MAGIC_FUNCTIONS=true -HIST_STAMPS="dd/mm/yyyy" - -#school stuff -#ZSH_DISABLE_COMPFIX=true +############### +# zshrc # +############### +# pure prompt export FPATH="$FPATH:$HOME/.zsh/pure" - -#plugins=() #colorize git zsh-syntax-highlighting) -#source $ZSH/oh-my-zsh.sh - -autoload -U promptinit; promptinit +ZSH_THEME="pure" +autoload -U promptinit +promptinit prompt pure +# auto complete +autoload -U compinit +zstyle ':completion:*' matcher-list '' \ + 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=*' 'r:|=* l:|=* r:|=*' # case insensitive +zmodload zsh/complist +compinit +_comp_options+=(globdots) + +# vim keybindings in tab completion menu (https://www.youtube.com/watch?v=eLEo4OQ-cuQ) +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -v '^?' backward-delete-char + +# vim keybindings in prompt bindkey -v export KEYTIMEOUT=1 -setopt auto_cd -setopt pushd_ignore_dups -setopt list_rows_first -setopt extendedglob - -# alias expansion -#bindkey "^ " _expand_alias # ctrl+space to expand -#bindkey " " magic-space # space to avoid expansion -#bindkey -M isearch " " magic-space - -#alias -g G='| grep' -#alias -g L='| less' -#alias -g LO='192.168.0.' -#alias -g HUB="https://github.com/HappyTramp/" -alias grep="grep --color=auto" -alias rr='rm -r' -alias ls="ls --color" -alias ll="ls -lFh" -alias la="ls -a" -alias lA="ls -al" -alias lss="ls -Ssh" -alias l1="ls -1" -alias less="less -N" -alias mkdir="mkdir -p" -alias tree="tree -C" -alias treeI="tree -I '__pycache__' -I '*.o' -I vendor" -alias v="vim" - -alias :q="exit" -alias :sp="tmux split-window" -alias :vsp="tmux split-window -h" -alias nmaplan="sudo nmap -sP '192.168.0.*'" -alias gdb="gdb -q" -alias node="nodejs" -alias python="python3.7" -alias info="info --vi-keys" -alias moula="gcc -Wall -Wextra -Werror" -alias norm="norminette" -alias normch="norm *.c *.h" -alias list-c-includes-paths="echo | gcc -E -Wp,-v -" -alias yoump3='youtube-dl --extract-audio --audio-format mp3' -alias adg="sudo apt update && sudo apt upgrade" - -alias ga="git add" -alias gaa="git add --all" -alias gc="git commit" -alias gc!="git commit --amend" -alias gcmsg="git commit --message" -alias gd="git diff" -alias gds="git diff --staged" -alias gl="git pull" -alias glg="git log --stat" -alias glgg="git log --graph" -alias gp="git push" -alias gcl="git clone --recurse-submodules" -alias gst="git status" -alias gco="git checkout" +setopt auto_cd # cd without `cd` command +# setopt pushd_ignore_dups +# setopt list_rows_first +# setopt extendedglob +# executed when changind directory function chpwd() { file_count=$(ls | wc -w) if [ $file_count -lt 30 ]; then @@ -89,41 +43,12 @@ function chpwd() { fi } -# behavior on enter -# function precmd() { -# echo $0; -# if ["${0}" -eq ""]; then -# ls -# else -# $1 -# fi; -# } - export DOTFILES=$HOME/dotfiles -alias zshrc="vim $DOTFILES/.zshrc && source $DOTFILES/.zshrc" -alias vimrc="vim $DOTFILES/.vimrc" -alias vimplugrc="vim $DOTFILES/.vimrc -c 'vsp $DOTFILES/.pluggins.vim'" -alias tmuxrc="vim $DOTFILES/.tmux.conf && tmux source-file $DOTFILES/.tmux.conf" - -# vim keys in tab completion menu (https://www.youtube.com/watch?v=eLEo4OQ-cuQ) -#bindkey -M menuselect 'h' vi-backward-char -#bindkey -M menuselect 'k' vi-up-line-or-history -#bindkey -M menuselect 'l' vi-forward-char -#bindkey -M menuselect 'j' vi-down-line-or-history -#bindkey -v '^?' backward-delete-char # add command-not-found package suggestion #source /etc/zsh_command_not_found -# add /sbin to $PATH -# export PATH="$PATH:/sbin:/usr/local/sbin:/usr/sbin" -# add my bin -# export PATH="$HOME/bin:$PATH" -# add go bins -# export PATH="$PATH:/usr/local/go/bin" -#export PATH="$PATH:$(go env GOPATH)/bin" - -# man with color +# color in man export LESS_TERMCAP_mb=$'\e[1;32m' export LESS_TERMCAP_md=$'\e[1;32m' export LESS_TERMCAP_me=$'\e[0m' @@ -132,19 +57,16 @@ export LESS_TERMCAP_so=$'\e[01;33m' export LESS_TERMCAP_ue=$'\e[0m' export LESS_TERMCAP_us=$'\e[1;4;31m' -# XDG stuff +# XDG export XDG_CONFIG_HOME="/home/charles/.config/" export XDG_DATA_HOME="/home/charles/.data/" export EDITOR="vim" # set tab to 4 spaces -# tabs 4 +tabs 4 -dual () { - xrandr --output LVDS1 --primary --left-of VGA1 --output VGA1 --auto -} +source $DOTFILES/.zsh_aliases -single () { - xrandr --output VGA1 --off -} +# prompt syntax highlight +source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh diff --git a/Makefile b/Makefile index 6a759c0..f75bbc8 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,13 @@ -DOTDIR = $(HOME)/dotfiles -ZSHRC = .zshrc -VIMRC = .vimrc -TMUXCONF = .tmux.conf -BASHRC = .bashrc +DOTDIR = $(HOME)/dotfiles +ZSHRC = .zshrc +VIMRC = .vimrc +BASHRC = .bashrc BASHALIAS = .bash_aliases -PROFILE = .profile -GHCI = .ghci -GDB = .gdbinit +GHCI = .ghci +GDB = .gdbinit GITCONFIG = .gitconfig -CONFFILES = $(HOME)/$(ZSHRC) $(HOME)/$(VIMRC) $(HOME)/$(TMUXCONF) $(HOME)/$(BASHRC) \ - $(HOME)/$(BASHALIAS) $(HOME)/$(PROFILE) $(HOME)/$(GHCI) $(HOME)/$(GDB) \ - $(HOME)/$(GITCONFIG) +XMONADCONFIG = .xmonad/xmonad.hs +CONFFILES = $(addprefix $(HOME), $(ZSHRC) $(VIMRC) $(BASHRC) $(BASHALIAS) $(GHCI) $(GDB) $(GITCONFIG)) $(XMONADCONFIG) .PHONY: all all: $(CONFFILES) @@ -23,10 +20,6 @@ $(HOME)/$(VIMRC): $(DOTDIR)/$(VIMRC) touch $@ echo "so $<" > $@ -$(HOME)/$(TMUXCONF): $(DOTDIR)/$(TMUXCONF) - touch $@ - echo "source-file $<" > $@ - $(HOME)/$(BASHRC): $(DOTDIR)/$(BASHRC) touch $@ echo "source $<" > $@ @@ -35,10 +28,6 @@ $(HOME)/$(BASHALIAS): $(DOTDIR)/$(BASHALIAS) touch $@ echo "source $<" > $@ -$(HOME)/$(PROFILE): $(DOTDIR)/$(PROFILE) - touch $@ - echo "source $<" > $@ - $(HOME)/$(GHCI): $(DOTDIR)/$(GHCI) touch $@ cat $< > $@ @@ -51,6 +40,9 @@ $(HOME)/$(GITCONFIG): $(DOTDIR)/$(GITCONFIG) touch $@ cat $< >> $@ +$(HOME)/$(XMONADCONFIG): $(DOTDIR)/xmonad.hs + cp $< $@ + .PHONY: clean clean: rm -f $(CONFFILES) diff --git a/xmonad.hs b/xmonad.hs new file mode 100644 index 0000000..608c9cc --- /dev/null +++ b/xmonad.hs @@ -0,0 +1,24 @@ +import XMonad +import XMonad.Config.Desktop + +-- Utilities +import XMonad.Util.SpawnOnce + +myModMask = mod4Mask +myTerminal = "konsole" +myTextEditor = "vim" +myBorderWidth = 2 + +main = do + xmonad $ desktopConfig + { modMask = myModMask + , terminal = myTerminal + , startupHook = myStartupHook + , borderWidth = myBorderWidth + , normalBorderColor = "#292d3e" + , focusedBorderColor = "#bbc5ff" + } + +myStartupHook = do + spawnOnce "redshift &" + spawnOnce "xinput disable 'ETPS/2 Elantech Touchpad' &" -- cgit