From fc49bdf6c482b9ec1bcb4ebd1e76b2b65ba4d98f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Fri, 24 Mar 2017 16:29:31 +0100 Subject: [PATCH] Lots of changes New termite theme Changed i3 configuration Added run script and find_blob script --- Xsession/.xprofile | 4 +- compton/.compton.conf | 2 +- emacs/.emacs.d/custom.el | 9 +++- emacs/.emacs.d/init.el | 92 ++++++++++++++++++++++++++-------- i3/.config/i3/config | 2 +- scripts/.bin/find-blob.sh | 14 ++++++ scripts/.bin/runmenu | 2 +- termite/.config/termite/config | 58 ++++++++++++++------- zsh/.zprofile | 55 -------------------- zsh/.zshrc | 72 ++++++++++++++++++++++++++ 10 files changed, 207 insertions(+), 103 deletions(-) create mode 100755 scripts/.bin/find-blob.sh diff --git a/Xsession/.xprofile b/Xsession/.xprofile index b310a1d..6ddd83e 100755 --- a/Xsession/.xprofile +++ b/Xsession/.xprofile @@ -2,5 +2,5 @@ setxkbmap us altgr-intl -option ctrl:nocaps #xmodmap ~/.Xmodmap #source ~/.xinitrc -export XTERMINAL=xfce4-terminal -export TERMINAL=xfce4-terminal +export XTERMINAL=termite +export TERMINAL=termite \ No newline at end of file diff --git a/compton/.compton.conf b/compton/.compton.conf index 07e12a9..1948861 100644 --- a/compton/.compton.conf +++ b/compton/.compton.conf @@ -24,7 +24,7 @@ shadow-exclude = [ # Opacity mark-override-focused = true; menu-opacity = 0.9; -inactive-opacity = 0.8; +inactive-opacity = 0.9; # active-opacity = 0.8; frame-opacity = 0.7; inactive-opacity-override = true; diff --git a/emacs/.emacs.d/custom.el b/emacs/.emacs.d/custom.el index 9082f95..fda8377 100644 --- a/emacs/.emacs.d/custom.el +++ b/emacs/.emacs.d/custom.el @@ -3,12 +3,17 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. + '(ansi-color-names-vector + ["#101010" "#7c7c7c" "#8e8e8e" "#a0a0a0" "#686868" "#747474" "#686868" "#b9b9b9"]) + '(ansi-term-color-vector + [unspecified "#101010" "#7c7c7c" "#8e8e8e" "#a0a0a0" "#686868" "#747474" "#686868" "#b9b9b9"]) '(custom-safe-themes (quote - ("3a3917dbcc6571ef3942c2bf4c4240f70b5c4bc0b28192be6d3f9acd83607a24" "b6db49cec08652adf1ff2341ce32c7303be313b0de38c621676122f255ee46db" "b6d649c9f972b491686e7fa634535653e6222c1faca1ab71b3117854470a79ae" "0ae52e74c576120c6863403922ee00340a3bf3051615674c4b937f9c99b24535" "b2028956188cf668e27a130c027e7f240c24c705c1517108b98a9645644711d9" "03e3e79fb2b344e41a7df897818b7969ca51a15a67dc0c30ebbdeb9ea2cd4492" "232f715279fc131ed4facf6a517b84d23dca145fcc0e09c5e0f90eb534e1680f" "aed73c6d0afcf2232bb25ed2d872c7a1c4f1bda6759f84afc24de6a1aec93da8" "0b6645497e51d80eda1d337d6cabe31814d6c381e69491931a688836c16137ed" "cdfb22711f64d0e665f40b2607879fcf2607764b2b70d672ddaa26d2da13049f" "196cc00960232cfc7e74f4e95a94a5977cb16fd28ba7282195338f68c84058ec" default))) + ("3380a2766cf0590d50d6366c5a91e976bdc3c413df963a0ab9952314b4577299" "100eeb65d336e3d8f419c0f09170f9fd30f688849c5e60a801a1e6addd8216cb" "3f67aee8f8d8eedad7f547a346803be4cc47c420602e19d88bdcccc66dba033b" "c968804189e0fc963c641f5c9ad64bca431d41af2fb7e1d01a2a6666376f819c" "50d07ab55e2b5322b2a8b13bc15ddf76d7f5985268833762c500a90e2a09e7aa" "4feee83c4fbbe8b827650d0f9af4ba7da903a5d117d849a3ccee88262805f40d" "fee4e306d9070a55dce4d8e9d92d28bd9efe92625d2ba9d4d654fc9cd8113b7f" "6daa09c8c2c68de3ff1b83694115231faa7e650fdbb668bc76275f0f2ce2a437" "1263771faf6967879c3ab8b577c6c31020222ac6d3bac31f331a74275385a452" "ec13410d459f1b67158c500d13d290560fc4dad2edaaa22e33a4d1df08e8f887" "34ed3e2fa4a1cb2ce7400c7f1a6c8f12931d8021435bad841fdc1192bd1cc7da" "8cf1002c7f805360115700144c0031b9cfa4d03edc6a0f38718cef7b7cabe382" "12670281275ea7c1b42d0a548a584e23b9c4e1d2dabb747fd5e2d692bcd0d39b" "21e380db38e92e8c0e56e0a2446f7ac8f6851061b57ffbcadb284ffe4c102478" "91fba9a99f7b64390e1f56319c3dbbaed22de1b9676b3c73d935bf62277b799c" "b1bcb837df0455af8e91114b7a3bddfa084cde32ceb16b1b468d5e5e8605a835" "e24679edfdea016519c0e2d4a5e57157a11f928b7ef4361d00c23a7fe54b8e01" "9f6750057fefba39c184783c7b80ddd9c63bc6e8064846b423b4362c9e930404" "d43120398682953ef18fd7e11e69c94e44d39bb2ab450c4e64815311542acbff" "b4ec581daad15aa7020b722523dc6bcea850bfbdbe31bfeb11c45ea51899bd75" "3a3917dbcc6571ef3942c2bf4c4240f70b5c4bc0b28192be6d3f9acd83607a24" "b6db49cec08652adf1ff2341ce32c7303be313b0de38c621676122f255ee46db" "b6d649c9f972b491686e7fa634535653e6222c1faca1ab71b3117854470a79ae" "0ae52e74c576120c6863403922ee00340a3bf3051615674c4b937f9c99b24535" "b2028956188cf668e27a130c027e7f240c24c705c1517108b98a9645644711d9" "03e3e79fb2b344e41a7df897818b7969ca51a15a67dc0c30ebbdeb9ea2cd4492" "232f715279fc131ed4facf6a517b84d23dca145fcc0e09c5e0f90eb534e1680f" "aed73c6d0afcf2232bb25ed2d872c7a1c4f1bda6759f84afc24de6a1aec93da8" "0b6645497e51d80eda1d337d6cabe31814d6c381e69491931a688836c16137ed" "cdfb22711f64d0e665f40b2607879fcf2607764b2b70d672ddaa26d2da13049f" "196cc00960232cfc7e74f4e95a94a5977cb16fd28ba7282195338f68c84058ec" default))) + '(global-hl-line-mode t) '(package-selected-packages (quote - (evil-magit docker password-store gitlab flycheck-cask ensime scala-mode yasnippet yaml-mode slime quelpa-use-package ob-ipython nose n3-mode monokai-theme markdown-mode magit jedi helm-swoop helm-projectile helm-descbinds helm-ag guide-key go-mode go-autocomplete gist flymake-go flycheck exec-path-from-shell evil-surround evil-smartparens evil-paredit evil-org evil-nerd-commenter evil-mu4e evil-matchit evil-leader evil-jumper ein clojure-mode base16-theme auctex ace-jump-mode))) + (github-theme base16-theme hlinum glab neotree evil-magit docker password-store gitlab flycheck-cask ensime scala-mode yasnippet yaml-mode slime quelpa-use-package ob-ipython nose n3-mode monokai-theme markdown-mode magit jedi helm-swoop helm-projectile helm-descbinds helm-ag guide-key go-mode go-autocomplete gist flymake-go flycheck exec-path-from-shell evil-surround evil-smartparens evil-paredit evil-org evil-nerd-commenter evil-mu4e evil-matchit evil-leader evil-jumper ein clojure-mode auctex ace-jump-mode))) '(safe-local-variable-values (quote ((TeX-command-extra-options . "-shell-escape"))))) (custom-set-faces ;; custom-set-faces was added by Custom. diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index a0820cb..666505d 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -37,7 +37,7 @@ (evil-mode) (use-package evil-leader :ensure) (use-package evil-matchit :ensure) - (use-package evil-magit :ensure) + (use-package neotree :ensure) (use-package evil-nerd-commenter :ensure :config (progn @@ -67,6 +67,28 @@ (add-to-list 'evil-emacs-state-modes 'undo-tree-visualizer-mode) (add-to-list 'evil-emacs-state-modes 'dired-mode) + + ;; Neo + (defun neotree-project-dir-toggle () + "Open NeoTree using the project root, using find-file-in-project, +or the current buffer directory." + (interactive) + (let ((project-dir + (ignore-errors + (projectile-project-root) + )) + (file-name (buffer-file-name)) + (neo-smart-open t)) + (if (and (fboundp 'neo-global--window-exists-p) + (neo-global--window-exists-p)) + (neotree-hide) + (progn + (neotree-show) + (if project-dir + (neotree-dir project-dir)) + (if file-name + (neotree-find file-name)))))) + (defun next-code-buffer () ;;; Avoid special buffers when cycling through windows ;;; http://stackoverflow.com/questions/14323516/make-emacs-next-buffer-skip-messages-buffer @@ -96,7 +118,6 @@ (lambda () (let ((color (cond ((minibufferp) default-color) ((evil-insert-state-p) (cons (cdr default-color) (car default-color))) - ((evil-emacs-state-p) default-color) ((buffer-modified-p) '("#ff0000" . "#ffffff")) (t default-color)))) (set-face-background 'mode-line (car color)) @@ -110,7 +131,7 @@ (define-key evil-normal-state-map (kbd "]b") 'next-code-buffer) (define-key evil-normal-state-map (kbd "s") 'evil-ace-jump-char-mode) (define-key evil-normal-state-map (kbd "S") 'evil-ace-jump-word-mode) - (define-key evil-normal-state-map (kbd ",d") 'neotree-toggle) + (define-key evil-normal-state-map (kbd ",d") 'neotree-project-dir-toggle) (define-key evil-normal-state-map (kbd ",u") 'undo-tree-visualize) (define-key evil-normal-state-map (kbd "C-c +") 'evil-numbers/inc-at-pt) @@ -272,16 +293,18 @@ )) -(use-package linum +(use-package hlinum + :ensure :config (progn + (hlinum-activate) (add-hook 'prog-mode-hook 'linum-mode) ) ) -(use-package monokai-theme - :ensure t +(use-package base16-theme + :ensure :config (progn - (load-theme 'monokai) + (load-theme 'base16-tomorrow-night) ) ) @@ -309,10 +332,8 @@ python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: " python-shell-completion-setup-code "from IPython.core.completerlib import module_completion" - python-shell-completion-module-string-code - "';'.join(module_completion('''%s'''))\n" - python-shell-completion-string-code - "';'.join(get_ipython().Completer.all_completions('''%s'''))\n") + python-shell-completion-module-string-code "';'.join(module_completion('''%s'''))\n" + python-shell-completion-string-code "';'.join(get_ipython().Completer.all_completions('''%s'''))\n") (add-hook 'python-mode-hook 'auto-complete-mode) (add-hook 'python-mode-hook '(lambda () (require 'nose))) @@ -342,6 +363,7 @@ ) (defun my-go-mode-hook () ; Use goimports instead of go-fmt + ;; You need to do: go get golang.org/x/tools/cmd/goimports (setq gofmt-command "goimports") ; Call Gofmt before saving (add-hook 'before-save-hook 'gofmt-before-save) @@ -350,7 +372,11 @@ (set (make-local-variable 'compile-command) "go build -v && go test -v && go vet")) ; Godef jump key binding - (local-set-key (kbd "M-.") 'godef-jump)) + (local-set-key (kbd "M-.") 'godef-jump) + (auto-complete-for-go) + ) + (defun auto-complete-for-go () + (auto-complete-mode 1)) (add-hook 'go-mode-hook 'my-go-mode-hook) ) ) @@ -366,7 +392,6 @@ ("scala" . scala-mode)) (use-package ensime - :pin melpa-stable :config (progn (setq ensime-startup-snapshot-notification nil) (use-package flycheck-cask @@ -422,6 +447,13 @@ ) ) + (org-babel-do-load-languages + 'org-babel-load-languages + '( + (sh . t) + (python . t) + )) + (defun org-archive-done-tasks () (interactive) (org-map-entries @@ -475,8 +507,10 @@ (use-package magit :ensure :config (progn - (add-hook 'after-save-hook 'magit-after-save-refresh-status) - ) + (add-hook 'after-save-hook 'magit-after-save-refresh-status) + (define-key evil-normal-state-map (kbd ",g") 'magit-status) + (define-key evil-normal-state-map (kbd "C-c g") 'magit-status) + ) ) @@ -642,6 +676,19 @@ (set-default 'truncate-lines nil) ;;; Highlight line (global-hl-line-mode) +(require 'color) + +(defun set-hl-line-color-based-on-theme () +"Set the hl-line face to have no foregorund and a background that is 10% darker than the default face's background." +(let ((background-color (color-darken-name (face-background 'default) 20))) + (set-face-attribute 'hl-line nil + :foreground nil + :background background-color) + (set-face-attribute 'linum-highlight-face nil + :foreground nil + :background background-color))) + +(add-hook 'global-hl-line-mode-hook 'set-hl-line-color-based-on-theme) ;; (set-face-background 'hl-line 'highlight-color) (setq-default indent-tabs-mode nil) (setq tab-width 4) @@ -709,19 +756,19 @@ :config (progn ) ) -(use-package gitlab - :config (progn - (setq gitlab-host "https://lab.cluster.gsi.dit.upm.es" - gitlab-username "balkian" - ) - ) - ) (use-package docker :config (progn ) ) +(use-package glab + :config (progn + (defconst glab--domain ".lab.cluster.gsi.dit.upm.es") + (defconst glab--root-endpoint "https://lab.cluster.gsi.dit.upm.es/api/v3") + ) + ) + (setq PREVSHELL (getenv "SHELL")) ;; Workaround for tramp (eval-after-load 'tramp '(setenv "SHELL" "/bin/bash")) (setq tramp-default-method "ssh") @@ -748,6 +795,7 @@ ;; Launch terminal (defun open-terminal () + "Open a terminal in the current working directory." (interactive) (call-process (or (getenv "XTERMINAL") "xterm") nil 0 nil "-e" PREVSHELL)) ;; This does not work: (concat "echo -c 'cd " default-directory "'")) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index ab1da08..bca8b3a 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -31,6 +31,7 @@ bindsym Control+Mod1+w exec --no-startup-id i3-one-instance firefox bindsym Control+Mod1+g exec --no-startup-id i3-one-instance gvim bindsym Control+Mod1+e exec --no-startup-id myemacs -c bindsym $mod+Tab exec --no-startup-id winmenu.sh +bindsym Mod1+Tab exec --no-startup-id winmenu.sh bindsym $mod+p [class="Nemo"] scratchpad show bindsym $mod+period [instance="emacs" title="^(?!myagenda$)"] scratchpad show bindsym $mod+shift+comma exec --no-startup-id myemacs -nc --eval '(progn (find-file "~/Dropbox/Todo/org/rules.org") (org-agenda-list) (set-frame-name "myagenda"))' @@ -302,7 +303,6 @@ bindsym $mod+Escape exec xfce4-session-logout #exec xautolock -time 10 -corners "----" -locker 'i3lock -t -c 000000 -i ~/Pictures/Wallpapers/Game\ Over\ Hacker.png' & exec --no-startup-id compton -b --config ~/.compton.conf exec --no-startup-id dropbox start -exec --no-startup-id dunst -conf ~/.config/dunst/dunst.conf exec --no-startup-id nemo --no-desktop exec --no-startup-id nitrogen --restore exec --no-startup-id nm-applet diff --git a/scripts/.bin/find-blob.sh b/scripts/.bin/find-blob.sh new file mode 100755 index 0000000..f061573 --- /dev/null +++ b/scripts/.bin/find-blob.sh @@ -0,0 +1,14 @@ +#!/bin/sh +obj_name="$1" +shift +git ls-files --stage \ + | if grep -q "$obj_name"; then + echo Found in staging area. Run git ls-files --stage to see. +fi + +git log "$@" --pretty=format:'%T %h %s' \ + | while read tree commit subject ; do + if git ls-tree -r $tree | grep -q "$obj_name" ; then + echo $commit "$subject" + fi +done diff --git a/scripts/.bin/runmenu b/scripts/.bin/runmenu index 6a8a086..be79417 100755 --- a/scripts/.bin/runmenu +++ b/scripts/.bin/runmenu @@ -2,7 +2,7 @@ if command -v rofi >/dev/null 2>&1; then - launcher="rofi -show run" + launcher="rofi -show drun" else launcher="dmenu_run -fn "-*-cure-medium-*-*-*-11-*-*-*-*-*-*-*" -nb "#101010" -nf "#5f5f5f" -sb "#191919" -sf "#b72f62" -b" fi diff --git a/termite/.config/termite/config b/termite/.config/termite/config index a863b09..4cdb402 100644 --- a/termite/.config/termite/config +++ b/termite/.config/termite/config @@ -1,25 +1,45 @@ [colors] -background = #101010 -foreground = #d0d0d0 -cursorColor = #d0d0d0 -color0 = #101010 -color1 = #960050 -color2 = #66aa11 -color3 = #c47f2c -color4 = #30309b -color5 = #7e40a5 -color6 = #3579a8 -color7 = #9999aa -color8 = #303030 -color9 = #ff0090 -color10 = #80ff00 -color11 = #ffba68 -color12 = #5f5fee -color13 = #bb88dd -color14 = #4eb4fa -color15 = #d0d0d0 +# hard contrast: +background = #1d2021 +#background = #282828 +# soft contrast: +#background = #32302f +foreground = #ebdbb2 +foreground_bold = #ebdbb2 +# dark0 + gray +color0 = #282828 +color8 = #928374 +# neutral_red + bright_red +color1 = #cc241d +color9 = #fb4934 + +# neutral_green + bright_green +color2 = #98971a +color10 = #b8bb26 + +# neutral_yellow + bright_yellow +color3 = #d79921 +color11 = #fabd2f + +# neutral_blue + bright_blue +color4 = #458588 +color12 = #83a598 + +# neutral_purple + bright_purple +color5 = #b16286 +color13 = #d3869b + +# neutral_aqua + faded_aqua +color6 = #689d6a +color14 = #8ec07c + +# light4 + light1 +color7 = #a89984 +color15 = #ebdbb2 + +# vim: ft=dosini cms=#%s [options] allow_bold = true mouse_autohide = false diff --git a/zsh/.zprofile b/zsh/.zprofile index fd19128..877ea46 100644 --- a/zsh/.zprofile +++ b/zsh/.zprofile @@ -82,61 +82,6 @@ alias da="docker_start_attach" alias drm="docker rm" alias drun="docker run" alias drmi="docker rmi" -alias dps="docker ps" -alias dpi="docker images" -alias dc="docker-compose" -alias dcr="compose-run" -alias da="docker_start_attach" -alias daa="docker_apply_all_containers" -alias dci="docker_clean_images" -alias dcc="docker_clean_containers" -alias dac="docker_apply_containers" - -function docker_start_attach () { - docker start $1 && docker attach $1 -} - -function drmia () { - docker rmi $(docker images | grep "^" | awk '{print $3}') -} - -function newdev () { - docker run -v $PWD:/usr/src/app -t -i --name $1 -h $1 balkian/devmachine -} - -function docker_apply_containers () { - if [[ "$#" -lt 1 ]]; - then - echo "Usage: $0 " - exit 1 - fi - containers=$(docker ps -a | grep -v 'CONTAINER' | awk "/$1/{ print \$0}") - echo -n $containers - if [[ "$#" -gt 1 ]]; - then - shift; - echo $containers | awk '{print $1}' | xargs docker "$@" - fi - #| xargs docker rmi "$@" -} - -function docker_clean_containers () { - docker rm $(docker ps -q --filter=status=exited) -} - -function docker_clean_images () { - docker rmi $(docker images -a --filter=dangling=true -q) -} - -function docker_nuke () { - docker rmi $(docker images -q) -} - -alias gsicluster='ssh balkian@shannon.gsi.dit.upm.es -p 1337' - -function gsiclustercopy(){ - scp -P 1337 $1 balkian@shannon.gsi.dit.upm.es:/shared/balkian/$2 -} TMPPREFIX="${TMPDIR%/}/zsh" diff --git a/zsh/.zshrc b/zsh/.zshrc index 47e8a2d..8669d0c 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -17,3 +17,75 @@ eval $(dircolors ~/.dircolors) if which pyenv >/dev/null ; then eval "$(pyenv virtualenv-init -)" fi + +alias dps="docker ps" +alias dpi="docker images" +alias dc="docker-compose" +alias dcr="compose-run" +alias da="docker_start_attach" +alias daa="docker_apply_all_containers" +alias dci="docker_clean_images" +alias dcc="docker_clean_containers" +alias dac="docker_apply_containers" + +function docker_start_attach () { + docker start $1 && docker attach $1 +} + +function drmia () { + docker rmi $(docker images | grep "^" | awk '{print $3}') +} + +function newdev () { + docker run -v $PWD:/usr/src/app -t -i --name $1 -h $1 balkian/devmachine +} + +function docker_apply_containers () { + if [[ "$#" -lt 1 ]]; + then + echo "Usage: $0 " + return + fi + containers=$(docker ps -a | grep -v 'CONTAINER' | awk "/$1/{ print \$0}") + echo -n $containers + if [[ "$#" -gt 1 ]]; + then + shift; + echo $containers | awk '{print $1}' | xargs docker "$@" + fi + #| xargs docker rmi "$@" +} + +function docker_apply_images () { + if [[ "$#" -lt 1 ]]; + then + echo "Usage: $0 " + return + fi + images=$(docker images -a | grep -v 'REPOSITORY' | awk "/$1/{ print \$0}") + echo -n $images + if [[ "$#" -gt 1 ]]; + then + shift; + echo $images | awk '{print $3}' | xargs docker "$@" + fi + #| xargs docker rmi "$@" +} + +function docker_clean_containers () { + docker rm $(docker ps -q --filter=status=exited) +} + +function docker_clean_images () { + docker rmi $(docker images -a --filter=dangling=true -q) +} + +function docker_nuke () { + docker rmi $(docker images -q) +} + +alias gsicluster='ssh balkian@shannon.gsi.dit.upm.es -p 1337' + +function gsiclustercopy(){ + scp -P 1337 $1 balkian@shannon.gsi.dit.upm.es:/shared/balkian/$2 +}