Skip to content

Instantly share code, notes, and snippets.

View apux's full-sized avatar

Azarel Doroteo Pacheco apux

View GitHub Profile
@apux
apux / vim_1_basic_configuration.md
Last active March 3, 2017 16:16
List of github repositories for vim

Configuring Vim to work with Rails

Basic configuration

Vim is an extremely powerful text editor, especially for developers. Here, I'll share some of the tips I use working with it on Rails projects. This is not pretended to be a guide about how to use vim, but just to show my most common configuration that I find useful.

No Compatible

Vim is, by default, compatible with vi (the text editor which vim is based in). This is good if you work a lot with both applications because you'll want to have the same experience as user, but the cost of this compatibility is you lose all new features vim supports and vi doesn't. So, since I only use vim, I disable the vi compatibility.

@apux
apux / cd_functions.plugin.zsh
Created September 7, 2012 00:39
zsh functions
cdl() { cd ~/Projects/Ruby/RoR/lbs/$1; }
_cdl() { _files -W ~/Projects/Ruby/RoR/lbs -/; }
compdef _cdl cdl
cdo() { cd ~/Projects/Ruby/RoR/own/$1; }
_cdo() { _files -W ~/Projects/Ruby/RoR/own -/; }
compdef _cdo cdo
@apux
apux / vim_regex.md
Last active August 4, 2017 15:35
Regex for vim

hash rocket to colon

:%s/:\(\w\+\)\( *\)=>\( *\)/\1: /g

clean trailing spaces

:%s/\s\+$//
@apux
apux / update_multiple_git_repositories.sh
Last active October 7, 2017 06:29
Update multiple git repositories
#!/bin/sh
dirs=`ls -1d */`
for d in $dirs
do
echo $d
echo '======================'
IFS=$'\n' lines=($(cd $d; git pull))
for l in $lines
do
echo $l
@apux
apux / find_and_replace.sh
Last active October 11, 2015 04:48
replace string in multiple files
find . -name "*.rb" | xargs sed -i 's/foo/bar/g'
@apux
apux / apux.zsh-theme
Last active October 12, 2015 09:57
Zsh Theme
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
local rvm=''
if which rvm-prompt &> /dev/null; then
rvm='‹$(rvm-prompt i v g)›'
else
if which rbenv &> /dev/null; then
rvm='‹$(rbenv version | sed -e "s/ (set.*$//")›'
fi
@apux
apux / 1_install_in_chakra.sh
Last active June 14, 2020 15:39
Packages to install in chakra
sudo pacman -Sy --noconfirm postgresql curl git patch virtualbox nodejs redis
sudo pacman -Sy --noconfirm kde-telepathy yakuake
sudo pacman -Sy --noconfirm clementine gstreamer0.10-base-plugins gstreamer0.10-good-plugins gstreamer0.10-bad-plugins gstreamer0.10-ugly-plugins gstreamer0.10-ffmpeg
sudo pacman -Sy libreoffice
ccr -S vim-qt-git
sudo pacman -Sy --noconfirm firefox chromium
#for rvm, usually all these packages are already installed, but just to be sure
sudo pacman -Sy --noconfirm gcc patch curl zlib readline libxml2 libxslt git autoconf automake diffutils make libtool bison libyaml subversion libnotify
@apux
apux / pryrc.rb
Last active December 17, 2015 00:09
my .pryrc
#.pryrc
# Load plugins (only those I whitelist)
Pry.config.should_load_plugins = false
Pry.plugins["doc"].activate!
# Launch Pry with access to the entire Rails stack.
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead.
# If you don't, you can load it through the lines below :)
rails = File.join Dir.getwd, 'config', 'environment.rb'
@apux
apux / vim_textwidth
Last active December 23, 2015 15:29
vim 80 columns
:set textwidth=80
gqG
require 'spec_helper'
<% module_namespacing do -%>
describe <%= controller_class_name %>Controller do
let(:valid_attributes) { <%= formatted_hash(example_valid_attributes) %> }
let(:valid_session) { {} }
<% unless options[:singleton] -%>
describe "GET index" do