vim

vim config files
git clone https://git.bracken.jp/vim.git
Log | Files | Refs | LICENSE

commit 08c13f8191147831ab437d8489fa7229960a6041
parent 23c2e26bd73ec31610527b14d80890593fadacac
Author: Chris Bracken <chris@bracken.jp>
Date:   Tue, 20 Apr 2021 14:54:48 -0700

Add a simple, manual snippets system

Allows for simple injection of code snippets in common cases.

Diffstat:
Asnippets/cc.cc | 9+++++++++
Asnippets/cc.h | 17+++++++++++++++++
Asnippets/class.cc | 8++++++++
Asnippets/namespace.cc | 2++
Asnippets/struct.cc | 2++
Mvimrc | 7+++++++
6 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/snippets/cc.cc b/snippets/cc.cc @@ -0,0 +1,9 @@ +#include "cc.h" + +namespace foo { + +Bar::Bar() {} + +Bar::~Bar() {} + +} // namespace foo diff --git a/snippets/cc.h b/snippets/cc.h @@ -0,0 +1,17 @@ +#ifndef _H_ +#define _H_ + +namespace foo { + +class Bar { + public: + Bar(); + ~Bar(); + + private: + int baz_; +}; + +} // namespace foo + +#endif // _H_ diff --git a/snippets/class.cc b/snippets/class.cc @@ -0,0 +1,8 @@ +class Bar { + public: + Bar(); + ~Bar(); + + private: + int baz_; +}; diff --git a/snippets/namespace.cc b/snippets/namespace.cc @@ -0,0 +1,2 @@ +namespace foo { +} // namespace foo diff --git a/snippets/struct.cc b/snippets/struct.cc @@ -0,0 +1,2 @@ +struct Bar { +}; diff --git a/vimrc b/vimrc @@ -138,6 +138,13 @@ nmap <leader>kn 3<Plug>VimwikiMakeDiaryNote au FileType vimwiki nmap <leader>dp <Plug>VimwikiDiaryPrevDay au FileType vimwiki nmap <leader>dn <Plug>VimwikiDiaryNextDay +" Snippets +nmap <leader>sch :0r ~/.vim/snippets/cc.h<CR> +nmap <leader>sci :0r ~/.vim/snippets/cc.cc<CR> +nmap <leader>scn :.-1r ~/.vim/snippets/namespace.cc<CR> +nmap <leader>scs :.-1r ~/.vim/snippets/struct.cc<CR> +nmap <leader>scc :.-1r ~/.vim/snippets/class.cc<CR> + " Configure colour scheme and syntax highlighting. if &t_Co > 2 syntax enable