add UltiSnips

This commit is contained in:
falsycat 2021-12-04 07:29:12 +09:00
parent 3dd8da3298
commit fc8467be54
5 changed files with 89 additions and 0 deletions

3
.gitmodules vendored
View File

@ -25,3 +25,6 @@
[submodule "bundle/ale"]
path = bundle/ale
url = https://github.com/dense-analysis/ale
[submodule "bundle/UltiSnips"]
path = bundle/UltiSnips
url = https://github.com/sirver/UltiSnips

9
.vimrc
View File

@ -97,3 +97,12 @@ let g:ale_linters = { 'cpp': ['cppcheck', 'cpplint'] }
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
"
" ---- plugin: UltiSnips
"
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
let g:UltiSnipsEditSplit="vertical"

38
UltiSnips/c.snippets Normal file
View File

@ -0,0 +1,38 @@
priority -50
snippet //nocopy
// No copyright
endsnippet
snippet #inc "include library header"
#include <${1:stdlib.h}>
endsnippet
snippet #incl "include local header"
#include "${1:header.h}"
endsnippet
snippet #once "include guard"
#pragma once
endsnippet
snippet struct "struct definition"
typedef struct $1 {
$0
} $1;
endsnippet
snippet main
int main(int argc, char** argv) {
$0
}
endsnippet
snippet printf
printf("$1"$2);
$0
endsnippet
snippet unuse
(void) $0
endsnippet

38
UltiSnips/cpp.snippets Normal file
View File

@ -0,0 +1,38 @@
priority -50
extends c
priority -49
snippet namespace "namespace specification"
namespace $1 {
$0
} // namespace $1
endsnippet
snippet struct "struct definition"
struct $1 {
};
endsnippet
snippet class "class definition"
class $1 {
$0
};
endsnippet
snippet copymove "copy move constructors and operators"
$1(const $1&)${2: = default;}
$1($1&&)${2: = default;}
$1& operator=(const $1&)${2: = default;}
$1& operator=($1&&)${2: = default;}
endsnippet
snippet nocopymove "delete evils"
$1(const $1&) = delete;
$1($1&&) = delete;
$1& operator=(const $1&) = delete;
$1& operator=($1&&) = delete;
endsnippet

1
bundle/UltiSnips Submodule

@ -0,0 +1 @@
Subproject commit 2c83e40ce66814bf813457bb58ea96184ab9bb81