From: Samir Benmendil Date: Thu, 4 Dec 2014 23:15:31 +0000 (+0000) Subject: Merge branch 'master' of tardis:/dotfiles X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/f74f72fd2127b8546ddec334cd0b96ceecdf24b5?hp=efae080ae01cc4a64fbb113a75064bc3f2dff0df Merge branch 'master' of tardis:/dotfiles --- 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 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/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/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 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 9d18255..23e9b8a 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -442,7 +442,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/*']