]> git.rmz.io Git - dotfiles.git/commitdiff
Merge branch 'master' of tardis:/dotfiles
authorSamir Benmendil <samir.benmendil@gmail.com>
Thu, 4 Dec 2014 23:15:31 +0000 (23:15 +0000)
committerSamir Benmendil <samir.benmendil@gmail.com>
Thu, 4 Dec 2014 23:15:31 +0000 (23:15 +0000)
16 files changed:
awesome/tags.lua
vim/filetype.vim
vim/ftplugin/roscpp.vim [new file with mode: 0644]
vim/ftplugin/roslaunch.vim
vim/ftplugin/rospackage.vim [new file with mode: 0644]
vim/indent/cpp.vim
vim/indent/roscpp.vim [new file with mode: 0644]
vim/indent/rospackage.vim [new file with mode: 0644]
vim/syntax/rospackage.vim [new file with mode: 0644]
vim/ultisnips/c.snippets [new file with mode: 0644]
vim/ultisnips/cpp.snippets [new file with mode: 0644]
vim/ultisnips/roscpp.snippets [new file with mode: 0644]
vim/ultisnips/rospackage.snippets [new file with mode: 0644]
vim/ultisnips/snippets.snippets [new file with mode: 0644]
vim/ultisnips/vim.snippets [new file with mode: 0644]
vim/vimrc

index d6cf2967941fc9348dca7ecbb5844b6de012df01..7a98a974b3ad9d9241ac11257fcdb6aeb2c94131 100644 (file)
@@ -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
index ade77b054499c02b9e42a69bb6a3598ecf5f062a..e62ec35ea746c4c739607fe2a3e8d5a475d82e6b 100644 (file)
@@ -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 (file)
index 0000000..e69de29
index abba3feaef489a719d6fa16d268485340f9b96db..370119fda3ef71fcc95ef258208a61f0d6f9b9cc 100644 (file)
@@ -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 (file)
index 0000000..795c31d
--- /dev/null
@@ -0,0 +1,6 @@
+runtime! ftplugin/xml.vim
+
+setlocal expandtab
+setlocal tabstop=2
+setlocal shiftwidth=2
+setlocal softtabstop=2
index 5484695731fe034cc01ad4998819dac963d88d16..d764fa43b76b6a524db87d8ebc9ea12e69e83530 100644 (file)
@@ -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 (file)
index 0000000..5e33d4a
--- /dev/null
@@ -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 (file)
index 0000000..6b8bf1c
--- /dev/null
@@ -0,0 +1 @@
+runtime! indent/xml.vim
diff --git a/vim/syntax/rospackage.vim b/vim/syntax/rospackage.vim
new file mode 100644 (file)
index 0000000..17d65f9
--- /dev/null
@@ -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 (file)
index 0000000..618bfe3
--- /dev/null
@@ -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 (file)
index 0000000..769f986
--- /dev/null
@@ -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<char> 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 <typename ..> (template)"
+template <typename ${1:_InputIter}>
+endsnippet
+
+# vim:ft=snippets:
diff --git a/vim/ultisnips/roscpp.snippets b/vim/ultisnips/roscpp.snippets
new file mode 100644 (file)
index 0000000..ea728f2
--- /dev/null
@@ -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 (file)
index 0000000..30a61e0
--- /dev/null
@@ -0,0 +1,23 @@
+snippet maintainer "maintainer" b
+<maintainer email="${1:samir.benmendil@gmail.com}">${2:Samir Benmendil}</maintainer>
+endsnippet
+
+snippet author "author me" b
+<author email="${1:samir.benmendil@gmail.com}">${2:Samir Benmendil}</author>
+endsnippet
+
+snippet bd "build_depend" b
+<build_depend>$0</build_depend>
+endsnippet
+
+snippet rd "run_depend" b
+<run_depend>$0</run_depend>
+endsnippet
+
+snippet td "test_depend" b
+<test_depend>$0</test_depend>
+endsnippet
+
+snippet btd "buildtool_depend" b
+<buildtool_depend>$0</buildtool_depend>
+endsnippet
diff --git a/vim/ultisnips/snippets.snippets b/vim/ultisnips/snippets.snippets
new file mode 100644 (file)
index 0000000..ee0c8c7
--- /dev/null
@@ -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 (file)
index 0000000..a5df396
--- /dev/null
@@ -0,0 +1,30 @@
+priority -50
+
+###########################################################################
+#                            SnipMate Snippets                            #
+###########################################################################
+snippet gvar "Global / configuration variable" b
+if !exists("g:${1:MyUltraImportantVar}")
+       let g:$1 = ${2:"${3:<tab>}"}
+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:
index 9d182552d614d6476fe9db1dc047b81859bb9c54..23e9b8af20b489dab52a56fb59e7d43f5526ab91 100644 (file)
--- 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 = "<C-L>"
+let g:UltiSnipsJumpForwardTrigger = "<C-L>"
+let g:UltiSnipsJumpBackwardTrigger = "<C-H>"
 
 " youcompleteme {{{2
 let g:ycm_extra_conf_globlist = ['~/src/*','/mnt/data/src/*']