Update dotfiles

This commit is contained in:
2017-07-03 14:56:36 +03:00
parent 58f160ccd0
commit ce84479f82
9 changed files with 206 additions and 119 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
.notion/*.bkp
.notion/*session*
.notion/log.txt

View File

@@ -109,8 +109,8 @@ defbindings("WClientWin", {
"programs' resizing problems."), "programs' resizing problems."),
kpress_wait(META.."L", "WClientWin.nudge(_)"), kpress_wait(META.."L", "WClientWin.nudge(_)"),
bdoc("Kill client owning the client window."), -- bdoc("Kill client owning the client window."),
kpress("C", "WClientWin.kill(_)"), -- kpress("C", "WClientWin.kill(_)"),
bdoc("Send next key press to the client window. ".. bdoc("Send next key press to the client window. "..
"Some programs may not allow this by default."), "Some programs may not allow this by default."),
@@ -134,7 +134,7 @@ defbindings("WGroupCW", {
defbindings("WMPlex", { defbindings("WMPlex", {
bdoc("Close current object."), bdoc("Close current object."),
kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"), kpress_wait(META.."Shift+C", "WRegion.rqclose_propagate(_, _sub)"),
}) })
-- Frames for transient windows ignore this bindmap -- Frames for transient windows ignore this bindmap
@@ -143,13 +143,13 @@ defbindings("WMPlex.toplevel", {
kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"), kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"),
bdoc("Lock screen"), bdoc("Lock screen"),
kpress(META.."L", "notioncore.exec_on(_, 'locker')"), kpress(META.."Shift+L", "notioncore.exec_on(_, 'locker')"),
--bdoc("Query for manual page to be displayed."), bdoc("Query for manual page to be displayed."),
--kpress(META.."F1", "mod_query.query_man(_, ':man')"), kpress(META.."F1", "mod_query.query_man(_, ':man')"),
bdoc("Show the Notion manual page."), -- bdoc("Show the Notion manual page."),
kpress(META.."F1", "ioncore.exec_on(_, ':man notion')"), -- kpress(META.."F1", "ioncore.exec_on(_, ':man notion')"),
bdoc("Run password menu."), bdoc("Run password menu."),
kpress(META.."V", "ioncore.exec_on(_, '/home/kressh/scripts/passmenu.sh')"), kpress(META.."V", "ioncore.exec_on(_, '/home/kressh/scripts/passmenu.sh')"),
@@ -158,7 +158,7 @@ defbindings("WMPlex.toplevel", {
--kpress(META.."T", "mod_query.exec_on_merr(_, XTERM or 'urxvt')"), --kpress(META.."T", "mod_query.exec_on_merr(_, XTERM or 'urxvt')"),
bdoc("Run a browser."), bdoc("Run a browser."),
kpress(META.."B", "mod_query.exec_on_merr(_, BROWSER or 'vimb')"), kpress(META.."Shift+B", "mod_query.exec_on_merr(_, BROWSER or 'vimb')"),
bdoc("Query for command line to execute."), bdoc("Query for command line to execute."),
kpress(META.."F2", "mod_query.query_exec(_)"), kpress(META.."F2", "mod_query.query_exec(_)"),
@@ -169,17 +169,17 @@ defbindings("WMPlex.toplevel", {
--bdoc("Query for host to connect to with SSH."), --bdoc("Query for host to connect to with SSH."),
--kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"), --kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"),
bdoc("Zumhotface file!."), -- bdoc("Zumhotface file!."),
kpress(META.."Z", -- kpress(META.."Z",
"mod_query.query_runfile(_, 'zhfup -f')"), -- "mod_query.query_runfile(_, 'zhfup -f')"),
--
bdoc("Zumhotface from buffer."), -- bdoc("Zumhotface from buffer."),
kpress(META.."X", -- kpress(META.."X",
"ioncore.exec_on(_, 'zhfclip')"), -- "ioncore.exec_on(_, 'zhfclip')"),
--
bdoc("Zumhotface screen."), -- bdoc("Zumhotface screen."),
kpress(META.."Print", -- kpress(META.."Print",
"ioncore.exec_on(_, 'zhfscreen')"), -- "ioncore.exec_on(_, 'zhfscreen')"),
bdoc("Query for file to view."), bdoc("Query for file to view."),
kpress(META.."F3", kpress(META.."F3",

View File

@@ -34,17 +34,13 @@ local battery_timer
-- Read the battery battery info -- Read the battery battery info
local function read_battery_data () local function read_battery_data ()
-- assume only one of possible two batteries is present: local f = assert(io.popen("upower -i /org/freedesktop/UPower/devices/battery_BAT0"))
local f = assert(io.open("/sys/class/power_supply/BAT0/uevent", "r"))
local data = f:read("*all") local data = f:read("*all")
f:close() f:close()
local f = assert(io.popen("acpi -b | awk '{ print $5 }'")) local _, _, capacity = string.find(data, "percentage:%s*(%d+)")
local remaining = f:read("*all") local _, _, remaining = string.find(data, "time to %w+:%s*(%d+\.?%d*%s*%w*)")
f:close() local _, _, status = string.find(data, "state:%s*(%w+)")
local _, _, capacity = string.find(data, "POWER_SUPPLY_CAPACITY=(%d+)")
local _, _, status = string.find(data, "POWER_SUPPLY_STATUS=(%w+)")
return status, tonumber(capacity), remaining return status, tonumber(capacity), remaining
end end

View File

@@ -61,6 +61,7 @@ Plugin 'fatih/vim-go'
Plugin 'wavded/vim-stylus' Plugin 'wavded/vim-stylus'
Plugin 'tpope/vim-haml' Plugin 'tpope/vim-haml'
Plugin 'digitaltoad/vim-jade' Plugin 'digitaltoad/vim-jade'
Plugin 'Glench/Vim-Jinja2-Syntax'
" CVS " CVS
Plugin 'phleet/vim-mercenary' Plugin 'phleet/vim-mercenary'
@@ -69,6 +70,7 @@ Plugin 'mattn/calendar-vim'
Plugin 'vim-scripts/vimwiki' Plugin 'vim-scripts/vimwiki'
" Plugin 'mhinz/vim-startify' " Plugin 'mhinz/vim-startify'
Plugin 'ngmy/vim-rubocop' Plugin 'ngmy/vim-rubocop'
Plugin 'editorconfig/editorconfig-vim'
Plugin 'tpope/vim-surround' Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim' Plugin 'kien/ctrlp.vim'
" Plugin 'mileszs/ack.vim' " Plugin 'mileszs/ack.vim'
@@ -195,10 +197,12 @@ let g:neomake_message_sign = {
augroup my_neomake_signs augroup my_neomake_signs
au! au!
autocmd ColorScheme * autocmd ColorScheme *
\ hi NeomakeErrorSign ctermfg=white | \ hi NeomakeErrorSign ctermfg=red |
\ hi NeomakeWarningSign ctermfg=yellow \ hi NeomakeWarningSign ctermfg=yellow
augroup END augroup END
let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*']
" Syntastic " Syntastic
" let g:syntastic_ruby_checkers = ['rubocop'] " let g:syntastic_ruby_checkers = ['rubocop']
"let g:syntastic_shell = "/bin/sh" "let g:syntastic_shell = "/bin/sh"

108
.rubocop.yml Normal file
View File

@@ -0,0 +1,108 @@
---
AllCops:
TargetRubyVersion: 2.4
Include:
- 'vendor/gems/**/*'
Exclude:
- 'db/**/*'
- 'config/**/*'
- 'script/**/*'
Rails:
Enabled: true
Rails/HttpPositionalArguments:
Exclude:
- 'spec/**/*_spec.rb'
Rails/TimeZone:
Enabled: false
Rails/Date:
Enabled: false
Metrics/BlockLength:
Exclude:
- 'spec/**/*_spec.rb'
# Commonly used screens these days easily fit more than 80 characters.
Metrics/LineLength:
Max: 120
# Too short methods lead to extraction of single-use methods, which can make
# the code easier to read (by naming things), but can also clutter the class
Metrics/MethodLength:
Max: 20
Metrics/ParameterLists:
Max: 8
# This is too subjective
Style/SymbolArray:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/CollectionMethods:
Enabled: true
PreferredMethods:
# inject seems more common in the community.
reduce: 'inject'
Style/FrozenStringLiteralComment:
Enabled: false
# Either allow this style or don't. Marking it as safe with parenthesis
# is silly. Let's try to live without them for now.
Style/ParenthesesAroundCondition:
AllowSafeAssignment: false
Lint/AssignmentInCondition:
AllowSafeAssignment: false
# Fail is an alias of raise. Avoid aliases, it's more cognitive load for no gain.
# The argument that fail should be used to abort the program is wrong too,
# there's Kernel#abort for that.
Style/SignalException:
EnforcedStyle: only_raise
# Check with yard instead.
Style/Documentation:
Enabled: false
# aligns the following lines with one level of indentation relative to
# the start of the line with the method call.
#
# method_call(a,
# b)
#
Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation
Style/BlockDelimiters:
Enabled: false
# free to use alias and alias_method
Style/Alias:
Enabled: false
# Prefer numbers without delimeters
Style/NumericLiterals:
Enabled: false
Style/LambdaCall:
Enabled: false
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Style/NumericPredicate:
EnforcedStyle: comparison
Style/AndOr:
Enabled: true
Exclude:
- 'app/controllers/**/*'

