From 9af2f873ef21fedbff2d52b6a38236e4ad750552 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Thu, 27 Nov 2014 17:04:25 +0000 Subject: [PATCH 01/16] zsh: use python2 in catkin_make --- zsh/aliases/ros.zsh | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 zsh/aliases/ros.zsh diff --git a/zsh/aliases/ros.zsh b/zsh/aliases/ros.zsh new file mode 100644 index 0000000..0cdef45 --- /dev/null +++ b/zsh/aliases/ros.zsh @@ -0,0 +1,3 @@ +# use python2 +alias catkin_make='catkin_make -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so' +alias catkin_make_isolated='catkin_make_isolated -DPYTHON_EXECUTABLE=/usr/bin/python2 -DPYTHON_INCLUDE_DIR=/usr/include/python2.7 -DPYTHON_LIBRARY=/usr/lib/libpython2.7.so' -- 2.49.0 From bae693a361cbfebf39191d3cef325a058c2a6598 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Fri, 28 Nov 2014 14:20:02 +0000 Subject: [PATCH 02/16] vim: test checkattach Plugin --- vim/vimrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vim/vimrc b/vim/vimrc index b3947e6..9d18255 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -46,6 +46,7 @@ Plugin 'Raimondi/delimitMate' Plugin 'SirVer/ultisnips' Plugin 'Lokaltog/vim-easymotion' Plugin 'junegunn/vim-easy-align' +Plugin 'chrisbra/checkattach' " remove entries first set runtimepath -=$HOME/.vim @@ -393,6 +394,9 @@ let g:airline_detect_whitespace=2 let g:airline#extensions#tabline#enabled = 1 let g:airline_powerline_fonts = 1 +" checkattach {{{2 +let g:checkattach_filebrowser = 'ranger' + " Gundo {{{2 nnoremap :GundoToggle -- 2.49.0 From efae080ae01cc4a64fbb113a75064bc3f2dff0df Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Fri, 28 Nov 2014 14:20:24 +0000 Subject: [PATCH 03/16] vim: "obfuscate" email adress in PKGBUILD --- vim/ftplugin/PKGBUILD.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vim/ftplugin/PKGBUILD.vim b/vim/ftplugin/PKGBUILD.vim index f8d6a40..9de99f6 100644 --- a/vim/ftplugin/PKGBUILD.vim +++ b/vim/ftplugin/PKGBUILD.vim @@ -6,6 +6,6 @@ setlocal makeprg=makepkg\ -s setlocal errorformat=%f:\ line\ %l:\ %m nnoremap u :UpdPkgSums -nnoremap r O# Maintainer: Samir Benmendil +nnoremap r O# Maintainer: Samir Benmendil " vim: ft=vim -- 2.49.0 From 7a789cd58e2ea41f9b868eb2d3060b3ff892795e Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Fri, 28 Nov 2014 17:53:33 +0000 Subject: [PATCH 04/16] awesome: use lain for single screen --- awesome/tags.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/awesome/tags.lua b/awesome/tags.lua index d6cf296..7a98a97 100644 --- a/awesome/tags.lua +++ b/awesome/tags.lua @@ -29,15 +29,15 @@ local icon_only = true -- single screen {{{2 mytags[1] = {} mytags[1][1] = { - { name = "1", layout = awful.layout.suit.tile.left, mwfact=0.50, icon = path.."/cutiemarks/pinkie_pie.png"}, - { name = "2", layout = awful.layout.suit.tile, mwfact=0.60, icon = path.."/cutiemarks/rainbow_dash.png"}, - { name = "3", layout = awful.layout.suit.tile, mwfact=0.88, icon = path.."/cutiemarks/twilight_sparkle.png"}, - { name = "4", layout = awful.layout.suit.tile.left, mwfact=0.60, icon = path.."/cutiemarks/doctor_whooves.png"}, - { name = "5", layout = awful.layout.suit.tile, mwfact=0.30, icon = path.."/cutiemarks/derpy_hooves.png"}, - { name = "6", layout = awful.layout.suit.tile, mwfact=0.88, icon = path.."/cutiemarks/trixie.png"}, - { name = "7", layout = awful.layout.suit.tile.bottom, mwfact=0.84, icon = path.."/cutiemarks/soarin.png"}, - { name = "8", layout = awful.layout.suit.max, mwfact=0.50, icon = path.."/cutiemarks/princess_celestia.png"}, - { name = "9", layout = awful.layout.suit.floating, mwfact=0.50, icon = path.."/cutiemarks/princess_luna.png"}, + { name = "1", layout = lain.layout.uselesstile.left, mwfact=0.50, icon = path.."/cutiemarks/pinkie_pie.png"}, + { name = "2", layout = lain.layout.uselesstile, mwfact=0.60, icon = path.."/cutiemarks/rainbow_dash.png"}, + { name = "3", layout = awful.layout.suit.max, mwfact=0.50, icon = path.."/cutiemarks/twilight_sparkle.png"}, + { name = "4", layout = lain.layout.uselesstile.left, mwfact=0.60, icon = path.."/cutiemarks/doctor_whooves.png"}, + { name = "5", layout = lain.layout.uselesstile, mwfact=0.30, icon = path.."/cutiemarks/derpy_hooves.png"}, + { name = "6", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/trixie.png"}, + { name = "7", layout = lain.layout.uselesstile.bottom, mwfact=0.80, icon = path.."/cutiemarks/soarin.png"}, + { name = "8", layout = lain.layout.uselesstile, mwfact=0.50, icon = path.."/cutiemarks/princess_celestia.png"}, + { name = "9", layout = awful.layout.suit.floating, mwfact=0.50, icon = path.."/cutiemarks/princess_luna.png"}, } -- Dual screen {{{2 -- 2.49.0 From b151149fd2eb011f2c3e1c57cdf11f14aaf58490 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Thu, 4 Dec 2014 20:42:38 +0000 Subject: [PATCH 05/16] vim: setup UltiSnips --- vim/ultisnips/c.snippets | 154 ++++++++++++++++++++++++++++++++ vim/ultisnips/cpp.snippets | 57 ++++++++++++ vim/ultisnips/snippets.snippets | 21 +++++ vim/ultisnips/vim.snippets | 30 +++++++ vim/vimrc | 6 +- 5 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 vim/ultisnips/c.snippets create mode 100644 vim/ultisnips/cpp.snippets create mode 100644 vim/ultisnips/snippets.snippets create mode 100644 vim/ultisnips/vim.snippets diff --git a/vim/ultisnips/c.snippets b/vim/ultisnips/c.snippets new file mode 100644 index 0000000..618bfe3 --- /dev/null +++ b/vim/ultisnips/c.snippets @@ -0,0 +1,154 @@ +########################################################################### +# TextMate Snippets # +########################################################################### + +priority -50 + +snippet def "#define ..." +#define ${1} +endsnippet + +snippet ifndef "#ifndef ... #define ... #endif" +#ifndef ${1/([A-Za-z0-9_]+).*/$1/} +#define ${1:SYMBOL} ${2:value} +#endif +endsnippet + +snippet #if "#if #endif" b +#if ${1:0} +${VISUAL}${0} +#endif +endsnippet + +snippet inc "#include local header (inc)" +#include "${1:`!p snip.rv = snip.basename + '.h'`}" +endsnippet + +snippet Inc "#include <> (Inc)" +#include <${1:.h}> +endsnippet + +snippet mark "#pragma mark (mark)" +#if 0 +${1:#pragma mark - +}#pragma mark $2 +#endif + +$0 +endsnippet + +snippet main "main() (main)" +int main(int argc, char *argv[]) +{ + ${VISUAL}${0} + return 0; +} +endsnippet + +snippet for "for loop (for)" +for (${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}${0} +} +endsnippet + +snippet fori "for int loop (fori)" +for (${4:int} ${2:i} = 0; $2 < ${1:count}; ${3:++$2}) +{ + ${VISUAL}${0} +} +endsnippet + +snippet enum "Enumeration" +enum ${1:name} { $0 }; +endsnippet + +snippet once "Include header once only guard" +#ifndef ${1:`!p +if not snip.c: + import random, string + name = re.sub(r'[^A-Za-z0-9]+','_', snip.fn).upper() + rand = ''.join(random.sample(string.ascii_letters+string.digits, 8)) + snip.rv = ('%s_%s' % (name,rand)).upper() +else: + snip.rv = snip.c`} +#define $1 + +${VISUAL}${0} + +#endif /* end of include guard: $1 */ +endsnippet + +snippet td "Typedef" +typedef ${1:int} ${2:MyCustomType}; +endsnippet + +snippet wh "while loop" +while(${1:/* condition */}) { + ${VISUAL}${0} +} +endsnippet + +snippet do "do...while loop (do)" +do { + ${VISUAL}${0} +} while(${1:/* condition */}); +endsnippet + +snippet fprintf "fprintf ..." +fprintf(${1:stderr}, "${2:%s}\n"${2/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$3${2/([^%]|%%)*(%.)?.*/(?2:\);)/} +endsnippet + +snippet if "if .. (if)" +if (${1:/* condition */}) +{ + ${VISUAL}${0} +} +endsnippet + +snippet el "else .. (else)" +else { + ${VISUAL}${0} +} +endsnippet + +snippet eli "else if .. (eli)" +else if (${1:/* condition */}) { + ${VISUAL}${0} +} +endsnippet + +snippet ife "if .. else (ife)" +if (${1:/* condition */}) +{ + ${2} +} +else +{ + ${3:/* else */} +} +endsnippet + +snippet printf "printf .. (printf)" +printf("${1:%s}\n"${1/([^%]|%%)*(%.)?.*/(?2:, :\);)/}$2${1/([^%]|%%)*(%.)?.*/(?2:\);)/} +endsnippet + +snippet st "struct" +struct ${1:`!p snip.rv = (snip.basename or "name") + "_t"`} +{ + ${0:/* data */} +}; +endsnippet + +snippet fun "function" b +${1:void} ${2:function_name}(${3}) +{ + ${VISUAL}${0} +} +endsnippet + +snippet fund "function declaration" b +${1:void} ${2:function_name}(${3}); +endsnippet + +# vim:ft=snippets: diff --git a/vim/ultisnips/cpp.snippets b/vim/ultisnips/cpp.snippets new file mode 100644 index 0000000..769f986 --- /dev/null +++ b/vim/ultisnips/cpp.snippets @@ -0,0 +1,57 @@ +priority -50 + +extends c + +# We want to overwrite everything in parent ft. +priority -49 + +########################################################################### +# TextMate Snippets # +########################################################################### +snippet beginend "$1.begin(), $1.end() (beginend)" +${1:v}${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}begin(), $1${1/^.*?(-)?(>)?$/(?2::(?1:>:.))/}end() +endsnippet + +snippet cl "class .. (class)" +class ${1:`!p snip.rv = snip.basename or "name"`} +{ +public: + ${1/(\w+).*/$1/}(${2:arguments}); + virtual ~${1/(\w+).*/$1/}(); + +private: + ${0:/* data */} +}; // class${1/.+/ $0/m} +endsnippet + +snippet ns "namespace .. (namespace)" +namespace${1/.+/ /m}${1:`!p snip.rv = snip.basename or "name"`} +{ +${VISUAL}${0} +} // namespace${1/.+/ $0/m} +endsnippet + +snippet readfile "read file (readF)" +std::vector v; +if (FILE *fp = fopen(${1:"filename"}, "r")) +{ + char buf[1024]; + while(size_t len = fread(buf, 1, sizeof(buf), fp)) + v.insert(v.end(), buf, buf + len); + fclose(fp); +} +endsnippet + +snippet map "std::map (map)" +std::map<${1:key}, ${2:value}> map$0; +endsnippet + +snippet vector "std::vector (v)" +std::vector<${1:char}> v$0; +endsnippet + +snippet tp "template (template)" +template +endsnippet + +# vim:ft=snippets: diff --git a/vim/ultisnips/snippets.snippets b/vim/ultisnips/snippets.snippets new file mode 100644 index 0000000..ee0c8c7 --- /dev/null +++ b/vim/ultisnips/snippets.snippets @@ -0,0 +1,21 @@ +priority -50 + +# We use a little hack so that the snippet is expanded +# and parsed correctly +snippet snip "Snippet definition" b +`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b} +$0 +`!p snip.rv = "endsnippet"` +endsnippet + +snippet global "Global snippet" b +`!p snip.rv = "global"` !p +$0 +`!p snip.rv = "endglobal"` +endsnippet + +snippet vis "${VISUAL}" i +\$\{VISUAL${1:${2:default}${3:/transform/}}\} +endsnippet + +# vim:ft=snippets: diff --git a/vim/ultisnips/vim.snippets b/vim/ultisnips/vim.snippets new file mode 100644 index 0000000..a5df396 --- /dev/null +++ b/vim/ultisnips/vim.snippets @@ -0,0 +1,30 @@ +priority -50 + +########################################################################### +# SnipMate Snippets # +########################################################################### +snippet gvar "Global / configuration variable" b +if !exists("g:${1:MyUltraImportantVar}") + let g:$1 = ${2:"${3:}"} +endif +endsnippet + +snippet guard "script reload guard" b +if exists('${1:did_`!p snip.rv = snip.fn.replace('.','_')`}') || &cp${2: || version < 700} + finish +endif +let $1 = 1${3} +endsnippet + +snippet augroup "augroup" b +augroup ${1:augroup_name} + $0 +augroup END +endsnippet + +snippet f "function" b +fun ${1:function_name}(${2}) + ${3:" code} +endf +endsnippet +# vim:ft=snippets: diff --git a/vim/vimrc b/vim/vimrc index b3947e6..40e3190 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -438,7 +438,11 @@ let g:tagbar_iconchars = ['+', '-'] " UltiSnips {{{2 let g:UltiSnipsEditSplit = 'vertical' -let g:UltiSnipsSnippetsDir = "$XDG_CONFIG_HOME/vim/ultisnips" +let g:UltiSnipsSnippetsDir = expand("$XDG_CONFIG_HOME/vim/ultisnips") +let g:UltiSnipsSnippetDirectories = ["UltiSnips", "ultisnips"] +let g:UltiSnipsExpandTrigger = "" +let g:UltiSnipsJumpForwardTrigger = "" +let g:UltiSnipsJumpBackwardTrigger = "" " youcompleteme {{{2 let g:ycm_extra_conf_globlist = ['~/src/*','/mnt/data/src/*'] -- 2.49.0 From 11d76e6d2619692acd6b543ccbb368dc42122e9f Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Thu, 4 Dec 2014 20:43:23 +0000 Subject: [PATCH 06/16] vim: some ros specific ft and settings --- vim/filetype.vim | 6 ++++++ vim/ftplugin/roscpp.vim | 0 vim/ftplugin/roslaunch.vim | 2 ++ vim/ftplugin/rospackage.vim | 6 ++++++ vim/indent/cpp.vim | 8 ++++---- vim/indent/roscpp.vim | 3 +++ vim/indent/rospackage.vim | 1 + vim/syntax/rospackage.vim | 5 +++++ vim/ultisnips/roscpp.snippets | 3 +++ vim/ultisnips/rospackage.snippets | 23 +++++++++++++++++++++++ 10 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 vim/ftplugin/roscpp.vim create mode 100644 vim/ftplugin/rospackage.vim create mode 100644 vim/indent/roscpp.vim create mode 100644 vim/indent/rospackage.vim create mode 100644 vim/syntax/rospackage.vim create mode 100644 vim/ultisnips/roscpp.snippets create mode 100644 vim/ultisnips/rospackage.snippets diff --git a/vim/filetype.vim b/vim/filetype.vim index ade77b0..e62ec35 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -5,3 +5,9 @@ augroup filetypedetect autocmd! BufNewFile,BufRead *.launch setfiletype roslaunch autocmd! BufNewFile,BufRead PKGBUILD* setfiletype PKGBUILD augroup END + +augroup ft_ros + autocmd! BufNewFile,BufRead */ros/*.cpp setfiletype cpp.roscpp + autocmd! BufNewFile,BufRead */ros/*.h setfiletype cpp.roscpp + autocmd! BufNewFile,BufRead package.xml setfiletype rospackage +augroup END diff --git a/vim/ftplugin/roscpp.vim b/vim/ftplugin/roscpp.vim new file mode 100644 index 0000000..e69de29 diff --git a/vim/ftplugin/roslaunch.vim b/vim/ftplugin/roslaunch.vim index abba3fe..370119f 100644 --- a/vim/ftplugin/roslaunch.vim +++ b/vim/ftplugin/roslaunch.vim @@ -1,3 +1,5 @@ +runtime! ftplugin/xml.vim + setlocal expandtab setlocal tabstop=2 setlocal shiftwidth=2 diff --git a/vim/ftplugin/rospackage.vim b/vim/ftplugin/rospackage.vim new file mode 100644 index 0000000..795c31d --- /dev/null +++ b/vim/ftplugin/rospackage.vim @@ -0,0 +1,6 @@ +runtime! ftplugin/xml.vim + +setlocal expandtab +setlocal tabstop=2 +setlocal shiftwidth=2 +setlocal softtabstop=2 diff --git a/vim/indent/cpp.vim b/vim/indent/cpp.vim index 5484695..d764fa4 100644 --- a/vim/indent/cpp.vim +++ b/vim/indent/cpp.vim @@ -55,14 +55,14 @@ function! GoogleCppIndent() return l:orig_indent endfunction -setlocal shiftwidth=2 -setlocal tabstop=2 -setlocal softtabstop=2 +setlocal shiftwidth=4 +setlocal tabstop=4 +setlocal softtabstop=4 setlocal expandtab setlocal textwidth=80 setlocal cindent -setlocal cinoptions=h1,l1,g1,t0,i4,+4,(0,w1,W4 +setlocal cinoptions=l1,g0,t0,i4,+4,(0,w1,W4 setlocal indentexpr=GoogleCppIndent() diff --git a/vim/indent/roscpp.vim b/vim/indent/roscpp.vim new file mode 100644 index 0000000..5e33d4a --- /dev/null +++ b/vim/indent/roscpp.vim @@ -0,0 +1,3 @@ +setlocal shiftwidth=2 +setlocal tabstop=2 +setlocal softtabstop=2 diff --git a/vim/indent/rospackage.vim b/vim/indent/rospackage.vim new file mode 100644 index 0000000..6b8bf1c --- /dev/null +++ b/vim/indent/rospackage.vim @@ -0,0 +1 @@ +runtime! indent/xml.vim diff --git a/vim/syntax/rospackage.vim b/vim/syntax/rospackage.vim new file mode 100644 index 0000000..17d65f9 --- /dev/null +++ b/vim/syntax/rospackage.vim @@ -0,0 +1,5 @@ +if exists("b:current_syntax") + finish +endif + +runtime! syntax/xml.vim diff --git a/vim/ultisnips/roscpp.snippets b/vim/ultisnips/roscpp.snippets new file mode 100644 index 0000000..ea728f2 --- /dev/null +++ b/vim/ultisnips/roscpp.snippets @@ -0,0 +1,3 @@ +priority -49 +extends cpp +priority -48 diff --git a/vim/ultisnips/rospackage.snippets b/vim/ultisnips/rospackage.snippets new file mode 100644 index 0000000..30a61e0 --- /dev/null +++ b/vim/ultisnips/rospackage.snippets @@ -0,0 +1,23 @@ +snippet maintainer "maintainer" b +${2:Samir Benmendil} +endsnippet + +snippet author "author me" b +${2:Samir Benmendil} +endsnippet + +snippet bd "build_depend" b +$0 +endsnippet + +snippet rd "run_depend" b +$0 +endsnippet + +snippet td "test_depend" b +$0 +endsnippet + +snippet btd "buildtool_depend" b +$0 +endsnippet -- 2.49.0 From 153355965a36f946106d15cde6fc375e87ed72c4 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 9 Dec 2014 18:55:14 +0000 Subject: [PATCH 07/16] zsh: fix setting window title --- zsh/lib/termsupport.zsh | 35 ----------------------------------- zsh/lib/title.zsh | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 35 deletions(-) delete mode 100644 zsh/lib/termsupport.zsh create mode 100644 zsh/lib/title.zsh diff --git a/zsh/lib/termsupport.zsh b/zsh/lib/termsupport.zsh deleted file mode 100644 index c056989..0000000 --- a/zsh/lib/termsupport.zsh +++ /dev/null @@ -1,35 +0,0 @@ -#usage: title short_tab_title looooooooooooooooooooooggggggg_windows_title -#http://www.faqs.org/docs/Linux-mini/Xterm-Title.html#ss3.1 -#Fully support screen, iterm, and probably most modern xterm and rxvt -#Limited support for Apple Terminal (Terminal can't set window or tab separately) -function title { - if [[ "$DISABLE_AUTO_TITLE" == "true" ]] || [[ "$EMACS" == *term* ]]; then - return - fi - if [[ "$TERM" == screen* ]]; then - print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars - elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then - print -Pn "\e]2;$2:q\a" #set window name - print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal) - fi -} - -ZSH_THEME_TERM_TAB_TITLE_IDLE="%15<..<%~%<<" #15 char left truncated PWD -ZSH_THEME_TERM_TITLE_IDLE="%n@%m: %~" - -#Appears when you have the prompt -function omz_termsupport_precmd { - title $ZSH_THEME_TERM_TAB_TITLE_IDLE $ZSH_THEME_TERM_TITLE_IDLE -} - -#Appears at the beginning of (and during) of command execution -function omz_termsupport_preexec { - emulate -L zsh - setopt extended_glob - local CMD=${1[(wr)^(*=*|sudo|ssh|rake|-*)]} #cmd name only, or if this is sudo or ssh, the next cmd - title "$CMD" "%100>...>${2:gs/%/%%}%<<" -} - -autoload -U add-zsh-hook -add-zsh-hook precmd omz_termsupport_precmd -add-zsh-hook preexec omz_termsupport_preexec diff --git a/zsh/lib/title.zsh b/zsh/lib/title.zsh new file mode 100644 index 0000000..09c5947 --- /dev/null +++ b/zsh/lib/title.zsh @@ -0,0 +1,16 @@ +function title { + local tmp + tmp=(${(f)*}) + printf "\e]0;%s\a" "${tmp[1]}" +} + +case "$TERM" in + (*xterm*|rxvt*) + function title_precmd { title "${(%):-[%n@%m] %~}" } + function title_preexec { title "$1" } + ;; +esac + +autoload -U add-zsh-hook +add-zsh-hook precmd title_precmd +add-zsh-hook preexec title_preexec -- 2.49.0 From b3b372c042301763e31dc6959007c078603396ea Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 9 Dec 2014 18:58:40 +0000 Subject: [PATCH 08/16] zsh: move gpg to XDG dirs --- zsh/lib/gpg.zsh | 4 ++-- zshenv | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/zsh/lib/gpg.zsh b/zsh/lib/gpg.zsh index 818e241..aea97b3 100644 --- a/zsh/lib/gpg.zsh +++ b/zsh/lib/gpg.zsh @@ -11,8 +11,8 @@ if (( ! $+commands[gpg-agent] )); then fi # Set the default paths to gpg-agent files. -_gpg_agent_conf="$HOME/.gnupg/gpg-agent.conf" -_gpg_agent_env="${TMPDIR:-/tmp}/gpg-agent.env" +_gpg_agent_conf="$XDG_CONFIG_HOME/gnupg/gpg-agent.conf" +_gpg_agent_env="$XDG_CACHE_HOME/gpg-agent-info" # Start gpg-agent if not started. if ! ps -U "$USER" -o ucomm | grep -q gpg-agent; then diff --git a/zshenv b/zshenv index bde8c38..710e9f6 100644 --- a/zshenv +++ b/zshenv @@ -5,7 +5,10 @@ export XDG_DATA_HOME="$HOME/.local/share" export XDG_CACHE_HOME="$HOME/.cache" export HOST=$(hostname) -systemctl --user import-environment XDG_CACHE_HOME XDG_DATA_HOME XDG_CONFIG_HOME +systemctl --user import-environment \ + XDG_CACHE_HOME \ + XDG_CONFIG_HOME \ + XDG_DATA_HOME # vim stuff [[ -d "$XDG_CACHE_HOME/vim" ]] || mkdir -p "$XDG_CACHE_HOME/vim" @@ -31,3 +34,6 @@ export TASKRC="$XDG_CONFIG_HOME/taskrc" # mpv & mplayer export MPV_HOME="$XDG_CONFIG_HOME/mpv" export MPLAYER_HOME="$XDG_CONFIG_HOME/mplayer" + +# gpg +export GNUPGHOME="$XDG_CONFIG_HOME/gnupg" -- 2.49.0 From 6c3f59e62a32b670161736dd995a3153837d4c94 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 9 Dec 2014 21:10:22 +0000 Subject: [PATCH 09/16] awesome: update layout.inc call to new api --- awesome/bindings.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awesome/bindings.lua b/awesome/bindings.lua index db5f7c9..91d6340 100644 --- a/awesome/bindings.lua +++ b/awesome/bindings.lua @@ -72,8 +72,8 @@ globalkeys = awful.util.table.join(globalkeys, -- Prompt awful.key({ modkey }, "space", function () mypromptbox[mouse.screen]:run() end), -- switch layout - awful.key({ modkey }, "]", function () awful.layout.inc(layouts, 1) end), - awful.key({ modkey }, "[", function () awful.layout.inc(layouts, -1) end), + awful.key({ modkey }, "]", function () awful.layout.inc( 1, mouse.screen, layouts) end), + awful.key({ modkey }, "[", function () awful.layout.inc(-1, mouse.screen, layouts) end), -- resize slave awful.key({ modkey, "Control" }, "j", function () awful.client.incwfact( 0.05) end), awful.key({ modkey, "Control" }, "k", function () awful.client.incwfact(-0.05) end), -- 2.49.0 From 132f61a78f36a3ff35e7c26cccae8915c53bd1b1 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 9 Dec 2014 21:11:06 +0000 Subject: [PATCH 10/16] awesome: add mod+r key to launch ranger --- awesome/bindings.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/awesome/bindings.lua b/awesome/bindings.lua index 91d6340..f32104d 100644 --- a/awesome/bindings.lua +++ b/awesome/bindings.lua @@ -80,6 +80,8 @@ globalkeys = awful.util.table.join(globalkeys, -- Ksnapshot awful.key({ }, "F13", function () awful.util.spawn("ksnapshot") end), awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end), + -- ranger + awful.key({ modkey }, "r", function () awful.util.spawn(terminal .. " -e ranger") end), -- Layout manipulation awful.key({ modkey, }, "Escape", awful.tag.history.restore), awful.key({ modkey, }, "#49", function () awful.screen.focus_relative( 1) end), -- that's the key left of 1 (chronos) -- 2.49.0 From 6b1323384afd25a30213b420b3607c140f51d62c Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Tue, 9 Dec 2014 21:15:05 +0000 Subject: [PATCH 11/16] awesome: use droid sans instead of some generic sans --- awesome/themes/mlp/theme.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awesome/themes/mlp/theme.lua b/awesome/themes/mlp/theme.lua index 5f0ccf7..fe6df28 100644 --- a/awesome/themes/mlp/theme.lua +++ b/awesome/themes/mlp/theme.lua @@ -6,7 +6,7 @@ theme = {} theme.path = awful.util.getdir("config").."/themes/mlp" -theme.font = "sans 8" +theme.font = "Droid Sans 8" theme.bg_normal = "#222222" theme.bg_focus = "#535d6c" -- 2.49.0 From d396af0a5a6c17c81e4c4d248b90eefc0cb55f2a Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Wed, 10 Dec 2014 00:09:28 +0000 Subject: [PATCH 12/16] awesome: calendar widget that silly lain widget just didn't work way I wanted it to. Importing and modifying it to my needs --- awesome/rc.lua | 2 +- awesome/topbar.lua | 3 +- awesome/widgets/calendar.lua | 97 ++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 3 deletions(-) create mode 100644 awesome/widgets/calendar.lua diff --git a/awesome/rc.lua b/awesome/rc.lua index b91d41c..1bf335e 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -1,4 +1,4 @@ --- Standard awesome library {{{1 +-- Awesome libraries {{{1 gears = require("gears") awful = require("awful") awful.rules = require("awful.rules") diff --git a/awesome/topbar.lua b/awesome/topbar.lua index b945d80..638e967 100644 --- a/awesome/topbar.lua +++ b/awesome/topbar.lua @@ -5,7 +5,6 @@ local utils = require("utils") local wibox = require("wibox") -- Create a textclock widget -mytextclock = awful.widget.textclock(" %a %b %d, %k:%M ", 10) separator = wibox.widget.textbox() separator:set_markup('│') @@ -97,7 +96,7 @@ for s = 1, screen.count() do right_layout:add(require("widgets/battery_widget")) end right_layout:add(separator) - right_layout:add(mytextclock) + right_layout:add(require("widgets/calendar")) right_layout:add(mylayoutbox[s]) -- Now bring it all together (with the tasklist in the middle) diff --git a/awesome/widgets/calendar.lua b/awesome/widgets/calendar.lua new file mode 100644 index 0000000..cdf58ae --- /dev/null +++ b/awesome/widgets/calendar.lua @@ -0,0 +1,97 @@ +--[[ + + Licensed under GNU General Public License v2 + * (c) 2014-, Samir Benmendil + * (c) -2013, Luke Bonham (lain) + +--]] + +local awful = require("awful") +local beautiful = require("beautiful") +local naughty = require("naughty") + +local io = { popen = io.popen } +local os = { date = os.date } +local tonumber = tonumber + +local calendar = {} +calendar.cal = "/usr/bin/cal --color=always" +calendar.font = "monospace 10" +calendar.fg = beautiful.fg_normal or "#FFFFFF" +calendar.bg = beautiful.bg_normal or "#FFFFFF" +calendar.position = "top_right" +calendar.offset = 0 + +local calwidget = awful.widget.textclock(" %a %b %d, %k:%M ", 10) + +calwidget:connect_signal("mouse::enter", function () calendar:show(0) end) +calwidget:connect_signal("mouse::leave", function () calendar:hide() end) +calwidget:buttons(awful.util.table.join( + awful.button({ }, 1, function () calendar:show(-1) end), + awful.button({ }, 3, function () calendar:show( 1) end), + awful.button({ }, 4, function () calendar:show(-1) end), + awful.button({ }, 5, function () calendar:show( 1) end))) + +-- Calendar notification +local cal_notification = nil + +function calendar:hide() + if cal_notification ~= nil then + naughty.destroy(cal_notification) + cal_notification = nil + end +end + +function calendar:show(inc_offset) + calendar:hide() + + local offs = inc_offset or 0 + + calendar.offset = calendar.offset + offs + + local today = tonumber(os.date('%d')) + local month = tonumber(os.date('%m')) + local year = tonumber(os.date('%Y')) + + if offs ~= 0 or calendar.offset ~= 0 + then -- no current month showing, no day to highlight + month = month + calendar.offset + + if month > 12 then + month = month % 12 + year = year + 1 + if month <= 0 then + month = 12 + end + elseif month < 1 then + month = month + 12 + year = year - 1 + if month <= 0 then + month = 1 + end + end + end + + local f = io.popen(calendar.cal .. ' ' .. month .. ' ' .. year) + + local text = string.format("%s\n%s", + calendar.font, + f:read(), + f:read("*a"):gsub("%s\n","\n"):gsub("%s+$", "")) + f:close() + + text = text:gsub("%[7m","") + text = text:gsub("%[27m", "") + + cal_notification = naughty.notify({ + text = text, + position = calendar.position, + fg = calendar.fg, + bg = calendar.bg, + screen = mouse.screen + }) +end + +return calwidget -- 2.49.0 From 1664ffecc11e295788631f4ab3dbc835cd0ebbb7 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Wed, 10 Dec 2014 00:23:00 +0000 Subject: [PATCH 13/16] ranger: update title --- ranger/rc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/rc.conf b/ranger/rc.conf index 0c6417a..19263ae 100644 --- a/ranger/rc.conf +++ b/ranger/rc.conf @@ -105,7 +105,7 @@ set unicode_ellipsis false #set display_tags_in_all_columns true # Set a title for the window? -#set update_title false +set update_title true # Set the title to "ranger" in the tmux program? #set update_tmux_title false -- 2.49.0 From 6094c4b7d0a03fc92693bee5ad34b828979d1af5 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Wed, 10 Dec 2014 00:24:52 +0000 Subject: [PATCH 14/16] ranger: hide less files --- ranger/rc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/rc.conf b/ranger/rc.conf index 19263ae..687b23e 100644 --- a/ranger/rc.conf +++ b/ranger/rc.conf @@ -23,7 +23,7 @@ #set column_ratios 1,3,4 # Which files should be hidden? (regular expression) -#set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ +set hidden_filter ^\.|^lost\+found$ # Show hidden files? You can toggle this by typing 'zh' #set show_hidden false -- 2.49.0 From 773dfc2f99384cf6597a9e7a6156e0e594c95462 Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Wed, 10 Dec 2014 02:31:41 +0000 Subject: [PATCH 15/16] ranger: appearance settings --- ranger/colorschemes/__init__.py | 0 ranger/colorschemes/custom.py | 15 +++++++++++++++ ranger/rc.conf | 18 +++++++++--------- 3 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 ranger/colorschemes/__init__.py create mode 100644 ranger/colorschemes/custom.py diff --git a/ranger/colorschemes/__init__.py b/ranger/colorschemes/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ranger/colorschemes/custom.py b/ranger/colorschemes/custom.py new file mode 100644 index 0000000..df34816 --- /dev/null +++ b/ranger/colorschemes/custom.py @@ -0,0 +1,15 @@ +# Copyright (C) 2009-2013 Roman Zimbelmann +# This software is distributed under the terms of the GNU GPL version 3. + +from ranger.gui.color import * +from ranger.colorschemes.default import Default + +class Scheme(Default): + def use(self, context): + fg, bg, attr = Default.use(self, context) + + if context.in_browser: + if context.border: + fg = 237 + + return fg, bg, attr diff --git a/ranger/rc.conf b/ranger/rc.conf index 687b23e..6532db8 100644 --- a/ranger/rc.conf +++ b/ranger/rc.conf @@ -63,14 +63,14 @@ set vcs_aware true set preview_images true # Use a unicode "..." character to mark cut-off filenames? -set unicode_ellipsis false +set unicode_ellipsis true # Show dotfiles in the bookmark preview box? #set show_hidden_bookmarks true # Which colorscheme to use? These colorschemes are available by default: # default, jungle, snow -#set colorscheme jungle +set colorscheme custom # Preview files on the rightmost column? # And collapse (shrink) the last column if there is nothing to preview? @@ -89,10 +89,10 @@ set unicode_ellipsis false #set draw_progress_bar_in_status_bar true # Draw borders around columns? -#set draw_borders true +set draw_borders true # Display the directory name in tabs? -#set dirname_in_tabs false +set dirname_in_tabs true # Enable the mouse support? #set mouse_enabled true @@ -115,11 +115,11 @@ set update_title true #set shorten_title 3 # Abbreviate $HOME with ~ in the titlebar (first line) of ranger? -#set tilde_in_titlebar false +set tilde_in_titlebar true # How many directory-changes or console-commands should be kept in history? -set max_history_size 200 -set max_console_history_size 500 +set max_history_size 2000 +set max_console_history_size 5000 # Try to keep so much space between the top/bottom border when scrolling: #set scroll_offset 8 @@ -129,7 +129,7 @@ set max_console_history_size 500 # Padding on the right when there's no preview? # This allows you to click into the space to run the file. -#set padding_right true +set padding_right false # Save bookmarks (used with mX and `X) instantly? # This helps to synchronize bookmarks between multiple ranger @@ -164,7 +164,7 @@ set sort_directories_first false # You can set local options that only affect a single directory. # Examples: -# setlocal path=~/downloads sort mtime +setlocal path=~/downloads sort mtime # =================================================================== # == Command Aliases in the Console -- 2.49.0 From 2b76520e8c1722782deb248b43c3fbcb15c47efc Mon Sep 17 00:00:00 2001 From: Samir Benmendil Date: Wed, 10 Dec 2014 02:56:49 +0000 Subject: [PATCH 16/16] zsh: add autocd to ranger + aliases + bindkey --- zsh/lib/ranger.zsh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 zsh/lib/ranger.zsh diff --git a/zsh/lib/ranger.zsh b/zsh/lib/ranger.zsh new file mode 100644 index 0000000..1fab1ae --- /dev/null +++ b/zsh/lib/ranger.zsh @@ -0,0 +1,20 @@ +if (( ! $+commands[ranger] )); then + return 1 +fi + +# Auto cd into rangers directory +function ranger { + tempfile=$(mktemp /tmp/ranger-dirXXX) + /usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}" + test -f "$tempfile" && + if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then + cd -- "$(cat "$tempfile")" + fi + rm -f -- "$tempfile" +} + +alias rg='ranger' + +ranger_show() { BUFFER="ranger"; zle accept-line; } +zle -N ranger_show +bindkey 'r' ranger_show -- 2.49.0