Skip to content

Instantly share code, notes, and snippets.

@ravster
Last active August 11, 2020 19:00
Show Gist options
  • Save ravster/4956733 to your computer and use it in GitHub Desktop.
Save ravster/4956733 to your computer and use it in GitHub Desktop.
My dotfiles
cat <<EOF > .agignore
log
tags
tmp
vendor
.git/
bower_components/
node_modules/
coverage/
TAGS
_build/
EOF
cat <<EOF > .bash_aliases
alias be="bundle exec"
alias bi="bundle install"
alias gs="git status"
alias gd="git diff"
alias gg='git gui'
alias gk='gitk --all'
alias delmerged='git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'
repull() {
git checkout master
git branch -D "$1"
git checkout "$1"
}
alias e='emacs -nw'
branches() {
git branch --contains "$1"
}
EOF
cat <<EOF >> .bashrc
export TERM=xterm-256color
source ~/.git-prompt.sh
alias ls='ls --color=auto'
export EDITOR="/usr/bin/emacs"
export CLICOLOR=1
export PS1='\w|\[\e[0;32m\]$(__git_ps1)\[\e[0m\] $ '
export DISABLE_SPRING=1
EOF
cat <<EOF > .ctags
--exclude=node_modules
--exclude=vendor
--exclude=_build
--exclude=deps
--exclude=tmp
--exclude=coverage
--langmap=Ruby:.rb.rake
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/
--regex-ruby=/^[ \t]*attr_(reader|writer|accessor) (:[a-z0-9_]+, )*:([a-z0-9_]+)/\3/A,attr/
--regex-ruby=/^[ \t]*scope :([a-z0-9_]+), ->/\1/f,methods/
--regex-ruby=/^[ \t]*let\(:([a-z0-9_]+)\) \{/\1/
--langdef=Elixir
--langmap=Elixir:.ex.exs
--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/
--regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/
--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/
--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/
--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/
--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/
--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/
--regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/
--regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/
EOF
mkdir -p ~/.config/git
cat <<EOF > ~/.config/git/ignore
*~
.idea/
jmeter.log
**/rubymine_passenger_debug.rb
.ruby-version
TAGS
.byebug_history
EOF
(electric-pair-mode 1)
(setq default-tab-width 4)
(setq js-indent-level 2)
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
;; Always show matching parentheses
(show-paren-mode 1)
;; Remove the toolbar & the menu bar
(if window-system
(tool-bar-mode -1))
(menu-bar-mode -1)
(add-to-list 'auto-mode-alist
'("\.\(?:gemspec\|irbrc\|gemrc\|rake\|rb\|ru\|thor\)\'" . ruby-mode))
(add-to-list 'auto-mode-alist
'("\(Capfile\|Gemfile\(?:\.[a-zA-Z0-9._-]+\)?\|[rR]akefile\)\'" . ruby-mode))
(add-hook 'ruby-mode-hook
(lambda ()
(highlight-indentation-mode 1)))
(setq ruby-deep-indent-paren nil)
(setq ruby-insert-encoding-magic-comment nil)
;;; Magit key-binding
(global-set-key (kbd "C-x g") 'magit-status)
;;; Remove whitespace on close
(add-hook 'before-save-hook 'delete-trailing-whitespace)
(global-set-key (kbd "C-c <left>") 'windmove-left)
(global-set-key (kbd "C-c <right>") 'windmove-right)
(global-set-key (kbd "C-c <up>") 'windmove-up)
(global-set-key (kbd "C-c <down>") 'windmove-down)
(ivy-mode 1)
(global-set-key (kbd "C-s") 'swiper)
(global-set-key (kbd "M-x") 'counsel-M-x)
(global-set-key (kbd "C-x C-f") 'counsel-find-file)
(global-set-key (kbd "C-c g") 'counsel-git)
(global-set-key (kbd "C-c j") 'counsel-git-grep)
(global-set-key (kbd "C-c k") 'counsel-ag)
(fset 'byebug
"\C-mbyebug if $a")
(fset 'ife
"if err != nil {\C-m")
(fset 'f
"fmt.Println(")
(fset '\90
"\C-a\C-u90\C-f\C-[b\C-[j\C-a")
(fset 'i
"\C-m\C-iRails.logger.info(")
(fset 'l
"\C-mlog.Printf(\"")
(put 'upcase-region 'disabled nil)
(add-hook 'before-save-hook #'gofmt-before-save)
sudo apt-get install -y python-software-properties software-properties-common
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install -y emacs24 tmux git exuberant-ctags silversearcher-ag
sudo ln -sf /usr/bin/ctags-exuberant /usr/bin/ctags
ls -l /usr/bin/ctags*
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
. ~/.bashrc
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
cat <<EOF > .tmux.conf
unbind C-b
set -g prefix f2
bind-key '"' split-window -c '#{pane_current_path}'
bind-key % split-window -h -c "#{pane_current_path}"
bind-key c new-window -c "#{pane_current_path}"
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment