summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/setup.sh44
-rw-r--r--i3/config156
-rwxr-xr-xvimrc80
3 files changed, 277 insertions, 3 deletions
diff --git a/bin/setup.sh b/bin/setup.sh
index 16ced8c..4921bcf 100755
--- a/bin/setup.sh
+++ b/bin/setup.sh
@@ -1,6 +1,7 @@
#!/bin/bash
red='\e[0;31m'
+orange='\e[0;33m'
green='\e[0;32m'
none='\e[0m'
@@ -15,15 +16,52 @@ fi
# Does nothing and prints an error message if $2 exists and is not a symlink.
create_symlink() {
if [[ -e "$2" && ! -h "$2" ]]; then
- echo -e "${red}[WARNING]${none} '$2' exists and is not a symlink. Skipped."
+ echo -e "${orange}[SKIPPED]${none} '$2' exists and is not a symlink."
+ return
else
if ln -sf "$1" "$2"; then
echo -e "${green}[OK]${none} '$2' → '$1'"
else
- echo -e "${red}[WARNING] Could not create '$2'"
+ echo -e "${red}[WARNING]${none} could not create '$2'"
fi
fi
+ if ! diff "$2" "$(dirname $2)/$1"; then
+ echo -e "${red}[WARNING]${none} diffs in $2"
+ fi
}
create_symlink dotfiles/gitconfig .gitconfig
-create_symlink dotfiles/zshrc .zshrc
+create_symlink /dev/null .vimrc.local
+
+if [[ "${SHELL}" = *zsh* ]]; then
+ create_symlink dotfiles/zshrc .zshrc
+else
+ echo -e "${orange}[SKIPPED]${none} shell is not zsh :-(."
+fi
+
+if which i3 >/dev/null; then
+ mkdir -p .i3
+ create_symlink ../dotfiles/i3/config .i3/config
+else
+ echo -e "${orange}[SKIPPED]${none} i3 not installed."
+fi
+
+create_symlink dotfiles/vimrc .vimrc
+if which git >/dev/null; then
+ if [[ -e .vim/bundle/Vundle.vim ]]; then
+ echo -e "${orange}[SKIPPED]${none} Vundle.vim already installed"
+ else
+ success=1
+ mkdir -p .vim/bundle
+ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim \
+ || success=0
+ vim +PluginInstall +qall || success=0
+ if [[ "$success" == "1" ]]; then
+ echo -e "${green}[OK]${none} installed vim plugins"
+ else
+ echo -e "${red}[WARNING]${none} failed to install vim plugins"
+ fi
+ fi
+else
+ echo -e "${red}[WARNING]${none} git not installed"
+fi
diff --git a/i3/config b/i3/config
new file mode 100644
index 0000000..1d9f7e7
--- /dev/null
+++ b/i3/config
@@ -0,0 +1,156 @@
+# i3 config file (v4)
+#
+# Please see http://i3wm.org/docs/userguide.html for a complete reference!
+#
+# This config file uses keycodes (bindsym) and was written for the QWERTY
+# layout.
+#
+# To get a config file with the same key positions, but for your current
+# layout, use the i3-config-wizard
+#
+
+# font for window titles. ISO 10646 = Unicode
+font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
+
+# use Mouse+Mod4 to drag floating windows to their wanted position
+floating_modifier Mod4
+
+# start a terminal
+bindsym Mod4+Return exec urxvt
+
+# kill focused window
+bindsym Mod4+Shift+q kill
+
+# start dmenu (a program launcher)
+bindsym Mod4+d exec dmenu_run
+
+# change focus
+bindsym Mod4+h focus left
+bindsym Mod4+j focus down
+bindsym Mod4+k focus up
+bindsym Mod4+l focus right
+
+# alternatively, you can use the cursor keys:
+bindsym Mod4+Left focus left
+bindsym Mod4+Down focus down
+bindsym Mod4+Up focus up
+bindsym Mod4+Right focus right
+
+# move focused window
+bindsym Mod4+Shift+h move left
+bindsym Mod4+Shift+j move down
+bindsym Mod4+Shift+k move up
+bindsym Mod4+Shift+l move right
+
+# alternatively, you can use the cursor keys:
+bindsym Mod4+Shift+Left move left
+bindsym Mod4+Shift+Down move down
+bindsym Mod4+Shift+Up move up
+bindsym Mod4+Shift+Right move right
+
+# split in horizontal orientation
+bindsym Mod4+minus split h
+
+# split in vertical orientation
+bindsym Mod4+v split v
+
+# enter fullscreen mode for the focused container
+bindsym Mod4+f fullscreen
+
+# change container layout (stacked, tabbed, default)
+bindsym Mod4+s layout stacking
+bindsym Mod4+w layout tabbed
+bindsym Mod4+e layout default
+
+# toggle tiling / floating
+bindsym Mod4+Shift+space floating toggle
+
+# change focus between tiling / floating windows
+bindsym Mod4+space focus mode_toggle
+
+# focus the parent container
+bindsym Mod4+a focus parent
+
+# focus the child container
+#bindsym Mod4+d focus child
+
+# switch to workspace
+bindsym Mod4+1 workspace 1
+bindsym Mod4+2 workspace 2
+bindsym Mod4+3 workspace 3
+bindsym Mod4+4 workspace 4
+bindsym Mod4+5 workspace 5
+bindsym Mod4+6 workspace 6
+bindsym Mod4+7 workspace 7
+bindsym Mod4+8 workspace 8
+bindsym Mod4+9 workspace 9
+bindsym Mod4+0 workspace 10
+
+# move focused container to workspace
+bindsym Mod4+Shift+1 move workspace 1
+bindsym Mod4+Shift+2 move workspace 2
+bindsym Mod4+Shift+3 move workspace 3
+bindsym Mod4+Shift+4 move workspace 4
+bindsym Mod4+Shift+5 move workspace 5
+bindsym Mod4+Shift+6 move workspace 6
+bindsym Mod4+Shift+7 move workspace 7
+bindsym Mod4+Shift+8 move workspace 8
+bindsym Mod4+Shift+9 move workspace 9
+bindsym Mod4+Shift+0 move workspace 10
+
+# reload the configuration file
+bindsym Mod4+Shift+c reload
+# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
+bindsym Mod4+Shift+r restart
+# exit i3 (logs you out of your X session)
+bindsym Mod4+Shift+e exit
+
+# resize window (you can also use the mouse for that)
+mode "resize" {
+ # These bindings trigger as soon as you enter the resize mode
+
+ # They resize the border in the direction you pressed, e.g.
+ # when pressing left, the window is resized so that it has
+ # more space on its left
+
+ bindsym h resize shrink left 10 px or 10 ppt
+ bindsym Shift+h resize grow left 10 px or 10 ppt
+
+ bindsym j resize shrink down 10 px or 10 ppt
+ bindsym Shift+j resize grow down 10 px or 10 ppt
+
+ bindsym k resize shrink up 10 px or 10 ppt
+ bindsym Shift+k resize grow up 10 px or 10 ppt
+
+ bindsym l resize shrink right 10 px or 10 ppt
+ bindsym Shift+l resize grow right 10 px or 10 ppt
+
+ # same bindings, but for the arrow keys
+ bindsym Left resize shrink left 10 px or 10 ppt
+ bindsym Shift+Left resize grow left 10 px or 10 ppt
+
+ bindsym Down resize shrink down 10 px or 10 ppt
+ bindsym Shift+Down resize grow down 10 px or 10 ppt
+
+ bindsym Up resize shrink up 10 px or 10 ppt
+ bindsym Shift+Up resize grow up 10 px or 10 ppt
+
+ bindsym Right resize shrink right 10 px or 10 ppt
+ bindsym Shift+Right resize grow right 10 px or 10 ppt
+
+ # back to normal: Enter or Escape
+ bindsym Return mode "default"
+ bindsym Escape mode "default"
+}
+
+bindsym Mod4+r mode "resize"
+
+# Start i3bar to display a workspace bar (plus the system information i3status
+# finds out, if available)
+bar {
+ status_command i3status
+}
+
+exec xrdb -merge $HOME/.Xresources
+exec setxkbmap us -variant dvorak -option compose:ralt -option caps:ctrl_modifier
+exec google-chrome &
diff --git a/vimrc b/vimrc
new file mode 100755
index 0000000..c4e92e5
--- /dev/null
+++ b/vimrc
@@ -0,0 +1,80 @@
+let mapleader = ","
+syntax on
+
+filetype off
+set rtp+=~/.vim/bundle/Vundle.vim
+call vundle#begin()
+" TODO(orbekk): Try ctrlp.vim instead.
+" Plugin 'wincent/command-t'
+Plugin 'chriskempson/vim-tomorrow-theme'
+Plugin 'farseer90718/vim-taskwarrior'
+Plugin 'gmarik/Vundle.vim'
+call vundle#end()
+
+set modeline
+set tabpagemax=20
+set autoread
+set noswapfile
+set timeoutlen=1000
+set ignorecase
+set expandtab
+set smarttab
+set smartcase
+set incsearch
+set autoindent
+set formatoptions=crt
+setglobal fileencoding=utf-8
+set fileencodings=ucs-bomb,utf-8,latin1
+set virtualedit=block
+set hidden
+set confirm
+inoremap <C-c> <nop>
+set hlsearch
+
+filetype plugin on
+filetype indent on
+
+setlocal complete+=ktags
+
+nmap <silent> <C-N> :silent noh<CR>
+map <leader>cd :cd %:p:h<CR>:pwd<CR>
+
+set wildignore+=*.class,target/*,project/*
+
+set guifont=DroidSansMono\ 10
+set guioptions-=m
+set guioptions-=T
+set guioptions-=r
+colorscheme Tomorrow
+
+set colorcolumn=81
+
+map <leader>R :source ~/.vimrc<CR>
+
+function! GetFileBase()
+ return substitute(expand("%"),
+ \ '\(.\{-}\)\(_test\|_unittest\)\?\.\(h\|cc\)$', '\1', "")
+endfunction
+
+" Switch between cc, h, test/unittest files.
+function! EditCc()
+ exec "edit " . fnameescape(GetFileBase() . ".cc")
+endfunction
+map <leader>cc :silent :call EditCc()<CR>
+
+function! EditH()
+ exec "edit " . fnameescape(GetFileBase() . ".h")
+endfunction
+map <leader>h :silent :call EditH()<CR>
+
+function! EditTest()
+ let file_base = GetFileBase()
+ if (filereadable(file_base . "_unittest.cc"))
+ exec "edit " . fnameescape(file_base . "_unittest.cc")
+ else
+ exec "edit " . fnameescape(file_base . "_test.cc")
+ endif
+endfunction
+map <leader>te :silent :call EditTest()<CR>
+
+source ~/.vimrc.local