From 53bce075ffee8e3839ff5d54b3cf59874b55a289 Mon Sep 17 00:00:00 2001 From: Titouan Rigoudy Date: Sat, 8 Sep 2018 08:51:53 -0400 Subject: [PATCH] Add config files. --- README.md | 31 ++++++++++++++++++++-- config.vim | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ prompt.sh | 30 +++++++++++++++++++++ tmux.conf | 22 +++++++++++++++ 4 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 config.vim create mode 100644 prompt.sh create mode 100644 tmux.conf diff --git a/README.md b/README.md index 72f5440..2c4140a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ -# dotfiles -Configuration files for a simple Linux dev environment. +# Setup + +First, clone this repository into ~/dotfiles. + +# Configure bash + +Add the following to your .bashrc: +```sh +# Better prompt. +source ~/dotfiles/prompt.sh +``` + +# Configure vim + +Install the jellybeans colorscheme, either by downloading jellybeans.vim into +.vim/colors/, or by installing a plugin manager and using it to install +jellybeans. + +Then add the following to your .vimrc: +``` +source ~/dotfiles/config.vim +``` + +# Configure tmux + +Run the following command: +```sh +$ ln -s ~/dotfiles/tmux.conf .tmux.conf +``` diff --git a/config.vim b/config.vim new file mode 100644 index 0000000..aed985b --- /dev/null +++ b/config.vim @@ -0,0 +1,78 @@ +" Personalized vim config. +" Lots of stuff stolen from amix.dk's ultimate vimrc. +" +" Append the following line to your .vimrc to use this: +" +" source +" + +" Visualization options. + +" Always show the current cursor position. +set ruler +" Show the 80 character column. +set colorcolumn=80 +" Show line numbers. +set number + +" Show matching brackets when cursor hovers over them. +set showmatch + +" Highlight search results. +set hlsearch +" Jump to search results as user types search query. +set incsearch + +" Use a nice color scheme. +colorscheme jellybeans + + +" Formatting options. + +" Use spaces instead of tabs. +set expandtab +" Be smart when using tabs ;) +set smarttab +" Tabs should look like 2 spaces. +set tabstop=2 + +set ai "Auto indent +set si "Smart indent +set wrap "Wrap lines + + +" Performance/misc options. + +" Don't make annoying sounds on errors. +set noerrorbells +set novisualbell +set t_vb= +set tm=500 + +" Don't redraw while executing macros for performance. +set lazyredraw + +" Set utf8 as standard encoding and en_US as the standard language. +set encoding=utf8 + +" Use Unix as the standard file type. +set ffs=unix,dos,mac + +" Turn backup off, since most stuff is in SVN, git etc. anyway... +set nobackup +set nowb +set noswapfile + + +" Make moving around tabs and windows work like tmux. + +" Normal mode shortcuts. We use nmap instead of nnoremap because there shouldn't +" be any difference anyway, colon commands should not map to something else. +nmap c :tabnew +nmap n :tabnext +nmap p :tabprev +nmap v :vsplit +nmap h :split + +" In insert mode, typing will conveniently exit back to normal mode. +imap diff --git a/prompt.sh b/prompt.sh new file mode 100644 index 0000000..64b9bd1 --- /dev/null +++ b/prompt.sh @@ -0,0 +1,30 @@ +# Additional bash prompt configuration for interactive shells only. + +function prompt () { + # Check for color support. + local boldblue= + local boldgreen= + local purple= + local nocolor= + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + boldblue="\[\e[1;34m\]" + boldgreen="\[\e[1;32m\]" + purple="\[\e[0;35m\]" + nocolor="\[\e[00m\]" + fi + + local ps1="${boldgreen}\u@\h${nocolor}:${boldblue}\w ${purple}\D{%T}${nocolor} \$ " + + # If this is an xterm set the title to user@host:dir + case "$TERM" in + xterm*|rxvt*) + ps1="\[\e]0;\u@\h: \w\a\]${ps1}" + ;; + esac + + echo "$ps1" +} + +PS1=$(prompt) + +unset -f prompt diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 0000000..436c35b --- /dev/null +++ b/tmux.conf @@ -0,0 +1,22 @@ +# Personalized settings for tmux. +# Usage: +# +# ln -s ~/.tmux.conf +# + +# Map prefix to Ctrl-a instead of Ctrl-b. +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# Split panes with better keys. +unbind '"' +unbind % +bind v split-window -h +bind h split-window -v + +# Enable 256 colors. +set -g default-terminal 'screen-256color' + +# Enable vi-like key bindings for navigating around buffers. +set-window-option -g mode-keys vi