Skip to content

Instantly share code, notes, and snippets.

@ravster
Last active March 22, 2025 16:00
Show Gist options
  • Select an option

  • Save ravster/4956733 to your computer and use it in GitHub Desktop.

Select an option

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)
-- ~/.config/nvim/init.lua
-- Bootstrap lazy.nvim
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not (vim.uv or vim.loop).fs_stat(lazypath) then
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
if vim.v.shell_error ~= 0 then
vim.api.nvim_echo({
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
{ out, "WarningMsg" },
{ "\nPress any key to exit..." },
}, true, {})
vim.fn.getchar()
os.exit(1)
end
end
vim.opt.rtp:prepend(lazypath)
-- Make sure to setup `mapleader` and `maplocalleader` before
-- loading lazy.nvim so that mappings are correct.
-- This is also a good place to setup other settings (vim.opt)
vim.g.mapleader = " "
vim.g.maplocalleader = "\\"
-- Setup lazy.nvim
require("lazy").setup({
spec = {
{
'nvim-telescope/telescope.nvim', tag = '0.1.8',
dependencies = { 'nvim-lua/plenary.nvim' }
},
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 }
},
checker = { enabled = true },
})
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = 'Telescope find files' })
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = 'Telescope live grep' })
vim.keymap.set('n', '<leader>fb', builtin.buffers, { desc = 'Telescope buffers' })
vim.o.ignorecase = true
vim.keymap.set("n", "<leader>w", ":w<cr>")
vim.keymap.set("n", "<leader>d", ":bd<cr>")
vim.keymap.set("n", "<leader>x", ":x<cr>")
vim.keymap.set("n", "<leader><", "/<<<<<cr>zt")
-- To delete git branches after the buffer has the output of "gf"
vim.keymap.set("n", "<leader>gbd", "dd0<C-v>f/ggdigit branch -D <esc>VGJ<esc> w")
-- Select A or B in git merge conflicts
vim.keymap.set("n", "<leader>ga", "ddk/====<CR>V/>>>><CR>d")
vim.keymap.set("n", "<leader>gb", "V/====<CR>dk/>>>><CR>dd")
vim.cmd("iabbrev clog console.log(")
vim.cmd.colorscheme "catppuccin"
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