96
.zshrc
View File

@@ -3,27 +3,6 @@ if [ -d $HOME/bin ] ; then
PATH=$HOME/bin:$PATH PATH=$HOME/bin:$PATH
fi fi
# autoload colors && colors
# aliases
alias sdr="screen -aAdr"
alias la="ls -A"
alias ll="ls -lAF"
alias grep='grep --exclude="*.svn*" --exclude="*.git*"'
alias iddqd="sudo -s"
alias mkpasswd="head -c16 /dev/urandom | xxd -ps"
# alias mc="mc -b"
alias ls='ls --color=auto'
alias less='vimpager'
# fix_mp3() { find -iname '*.mp3' -print0 | xargs -0 mid3iconv -eCP1251 --remove-v1 }
# mpg2flv() { ffmpeg -i $1 -ar 22050 -ab 32 -f flv -s 320x240 `echo $1 | awk -F . '{print $1}'`.flv }
mcd() { mkdir $1; cd $1 }
newday() { mcd `date +%F` }
c() { awk "{ print \$$1 }" }
ed2pull() { for i in `ls ./engines`; do echo "./engines/$i"; cd ./engines/$i; git pull; cd ../..; done; }
ed2st() { for i in `ls ./engines`; do echo "./engines/$i"; cd ./engines/$i; git st; cd ../..; done; }
# Lines configured by zsh-newuser-install # Lines configured by zsh-newuser-install
HISTFILE=~/.histfile HISTFILE=~/.histfile
HISTSIZE=1000 HISTSIZE=1000
@@ -47,21 +26,15 @@ setopt AUTO_CD
# SPROMPT='zsh: Исправить '\''%R'\'' на '\''%r'\'' ? [Yes/No/Abort/Edit] ' # SPROMPT='zsh: Исправить '\''%R'\'' на '\''%r'\'' ? [Yes/No/Abort/Edit] '
setopt notify globdots pushdtohome cdablevars autolist # correct setopt notify globdots pushdtohome cdablevars autolist # correct
setopt recexact longlistjobs setopt recexact longlistjobs
setopt autoresume histignoredups pushdsilent noclobber setopt autoresume histignoredups pushdsilent noclobber
setopt autopushd pushdminus rcquotes mailwarning extendedglob setopt autopushd pushdminus rcquotes mailwarning extendedglob
# End of lines configured by zsh-newuser-install # End of lines configured by zsh-newuser-install
# The following lines were added by compinstall # The following lines were added by compinstall
zstyle :compinstall filename '/home/kressh//.zshrc' zstyle :compinstall filename '/home/kressh//.zshrc'
bindkey -e bindkey -e
autoload -U zcalc autoload -U zcalc
autoload -Uz compinit autoload -Uz compinit
compinit compinit
zmodload -a zsh/stat stat zmodload -a zsh/stat stat
@@ -81,23 +54,7 @@ eval `dircolors`
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
export GREP_COLOR='1;32' export GREP_COLOR='1;32'
if [ -f /usr/bin/grc ]; then
alias ping="grc --colour=auto ping"
alias traceroute="grc --colour=auto traceroute"
alias make="grc --colour=auto make"
alias diff="grc --colour=auto diff"
alias cvs="grc --colour=auto cvs"
alias netstat="grc --colour=auto netstat"
alias mount="grc --colour=auto mount"
alias ifconfig="grc --colour=auto ifconfig"
alias dig="grc --colour=auto dig"
alias ps="grc --colour=auto ps"
fi
myip() {links -source http://www.formyip.com/ |grep The | awk {'print $5'}}
## key binds Pgup pgdown, home, end ## key binds Pgup pgdown, home, end
bindkey "^[[2~" yank bindkey "^[[2~" yank
bindkey "^[[3~" delete-char bindkey "^[[3~" delete-char
bindkey "^[[5~" up-line-or-history bindkey "^[[5~" up-line-or-history
@@ -172,54 +129,13 @@ esac
export LANGUAGE="en_US:en_GB:en" export LANGUAGE="en_US:en_GB:en"
# RVM stuff
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
# rbenv stuff
unset RUBYOPT
PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source $HOME/.rbenv/completions/rbenv.zsh
# bundler aliases
alias rails="bundle exec rails"
alias hanami="bundle exec hanami"
alias rake="bundle exec rake"
alias rspec="bundle exec rspec"
alias foreman="bundle exec foreman"
alias sidekiq="bundle exec sidekiq"
alias cap="bundle exec cap"
alias mina="bundle exec mina"
alias heroku="$HOME/Soft/heroku-client/bin/heroku"
alias rgrep="grep --exclude-dir=Godeps --exclude-dir=node_modules --exclude-dir=log --exclude-dir=vendor --exclude-dir=tmp --exclude-dir=public --exclude-dir=.git --exclude=.swp -rn"
alias vagrant="BUNDLE_GEMFILE=$HOME/Soft/vagrant/Gemfile bundle exec vagrant"
alias vimb="HTTP_PROXY='http://localhost:8118' vimb"
alias chromium="chromium --proxy-server='localhost:8118'"
alias grep="grep --color=auto"
alias bdocker="DOCKER_HOST=tcp://10.8.0.1:2375 docker"
alias wiki="cd ~/wiki && vim index.md"
alias gwiki="cd ~/wiki && gvim index.md"
alias gulp-watch="./node_modules/.bin/gulp watch; notify-send -i error 'Gulp has crashed'"
alias weather="curl wttr.in/Moscow"
alias ag="ag --path-to-ignore ~/.agignore"
export PATH="$HOME/.dynamic-colors/bin:$PATH" export PATH="$HOME/.dynamic-colors/bin:$PATH"
#export PATH="$HOME/Soft/vagrant/bin:$PATH"
# Google SDK
export CLOUDSDK_PYTHON=/usr/bin/python2
# The next line updates PATH for the Google Cloud SDK.
source '/home/kressh/Soft/google-cloud-sdk/path.zsh.inc'
# The next line enables bash completion for gcloud.
source '/home/kressh/Soft/google-cloud-sdk/completion.zsh.inc'
source $HOME/.dynamic-colors/completions/dynamic-colors.zsh source $HOME/.dynamic-colors/completions/dynamic-colors.zsh
function git-commit-random() { # Load all files from .shell/zshrc.d directory
curl -s http://whatthecommit.com/index.txt | git commit -em if [ -d $HOME/.zshrc.d ]; then
} for file in $HOME/.zshrc.d/*.zsh; do
source $file
done
fi

42
.zshrc.d/aliases.zsh Normal file
View File

@@ -0,0 +1,42 @@
# aliases
alias sdr="screen -aAdr"
alias la="ls -A"
alias ll="ls -lAF"
alias grep='grep --exclude="*.svn*" --exclude="*.git*"'
alias mkpasswd="head -c16 /dev/urandom | xxd -ps"
alias mc="mc -b"
alias ls='ls --color=auto'
alias less='vimpager'
if [ -f /usr/bin/grc ]; then
alias ping="grc --colour=auto ping"
alias traceroute="grc --colour=auto traceroute"
alias make="grc --colour=auto make"
alias diff="grc --colour=auto diff"
alias cvs="grc --colour=auto cvs"
alias netstat="grc --colour=auto netstat"
alias mount="grc --colour=auto mount"
alias ifconfig="grc --colour=auto ifconfig"
alias dig="grc --colour=auto dig"
alias ps="grc --colour=auto ps"
fi
# bundler aliases
alias rails="bundle exec rails"
alias hanami="bundle exec hanami"
alias rake="bundle exec rake"
alias rspec="bundle exec rspec"
alias foreman="bundle exec foreman"
alias sidekiq="bundle exec sidekiq"
alias cap="bundle exec cap"
alias mina="bundle exec mina"
alias heroku="$HOME/Soft/heroku-client/bin/heroku"
alias rgrep="grep --exclude-dir=Godeps --exclude-dir=node_modules --exclude-dir=log --exclude-dir=vendor --exclude-dir=tmp --exclude-dir=public --exclude-dir=.git --exclude=.swp -rn"
alias grep="grep --color=auto"
alias wiki="cd ~/wiki && vim index.md"
alias xwiki="cd ~/wiki && xvim index.md"
alias gulp-watch="./node_modules/.bin/gulp watch; notify-send -i error 'Gulp has crashed'"
alias weather="curl wttr.in/Moscow"
alias ag="ag --path-to-ignore ~/.agignore --nogroup"
alias vim="nvim"

7
.zshrc.d/rbenv.zsh Normal file
View File

@@ -0,0 +1,7 @@
# rbenv stuff
unset RUBYOPT
PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
source $HOME/.rbenv/completions/rbenv.zsh

11
.zshrc.d/ssh-agent.zsh Normal file
View File

@@ -0,0 +1,11 @@
ssh-add -l > /dev/null 2>&1
if [ "$?" == 2 ]; then
test -r $HOME/.ssh-agent && eval "$(<$HOME/.ssh-agent)" > /dev/null 2>&1
ssh-add -l > /dev/null 2>&1
if [ "$?" == 2 ]; then
(umask 066; ssh-agent > $HOME/.ssh-agent)
eval "$(<$HOME/.ssh-agent)" > /dev/null
ssh-add
fi
fi