Skip to content

Instantly share code, notes, and snippets.

@pymen
pymen / zsh_alias_commands
Created December 15, 2013 10:00
ZSH Commands
#zsh configs
############### INSERT LAST COMMAND OUTPUT ################
zmodload -i zsh/parameter
insert-last-command-output() {
LBUFFER+=" $(eval $history[$((HISTCMD-1))])"
}
zle -N insert-last-command-output
bindkey "^X^X" insert-last-command-output
###########################################################
@pymen
pymen / gist:7971183
Created December 15, 2013 10:18
Mudasobwa yadr theme for python virtualenv
################ mudasobwa prompt ##################
for config_file ($HOME/.yadr/zsh/*.zsh) source $config_file
autoload -U colors && colors
autoload -Uz promptinit
promptinit
prompt mudasobwa
################################################
#EDIT MAIN THEME ###############################
@pymen
pymen / zsh_abbreviations
Last active November 27, 2018 17:51
zsh abbreviations
#http://zshwiki.org/home/examples/zleiab
typeset -Ag abbreviations
abbreviations=(
"Im" "| more"
"Ia" "| awk"
"Ig" "| grep"
"Ieg" "| egrep"
"Iag" "| agrep"
"Igr" "| groff -s -p -t -e -Tlatin1 -mandoc"
@pymen
pymen / gist:7972623
Created December 15, 2013 12:47 — forked from nummi/gist:47474
function cd() { builtin cd $1 && ls }
function pman() { man -t "${1}" | open -f -a /Applications/Preview.app }
function preview() { open -a Preview $* }
# Force 'sudo zsh' to start root as a loging shell to
# avoid problems with environment clashes
function sudo() {
if [[ $1 = "zsh" ]]; then
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@pymen
pymen / virtualenv.zsh
Created December 15, 2013 13:05 — forked from tek/virtualenv.zsh
virtualEnv with zsh hooks
typeset -A virtualenv_map
virtualenv_map=()
for file in ~/.virtualenvs/*/.project(N)
virtualenv_map[${file:h:t}]=$(<$file)
virtualenv_chpwd()
{
setopt local_options no_auto_pushd
local project_path longest_path new_venv
if [[ $ZSH_SUBSHELL == 0 ]] && \
@pymen
pymen / auto_virtualenv_hooks
Last active December 31, 2015 10:29
auto_virtualenv_hooks + wrapper just create .venv file in project dir with 1st line - name of env
############################# HOOKS #####################
#function virtualenv_preexec() {
function virtualenv_precmd(){
FOUND_ENV=0;
x=`pwd`;
while [ "$x" != "/" ] ; do ;
#echo "$x";
if [ `find "$x" -maxdepth 1 -name .venv` ]; then
FOUND_ENV=1;
@pymen
pymen / zsh_alias_part
Created December 15, 2013 16:07
my zsh aliases 12.2013
########################### ALIASES
alias _='sudo'
alias ll="ls -al"
alias sz="source ~/.zshrc"
#Opens current directory in a file explorer
alias ex='doublecmd .'
#Opens current directory in a file explorer with super user privileges
alias suex='sudo doublecmd .'
@pymen
pymen / krusader_create_konsole
Last active January 1, 2016 16:59
Konsole and krusader quake-style start, activate of hide by one command set hotkey and have fun!
name="Krusader";
session_num=$(qdbus org.kde.konsole /Konsole newSession)
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num setTitle 0 $name
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num setTitle 1 $name
sleep 0.03
qdbus org.kde.konsole /Sessions/$session_num sendText "cd $1"
sleep 0.03