From ec75775b276a8c323ae01bbd71b998a7f3c44e39 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 16 Aug 2019 11:20:18 +0200 Subject: Initial commit for dotfiles --- .bash_aliases | 3 ++ .bashrc | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ .my.tmuxtheme | 64 ++++++++++++++++++++++++++++ .pluggins.vim | 43 +++++++++++++++++++ .profile | 3 ++ .tmux.conf | 35 +++++++++++++++ .vimrc | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++ .zshrc | 87 ++++++++++++++++++++++++++++++++++++++ Makefile | 43 +++++++++++++++++++ README.md | 11 +++++ redshift.conf | 14 ++++++ 11 files changed, 558 insertions(+) create mode 100644 .bash_aliases create mode 100644 .bashrc create mode 100644 .my.tmuxtheme create mode 100644 .pluggins.vim create mode 100644 .profile create mode 100644 .tmux.conf create mode 100644 .vimrc create mode 100644 .zshrc create mode 100644 Makefile create mode 100644 README.md create mode 100644 redshift.conf diff --git a/.bash_aliases b/.bash_aliases new file mode 100644 index 0000000..fffa45a --- /dev/null +++ b/.bash_aliases @@ -0,0 +1,3 @@ +alias adg='sudo apt update && sudo apt upgrade -y' +alias yoump3='youtube-dl --extract-audio --audio-format mp3' +alias python="python3.7" diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..f895cc5 --- /dev/null +++ b/.bashrc @@ -0,0 +1,134 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color|*-256color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + alias dir='dir --color=auto' + alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# colored GCC warnings and errors +#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' + +# some more ls aliases +alias ll='ls -l' +alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# adding superuser bin to PATH +export PATH="/sbin:$PATH" + +# man with color +export LESS_TERMCAP_mb=$'\e[1;32m' +export LESS_TERMCAP_md=$'\e[1;32m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[01;33m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[1;4;31m' + +export PS1="\n\[$(tput bold)$(tput setaf 2)\]\w\n\[$(tput setaf 1)\]❯ \[$( tput sgr0)\]" + +# node alias +alias node="nodejs" + +# set XDG stuff +export XDG_CONFIG_HOME="/home/charles/.config/" +export XDG_DATA_HOME="/home/charles/.data/" diff --git a/.my.tmuxtheme b/.my.tmuxtheme new file mode 100644 index 0000000..ba03f56 --- /dev/null +++ b/.my.tmuxtheme @@ -0,0 +1,64 @@ +# +# 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 new file mode 100644 index 0000000..518a631 --- /dev/null +++ b/.pluggins.vim @@ -0,0 +1,43 @@ +" 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 + + + " 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 '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 +call plug#end() diff --git a/.profile b/.profile new file mode 100644 index 0000000..7711501 --- /dev/null +++ b/.profile @@ -0,0 +1,3 @@ +if [ -z $TMUX ]; then + redshift -c $HOME/.dotfiles/redshift.conf & +fi diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..d023ca5 --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,35 @@ +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 new file mode 100644 index 0000000..ffb7194 --- /dev/null +++ b/.vimrc @@ -0,0 +1,121 @@ +if &term =~# '^screen' + let &t_8f = "\[38;2;%lu;%lu;%lum" + let &t_8b = "\[48;2;%lu;%lu;%lum" + set termguicolors " overwrite terminal theme +endif + +so $HOME/dotfiles/.pluggins.vim " source pluggins + +let mapleader = ' ' + +syntax enable +set hidden +set noswapfile +filetype plugin on " add specific rules for certain file type +filetype plugin indent on +set number relativenumber +" browse list with tab +set wildmode=longest,list,full +set wildmenu +set nocompatible +set path+=** " for recursive :find +" more intuitif split opening +set splitbelow +set splitright +set fcs+=vert:\ " split separator +" easier split navigation +nnoremap +nnoremap +nnoremap +nnoremap +" spit resizing +nnoremap zh > +nnoremap zl < +nnoremap zj - +nnoremap zk + +" tab to space +set expandtab +set tabstop=4 +set shiftwidth=4 +set smarttab +set autoindent +set smartindent +" search +set ignorecase +set smartcase +set hlsearch +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" +" 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) +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 gruvbox +set background=dark +let g:lightline = {} +let g:lightline.colorscheme = 'jellybeans' +" let g:lightline.component_expand = { +" \ 'linter_checking': 'lightline#ale#checking', +" \ 'linter_warnings': 'lightline#ale#warnings', +" \ 'linter_errors': 'lightline#ale#errors', +" \ 'linter_ok': 'lightline#ale#ok', +" \ } +" let g:lightline.component_type = { +" \ 'linter_checking': 'left', +" \ 'linter_warnings': 'warning', +" \ 'linter_errors': 'error', +" \ 'linter_ok': 'left', +" \ } +" let g:lightline.active = { 'right': [[ 'linter_checking', 'linter_errors', 'linter_warnings', 'linter_ok' ]] } + +let base16colorspace=256 + +" NERDTree shortcut +map d :NERDTreeToggle +map f :NERDTreeFocus + +" Global copy and paste +vnoremap "+y +noremap "+P + +" '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 +imap jj + +" remove visual mode keybinding +map Q diff --git a/.zshrc b/.zshrc new file mode 100644 index 0000000..26fdd5d --- /dev/null +++ b/.zshrc @@ -0,0 +1,87 @@ +export ZSH="$HOME/.oh-my-zsh" + +ZSH_THEME="pure" +HYPHEN_INSENSITIVE="true" +DISABLE_MAGIC_FUNCTIONS=true +HIST_STAMPS="dd/mm/yyyy" + +plugins=(colorize command-not-found git) +source $ZSH/oh-my-zsh.sh + +export KEYTIMEOUT=1 +bindkey -v + +setopt auto_cd +setopt pushd_ignore_dups +setopt list_rows_first + +# alias expansion +bindkey "^ " _expand_alias # ctrl+space to expand +bindkey " " magic-space # space to avoid expansion +bindkey -M isearch " " magic-space + +# alt-arrow to go forward/backward a word +# bindkey "^[[C" forward-word +# bindkey "^[[D" backward-word + +alias -g G='| grep' +alias -g L='| less' +alias -g LO='192.168.0.' +alias rr='rm -r' +alias ll="ls -lFh" +alias la="ls -a" +alias lA="ls -al" +alias lss="ls -Ssh" +alias less="less -N" +alias mkdir="mkdir -p" +alias tree="tree -I '__pycache__'" +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 list-c-includes-paths="echo | gcc -E -Wp,-v -" +alias yoump3='youtube-dl --extract-audio --audio-format mp3' + +function chpwd() { + file_count=$(ls | wc -w) + if [ $file_count -lt 30 ]; then + ls + else + echo "$(pwd) contains $file_count files" + 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" + +# add command-not-found package suggestion +source /etc/zsh_command_not_found + +# add /sbin to $PATH +export PATH="/sbin:/usr/local/sbin:/usr/sbin:$PATH" +# add my bin +export PATH="$HOME/bin:$PATH" + +# man with color +export LESS_TERMCAP_mb=$'\e[1;32m' +export LESS_TERMCAP_md=$'\e[1;32m' +export LESS_TERMCAP_me=$'\e[0m' +export LESS_TERMCAP_se=$'\e[0m' +export LESS_TERMCAP_so=$'\e[01;33m' +export LESS_TERMCAP_ue=$'\e[0m' +export LESS_TERMCAP_us=$'\e[1;4;31m' + +# XDG stuff +export XDG_CONFIG_HOME="/home/charles/.config/" +export XDG_DATA_HOME="/home/charles/.data/" + +export EDITOR="vim" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1550bc4 --- /dev/null +++ b/Makefile @@ -0,0 +1,43 @@ +DOTDIR = $(HOME)/dotfiles +ZSHRC = .zshrc +VIMRC = .vimrc +TMUXCONF = .tmux.conf +BASHRC = .bashrc +BASHALIAS = .bash_aliases +PROFILE = .profile +CONFFILES = $(HOME)/$(ZSHRC) $(HOME)/$(VIMRC) $(HOME)/$(TMUXCONF) $(HOME)/$(BASHRC) \ + $(HOME)/$(BASHALIAS) $(HOME)/$(PROFILE) + +.PHONY: all +all: $(CONFFILES) + +$(HOME)/$(ZSHRC): $(DOTDIR)/$(ZSHRC) + touch $@ + echo "source $<" > $@ + +$(HOME)/$(VIMRC): $(DOTDIR)/$(VIMRC) + touch $@ + echo "so $<" > $@ + +$(HOME)/$(TMUXCONF): $(DOTDIR)/$(TMUXCONF) + touch $@ + echo "source-file $<" > $@ + +$(HOME)/$(BASHRC): $(DOTDIR)/$(BASHRC) + touch $@ + echo "source $<" > $@ + +$(HOME)/$(BASHALIAS): $(DOTDIR)/$(BASHALIAS) + touch $@ + echo "source $<" > $@ + +$(HOME)/$(PROFILE): $(DOTDIR)/$(PROFILE) + touch $@ + echo "source $<" > $@ + +.PHONY: clean +clean: + rm -f $(CONFFILES) + +.PHONY: re +re: clean all diff --git a/README.md b/README.md new file mode 100644 index 0000000..17ea6d4 --- /dev/null +++ b/README.md @@ -0,0 +1,11 @@ +# Configuration files + +The tools I use: + +* [vim](https://github.com/vim/vim): terminal text editor +* [zsh](https://www.zsh.org/): interactive shell +* [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh): plugins and themes for zsh +* [tmux](https://github.com/tmux/tmux): multiple terminal/panel +* [redshift](https://github.com/jonls/redshift): change screen color temperature + +The tmux theme can be found [here](https://github.com/jimeh/tmux-themepack). diff --git a/redshift.conf b/redshift.conf new file mode 100644 index 0000000..f012aba --- /dev/null +++ b/redshift.conf @@ -0,0 +1,14 @@ +[redshift] +temp-day=3000 +temp-night=2600 + +; transition day/night +fade=1 + +; manual location (geo location not working) +location-provider=manual + +; latitude and longitude +[manual] +lat=50.8008858 +lon=4.2886091 -- cgit