diff options
author | Ryan Kavanagh <ryanakca@kubuntu.org> | 2011-08-14 17:16:55 -0400 |
---|---|---|
committer | Ryan Kavanagh <ryanakca@kubuntu.org> | 2011-08-25 07:42:57 -0400 |
commit | 1c019761dfaf6be82de9284fa5e2b9dbfbdec27d (patch) | |
tree | 7ed6bd2f437d3a334bd7a81f62e6dfa63689272b /.vim/c-support |
Initial import
Diffstat (limited to '.vim/c-support')
30 files changed, 2885 insertions, 0 deletions
diff --git a/.vim/c-support/codesnippets/Makefile b/.vim/c-support/codesnippets/Makefile new file mode 100644 index 0000000..2208944 --- /dev/null +++ b/.vim/c-support/codesnippets/Makefile @@ -0,0 +1,178 @@ +#======================================================================================= +# +# Filename: Makefile +# Description: +# +# Usage: make (generate executable ) +# make clean (remove objects, executable, prerequisits ) +# make tarball (generate compressed archive ) +# make zip (generate compressed archive ) +# +# Version: 1.0 +# Created: +# Revision: --- +# +# Author: +# Company: +# Email: +# +# Notes: C extension : c +# C++ extensions : cc cpp C +# C and C++ sources can be mixed. +# Prerequisites are generated automatically; makedepend is not +# needed (see documentation for GNU make Version 3.80, July 2002, +# section 4.13). The utility sed is used. +# +#============================================== makefile template version 1.6 ========== + +# ------------ name of the executable ------------------------------------------------ +EXECUTABLE = main + +# ------------ list of all source files ---------------------------------------------- +SOURCES = main.c + +# ------------ compiler -------------------------------------------------------------- +CC = gcc +CXX = g++ + +# ------------ compiler flags -------------------------------------------------------- +CFLAGS = -Wall -O0 -g # Do not optimize. Produce debugging information. + +# ------------ linker-Flags ---------------------------------------------------------- +LFLAGS = -g + +# ------------ additional system include directories --------------------------------- +GLOBAL_INC_DIR = + +# ------------ private include directories ------------------------------------------- +LOCAL_INC_DIR = $(HOME)/include + +# ------------ system libraries (e.g. -lm ) ----------------------------------------- +SYS_LIBS = -lm + +# ------------ additional system library directories --------------------------------- +GLOBAL_LIB_DIR = + +# ------------ additional system libraries ------------------------------------------- +GLOBAL_LIBS = + +# ------------ private library directories ------------------------------------------- +LOCAL_LIB_DIR = $(HOME)/lib + +# ------------ private libraries (e.g. libxyz.a ) ----------------------------------- +LOCAL_LIBS = + +# ------------ archive generation ----------------------------------------------------- +TARBALL_EXCLUDE = *.{o,gz,zip} +ZIP_EXCLUDE = *.{o,gz,zip} + +# ------------ run executable out of this Makefile (yes/no) ------------------------- +# ------------ cmd line parameters for this executable ------------------------------- +EXE_START = no +EXE_CMDLINE = + +#======================================================================================= +# The following statements usually need not to be changed +#======================================================================================= + +C_SOURCES = $(filter %.c, $(SOURCES)) +CPP_SOURCES = $(filter-out %.c, $(SOURCES)) +ALL_INC_DIR = $(addprefix -I, $(LOCAL_INC_DIR) $(GLOBAL_INC_DIR)) +ALL_LIB_DIR = $(addprefix -L, $(LOCAL_LIB_DIR) $(GLOBAL_LIB_DIR)) +GLOBAL_LIBSS = $(addprefix $(GLOBAL_LIB_DIR)/, $(GLOBAL_LIBS)) +LOCAL_LIBSS = $(addprefix $(LOCAL_LIB_DIR)/, $(LOCAL_LIBS)) +ALL_CFLAGS = $(CFLAGS) $(ALL_INC_DIR) +ALL_LFLAGS = $(LFLAGS) $(ALL_LIB_DIR) +BASENAMES = $(basename $(SOURCES)) + +# ------------ generate the names of the object files -------------------------------- +OBJECTS = $(addsuffix .o,$(BASENAMES)) + +# ------------ generate the names of the hidden prerequisite files ------------------- +PREREQUISITES = $(addprefix .,$(addsuffix .d,$(BASENAMES))) + +# ------------ make the executable --------------------------------------------------- +$(EXECUTABLE): $(OBJECTS) +ifeq ($(strip $(CPP_SOURCES)),) + $(CC) $(ALL_LFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LOCAL_LIBSS) $(GLOBAL_LIBSS) $(SYS_LIBS) +else + $(CXX) $(ALL_LFLAGS) -o $(EXECUTABLE) $(OBJECTS) $(LOCAL_LIBSS) $(GLOBAL_LIBSS) $(SYS_LIBS) +endif +ifeq ($(EXE_START),yes) + ./$(EXECUTABLE) $(EXE_CMDLINE) +endif + +# ------------ include the automatically generated prerequisites --------------------- +# ------------ if target is not clean, tarball or zip --------------------- +ifneq ($(MAKECMDGOALS),clean) +ifneq ($(MAKECMDGOALS),tarball) +ifneq ($(MAKECMDGOALS),zip) +include $(PREREQUISITES) +endif +endif +endif + +# ------------ make the objects ------------------------------------------------------ +%.o: %.c + $(CC) -c $(ALL_CFLAGS) $< + +%.o: %.cc + $(CXX) -c $(ALL_CFLAGS) $< + +%.o: %.cpp + $(CXX) -c $(ALL_CFLAGS) $< + +%.o: %.C + $(CXX) -c $(ALL_CFLAGS) $< + +# ------------ make the prerequisites ------------------------------------------------ +# +.%.d: %.c + @$(make-prerequisite-c) + +.%.d: %.cc + @$(make-prerequisite-cplusplus) + +.%.d: %.cpp + @$(make-prerequisite-cplusplus) + +.%.d: %.C + @$(make-prerequisite-cplusplus) + +# canned command sequences +# echoing of the sed command is suppressed by the leading @ + +define make-prerequisite-c + @$(CC) -MM $(ALL_CFLAGS) $< > $@.$$$$; \ + sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' < $@.$$$$ > $@; \ + rm -f $@.$$$$; +endef + +define make-prerequisite-cplusplus + @$(CXX) -MM $(ALL_CFLAGS) $< > $@.$$$$; \ + sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' < $@.$$$$ > $@; \ + rm -f $@.$$$$; +endef + +# ------------ remove generated files ------------------------------------------------ +# ------------ remove hidden backup files -------------------------------------------- +clean: + rm --force $(EXECUTABLE) $(OBJECTS) $(PREREQUISITES) *~ + +# ------------ tarball generation ------------------------------------------------------ +tarball: + @lokaldir=`pwd`; lokaldir=$${lokaldir##*/}; \ + rm --force $$lokaldir.tar.gz; \ + tar --exclude=$(TARBALL_EXCLUDE) \ + --create \ + --gzip \ + --verbose \ + --file $$lokaldir.tar.gz * + +# ------------ zip --------------------------------------------------------------------- +zip: + @lokaldir=`pwd`; lokaldir=$${lokaldir##*/}; \ + zip -r $$lokaldir.zip * -x $(ZIP_EXCLUDE) + +# ====================================================================================== +# vim: set tabstop=2: set shiftwidth=2: diff --git a/.vim/c-support/codesnippets/Makefile.multi-target.template b/.vim/c-support/codesnippets/Makefile.multi-target.template new file mode 100644 index 0000000..75da8dd --- /dev/null +++ b/.vim/c-support/codesnippets/Makefile.multi-target.template @@ -0,0 +1,70 @@ +#=============================================================================== +# +# File: Makefile +# Description: +# +# Usage: make (generate executable(s) ) +# make clean (remove objects, executables, prerequisits ) +# make tarball (generate compressed archive ) +# make zip (generate compressed archive ) +# +# Author: Dr.-Ing. Fritz Mehner +# Email: mehner@mfh-iserlohn.de +# Created: +# +#=============================================================================== + + +CC = gcc +CCP = g++ +CFLAGS = -c -g -Wall +LFLAGS = -g +SYS_LIBS = -lm +TARBALL_EXCLUDE = "*.{o,gz,zip}" +ZIP_EXCLUDE = *.o *.gz *.zip + +TARGETS = target_1 target_2 + +#---------- targets -------------------------------------- +all: $(TARGETS) + +%.o: %.c + $(CC) $(CFLAGS) $*.c + +%.o: %.cc + $(CCP) $(CFLAGS) $*.cc + +#---------- target 1 ------------------------------------- +# C target +target_1: target_1.o + $(CC) $(LFLAGS) -o $@ $@.o $(SYS_LIBS) + +#---------- target 2 ------------------------------------- +# C++ target +target_2: target_2.o + $(CCP) $(LFLAGS) -o $@ $@.o $(SYS_LIBS) + + +#---------- target 3 ------------------------------------- + + + +#---------- tarball -------------------------------------- +tarball: + lokaldir=`pwd`; lokaldir=$${lokaldir##*/}; \ + rm --force $$lokaldir.tar.gz; \ + tar --exclude=$(TARBALL_EXCLUDE) \ + --create \ + --gzip \ + --verbose \ + --file $$lokaldir.tar.gz * + +#---------- zip ------------------------------------------ +zip: + lokaldir=`pwd`; lokaldir=$${lokaldir##*/}; \ + zip -r $$lokaldir.zip * -x $(ZIP_EXCLUDE) + +#---------- clear up ------------------------------------- +clean: + rm --force $(EXECUTABLE) $(OBJECTS) $(PREREQUISITES) + diff --git a/.vim/c-support/codesnippets/calloc_double_matrix.c b/.vim/c-support/codesnippets/calloc_double_matrix.c new file mode 100644 index 0000000..ec71658 --- /dev/null +++ b/.vim/c-support/codesnippets/calloc_double_matrix.c @@ -0,0 +1,36 @@ + +/* + * === FUNCTION ====================================================================== + * Name: calloc_double_matrix + * Description: Allocate a dynamic double-matrix of size rows*columns; + * return a pointer. + * ===================================================================================== + */ + double** +calloc_double_matrix ( int rows, int columns ) +{ + int i; + double **m; + m = calloc ( rows, sizeof(double*) ); /* allocate pointer array */ + assert( m != NULL); /* abort if allocation failed */ + *m = calloc ( rows*columns, sizeof(double) );/* allocate data array */ + assert(*m != NULL); /* abort if allocation failed */ + for ( i=1; i<rows; i+=1 ) /* set pointers */ + m[i] = m[i-1] + columns; + return m; +} /* ---------- end of function calloc_double_matrix ---------- */ + +/* + * === FUNCTION ====================================================================== + * Name: free_matrix_double + * Description: Free a dynamic double-matrix. + * ===================================================================================== + */ + void +free_double_matrix ( double **m ) +{ + free(*m); /* free data array */ + free( m); /* free pointer array */ + return ; +} /* ---------- end of function free_double_matrix ---------- */ + diff --git a/.vim/c-support/codesnippets/calloc_int_matrix.c b/.vim/c-support/codesnippets/calloc_int_matrix.c new file mode 100644 index 0000000..e21215b --- /dev/null +++ b/.vim/c-support/codesnippets/calloc_int_matrix.c @@ -0,0 +1,35 @@ + +/* + * === FUNCTION ====================================================================== + * Name: calloc_int_matrix + * Description: Allocate a dynamic int-matrix of size rows*columns; return a pointer. + * ===================================================================================== + */ +int** +calloc_int_matrix ( int rows, int columns ) +{ + int i; + int **m; + m = calloc ( rows, sizeof(int*) ); /* allocate pointer array */ + assert( m != NULL ); /* abort if allocation failed */ + *m = calloc ( rows*columns, sizeof(int) ); /* allocate data array */ + assert(*m != NULL ); /* abort if allocation failed */ + for ( i=1; i<rows; i+=1 ) /* set pointers */ + m[i] = m[i-1] + columns; + return m; +} /* ---------- end of function calloc_int_matrix ---------- */ + +/* + * === FUNCTION ====================================================================== + * Name: free_int_matrix + * Description: Free a dynamic int-matrix. + * ===================================================================================== + */ +void +free_int_matrix ( int **m ) +{ + free(*m); /* free data array */ + free( m); /* free pointer array */ + return ; +} /* ---------- end of function free_int_matrix ---------- */ + diff --git a/.vim/c-support/codesnippets/main.c b/.vim/c-support/codesnippets/main.c new file mode 100644 index 0000000..770f5d5 --- /dev/null +++ b/.vim/c-support/codesnippets/main.c @@ -0,0 +1,20 @@ +#include <errno.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +/* + * === FUNCTION ====================================================================== + * Name: main + * Description: main function + * ===================================================================================== + */ + int +main ( int argc, char *argv[] ) +{ + printf ("\nProgram %s\n\n", argv[0] ); + + return EXIT_SUCCESS; +} /* ---------- end of function main ---------- */ + diff --git a/.vim/c-support/codesnippets/main.cc b/.vim/c-support/codesnippets/main.cc new file mode 100644 index 0000000..d87f891 --- /dev/null +++ b/.vim/c-support/codesnippets/main.cc @@ -0,0 +1,18 @@ +#include <fstream> +#include <iomanip> +#include <iostream> + +using namespace std; + +// === FUNCTION ====================================================================== +// Name: main +// Description: main function +// ===================================================================================== + int +main ( int argc, char *argv[] ) +{ + cout << "\nProgram " << argv[0] << endl << endl; + + return EXIT_SUCCESS; +} // ---------- end of function main ---------- + diff --git a/.vim/c-support/codesnippets/print_double_array.c.noindent b/.vim/c-support/codesnippets/print_double_array.c.noindent new file mode 100644 index 0000000..6ced53a --- /dev/null +++ b/.vim/c-support/codesnippets/print_double_array.c.noindent @@ -0,0 +1,30 @@ + +/* + * === FUNCTION ====================================================================== + * Name: print_double_array + * Description: Print a double-array with one dimension. + * Use + * print_int_array( *matrix, n1*n2, n2, "matrix" ); + * for + * double matrix[n1][n2]; + * ===================================================================================== + */ +static void +print_double_array ( double array[], /* array to print */ + int n, /* number of elements to print */ + int nrow, /* number of elements per row */ + char *arrayname /* array name */ + ) +{ + int i; + printf ("\n\n array \"%s\", length %d\n", arrayname, n ); + for ( i=0; i<n; i+=1 ) + { + if( i%nrow == 0 ) + printf ("\n%6d : ", i ); + printf (" %8.2f", array[i] ); + } + printf ("\n\n"); + return ; +} /* ---------- end of function print_double_array ---------- */ + diff --git a/.vim/c-support/codesnippets/print_int_array.c.noindent b/.vim/c-support/codesnippets/print_int_array.c.noindent new file mode 100644 index 0000000..02d53c0 --- /dev/null +++ b/.vim/c-support/codesnippets/print_int_array.c.noindent @@ -0,0 +1,30 @@ + +/* + * === FUNCTION ====================================================================== + * Name: print_int_array + * Description: Print an int-array with one dimension. + * Use + * print_int_array( *matrix, n1*n2, n2, "matrix" ); + * for + * int matrix[n1][n2]; + * ===================================================================================== + */ +static void +print_int_array ( int array[], /* array to print */ + int n, /* number of elements to print */ + int nrow, /* number of elements per row */ + char *arrayname /* array name */ + ) +{ + int i; + printf ("\n\n array \"%s\", length %d\n", arrayname, n ); + for ( i=0; i<n; i+=1 ) + { + if( i%nrow == 0 ) + printf ("\n%6d : ", i ); + printf (" %6d", array[i] ); + } + printf ("\n\n"); + return ; +} /* ---------- end of function print_int_array ---------- */ + diff --git a/.vim/c-support/doc/ChangeLog b/.vim/c-support/doc/ChangeLog new file mode 100644 index 0000000..d0d4fd4 --- /dev/null +++ b/.vim/c-support/doc/ChangeLog @@ -0,0 +1,304 @@ +======================================================================================= + RELEASE NOTES FOR VERSION 5.0.4 +======================================================================================= ++ Format for the macros |DATE|, |TIME|, and |YEAR| can be defined by the user. ++ Help text improved. + +======================================================================================= + RELEASE NOTES FOR VERSION 5.0.3 +======================================================================================= ++ Code snippets can now be used in the console mode (Vim without GUI). ++ Bugfix: Possible conflict with 'indent' removed when inserting templates. + +======================================================================================= + RELEASE NOTES FOR VERSION 5.0.2 +======================================================================================= ++ Bugfix: Prototype picker did not alway delete no longer used prototypes. ++ Bugfix: Prototype picker removed template specializations from parameter lists. + +======================================================================================= + RELEASE NOTES FOR VERSION 5.0.1 +======================================================================================= ++ Bugfix: autocmd setting can influence autocmd settings of OTHER plugins. + +======================================================================================= + RELEASE NOTES FOR VERSION 5.0 +======================================================================================= ++ Completely new template system. Now every menu item is user definable. ++ Changes to allow a system-wide installation. ++ A few hotkeys added and renamed. + +======================================================================================= + RELEASE NOTES FOR VERSION 4.6.1 +======================================================================================= ++ New global variable to control the filetype of *.h header files (default is now 'cpp'). ++ Bugfix: properly resetting 'compiler' after using make, splint, and CodeCheck. + +======================================================================================= + RELEASE NOTES FOR VERSION 4.6 +======================================================================================= ++ New insert mode mappings (comments, statements, preprocessing, idioms, C++). ++ Some mappings renamed (easier to remember). ++ New tag (basename of a file reduced to characters allowed in names). + +======================================================================================= + RELEASE NOTES FOR VERSION 4.5 +======================================================================================= ++ New menu item and hotkey for the (re)alignement of end-of-line comments. ++ Hotkey \cn removed. Only one menu item for end-of-line comments left. ++ Changed hotkeys: \ce -> \cl and \cl -> \cs . ++ Three new tags (giving the basename of a file) for writing template files. ++ Prototype picker handles template methods. ++ Bugfix: splint works now under Windows. ++ Minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 4.4 +======================================================================================= ++ Plugin directories rearranged. ++ main- and for-idiom have a visual mode now. ++ Four new commands (command line) to control the comment style. ++ Comment style (C/C++) can automatically follow the filetype. ++ Bugfix: empty new file after removing the header template can't be closed. ++ Bugfix : Tools entry missing when root menu not shown from the start. ++ Minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 4.3 +======================================================================================= ++ CodeCheck (TM) integrated (source code analysing tool). ++ New key mappings for preprocessor statements. ++ New preprocessor menu. ++ Bugfix: indent under Windows. ++ Minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 4.2.1 +======================================================================================= ++ Bugfix: change needed for some menu names after patch 7.0.054 . + +======================================================================================= + RELEASE NOTES FOR VERSION 4.2 +======================================================================================= ++ Setting the starting column for trailing comments improved. ++ Small bug in block uncommenting fixed. ++ Mac OS X : circumvent a Vim bug which caused a crash when loading plugin version 4.1. ++ File syntax/c.vim removed (but see help in csupport.txt). + +======================================================================================= + RELEASE NOTES FOR VERSION 4.1 +======================================================================================= ++ A complete switch statement can be made from a list of labels. ++ Additional cases can be made from a list of labels. ++ Small bug in line end commenting fixed. ++ Some minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 4.0 +======================================================================================= + ++ Kernighan & Ritchie style for block statements can be enabled. ++ Changes to make it compatible with Vim 7. ++ Set C/C++ file type for source files which should not be preprocessed (*.i, *.ii). ++ Some minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.11 +======================================================================================= + ++ Hotkeys and an accompanying reference card added. ++ Preparation for syntax based folding. ++ Some minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.10 +======================================================================================= + ++ Remove "#if 0 ... #endif" from the inside. ++ Change C comments to C++ comments and vice versa. ++ try..catch / catch / catch(...) now can be set surround a marked area. ++ Prototype picking improved (for C++). ++ A hardcopy shows the localized date and time in the header line. ++ New help menu entry in the main menu of this plugin (shows the plugin documentation). ++ Switch between corresponding source and header files with <S-F2> if the plugin a.vim + is present. ++ Plugin can be used with autocompletion for (, [, and { . + +======================================================================================= + RELEASE NOTES FOR VERSION 3.9.1 +======================================================================================= + ++ Doubling of file header for new c- and h-files under Windows fixed (Thanks to + Fabricio C A Oliveira). ++ Tiny bug in the file open idioms fixed. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.9 +======================================================================================= + ++ Formatter 'indent' integrated. ++ Bugfix in the automatic header insertion. ++ Assert idiom added. ++ #if 0 ... #endif statement for blocking out code added. ++ Minor stylistic improvements in some idioms. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.8.2 +======================================================================================= + ++ Screen update problem solved: color inversion under FC4 (Thanks to Bernie Barton). ++ RTTI menu : additional v-mode. ++ Statement menu and C++ menu rearranged. ++ Include guard : name generation improved. ++ File header templates will be included for additional file extensions (cp, cxx, c++, ...). + +======================================================================================= + RELEASE NOTES FOR VERSION 3.8.1 +======================================================================================= + ++ More C++ output manipulators, manipulator insertion more intuitive. ++ Output into buffer: cursor goes to top of file. ++ Makefile template improved (code snippet). ++ Some internal improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.8 +======================================================================================= + ++ Windows support. Most features are now available under Windows. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.7.2 +======================================================================================= + ++ Run buffer through splint (A tool for statically checking C programs; see + http://www.splint.org). An error window will be opened; quickfix commands can be used. ++ Set buffer related command line arguments for splint. ++ Line end comments start in a fixed column (can be set from the menu). ++ Spaces in path names and file names are now possible. ++ Template files and snippet files are no longer kept in the list of alternate files. ++ Some minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.7.1 +======================================================================================= + ++ Bug fixed (command line arguments not passed to the executable). ++ File extension for executables can be set. ++ Minor improvements. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.7 +======================================================================================= + ++ Running a program: + (1) Run program from the gVim command line. + (2) Run program and direct the output into a window with name "C-Output". + This buffer and its content will disappear when closing the window. + The buffer is reused when still open. + (3) Run program in an xterm (adjustable). ++ Command line arguments are now buffer related (each buffer can have its own arguments). ++ Code snippets can be protected from being indented during insertion. ++ Picked up prototypes will be deleted after insertion. ++ A code snippet with the file name extension "ni" or "noindent" will not be + indented on insertion. ++ for- and calloc-/malloc-idioms improved. ++ Bug fixed (word list handling). + + +======================================================================================= + RELEASE NOTES FOR VERSION 3.6 +======================================================================================= + ++ Installation simplified. ++ for-loop-idiom asks for control variable, initial value, ... ++ malloc-idiom asks for pointer variable and size. ++ Toggling the comment style works correct again. ++ Empty error windows will be closed. ++ Prototype picker removes trailing parts of the function body if marked. ++ The dialog windows (GUI) have been replaced by more flexible command line inputs. ++ The undocumented and unnecessary hot key F12 has been removed. ++ Extension to ctags + taglist shows makefile targets and qmake targets. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.5 +======================================================================================= + ++ Aligned line end comments for consecutive lines. ++ Improved prototype picker removes comments. ++ Picked up prototypes can be shown. ++ Uncomment more than one block at once. ++ 3 new idioms. ++ Help file improved . + +======================================================================================= + RELEASE NOTES FOR VERSION 3.4 +======================================================================================= + ++ Two new global variables: C_Dictionary_File, C_MenuHeader . ++ The preprocessor statements #if... and the function idiom include marked + lines when invoked in visual mode. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.3 +======================================================================================= + ++ The C/C++ root menu can be disabled. + +======================================================================================= + RELEASE NOTES FOR VERSION 3.2 +======================================================================================= + ++ Only one C/C++ entry in the gVim root menu. ++ All hotkeys are only defined for C/C++ files (file type plugin added). ++ The following constructs are now read as templates from files: + class, class using new, + template class, template class using new, + error class ++ Install script added. ++ Customization improved. ++ Documentation improved (help file added). ++ Bug fix (template file handling) + +======================================================================================= + RELEASE NOTES FOR VERSION 3.1 +======================================================================================= + ++ When the comment style "C" is active the menu entry "Comments.code->comment" + turns a marked region in one multiline C-comment. ++ The menu entry "Comments.comment->code" turns marked multiline C-comment + back into code. ++ A marked region can be surrounded by a for-, if, if-else, while-, do-while-statement + (with indentation). ++ The menu entry "Snippets.make prototype" makes a C- or C++-prototype from + the current line or marked region and puts it in an internal buffer. ++ The menu entry "Snippets.add prototype" also makes a C- or C++-prototype from + the current line or a marked region and adds it to the internal buffer. ++ The menu entry "Snippets.put prototype" inserts all gathered prototypes + below the current line. ++ Tag substitution rewritten (Some characters in a substitution text for a tag + prevented the tag from being substituted). + +======================================================================================= + RELEASE NOTES FOR VERSION 3.0 +======================================================================================= + ++ C-style comments AND C++-style comments are supported now. ++ The menu entry 'Comments->Comment style ..' switches the styles (toggle). ++ Block comments are now read as templates or skeletons from files: + Frame Block, Function Description, Method Description, + Class Description, H+file header, C/C++-file header ++ These templates can contain tags like |FILENAME|, |AUTHOR| etc. which are replaced + after reading (KDevelop templates can be used without any change). ++ indentation: multiline inserts and code snippets will be indented after insertion. ++ Most menu entries are now also active in normal mode. ++ new menu items: + includes for the C99 header, + includes for the standard C++ header, + includes for the C++ version of the Standard C Library header, + multiline C comment + vim modeline ++ Reading the templates is done in one function which can be called in an autocmd. ++ Code cleanup: register z no longer used. Most function calls are silent now. + + diff --git a/.vim/c-support/doc/c-hotkeys.pdf b/.vim/c-support/doc/c-hotkeys.pdf Binary files differnew file mode 100644 index 0000000..07a6c7c --- /dev/null +++ b/.vim/c-support/doc/c-hotkeys.pdf diff --git a/.vim/c-support/rc/customization.ctags b/.vim/c-support/rc/customization.ctags new file mode 100644 index 0000000..75ccd5a --- /dev/null +++ b/.vim/c-support/rc/customization.ctags @@ -0,0 +1,7 @@ + +--regex-make=/^([^:# \t]+)[ \t]*[:]{1,2}/\1/t,targets/ + +--langdef=qmake +--langmap=qmake:+.pro +--regex-qmake=/^([[:upper:]_]+)/\1/t,SystemVariables/ + diff --git a/.vim/c-support/rc/customization.gvimrc b/.vim/c-support/rc/customization.gvimrc new file mode 100644 index 0000000..ff3d690 --- /dev/null +++ b/.vim/c-support/rc/customization.gvimrc @@ -0,0 +1,44 @@ +" +"=============================================================================== +"========== example gvimrc from the distribution ============================== +"=============================================================================== +" +runtime gvimrc_example.vim +" +" +"=============================================================================== +"========== CUSTOMIZATION (gvimrc) =========================================== +"=============================================================================== +" +"------------------------------------------------------------------------------- +" Moving cursor to other windows +" +" shift down : change window focus to lower one (cyclic) +" shift up : change window focus to upper one (cyclic) +" shift left : change window focus to one on left +" shift right : change window focus to one on right +"------------------------------------------------------------------------------- +" +nmap <s-down> <c-w>w +nmap <s-up> <c-w>W +nmap <s-left> <c-w>h +nmap <s-right> <c-w>l +" +" +"------------------------------------------------------------------------------- +" some additional hot keys +"------------------------------------------------------------------------------- +" S-F3 - call gvim file browser +"------------------------------------------------------------------------------- +" + map <silent> <s-F3> :silent browse confirm e<CR> +imap <silent> <s-F3> <Esc>:silent browse confirm e<CR> +" +" +"------------------------------------------------------------------------------- +" toggle insert mode <--> 'normal mode with the <RightMouse>-key +"------------------------------------------------------------------------------- +" +nmap <RightMouse> <Insert> +imap <RightMouse> <ESC> +" diff --git a/.vim/c-support/rc/customization.indent.pro b/.vim/c-support/rc/customization.indent.pro new file mode 100644 index 0000000..95f6081 --- /dev/null +++ b/.vim/c-support/rc/customization.indent.pro @@ -0,0 +1,8 @@ +--blank-lines-after-procedures +--brace-indent0 +--comment-indentation49 +--declaration-comment-column49 +--declaration-indentation10 +--space-after-parentheses +--swallow-optional-blank-lines +--tab-size2 diff --git a/.vim/c-support/rc/customization.vimrc b/.vim/c-support/rc/customization.vimrc new file mode 100644 index 0000000..f9ab5a7 --- /dev/null +++ b/.vim/c-support/rc/customization.vimrc @@ -0,0 +1,149 @@ +" +"=============================================================================== +"========== load example vimrc from the distribution ========================= +"=============================================================================== +" +runtime vimrc_example.vim +" +filetype plugin on +" +"=============================================================================== +"========== CUSTOMIZATION (vimrc) ============================================ +"=============================================================================== +" +" Platform specific items: +" - central backup directory (has to be created) +" - default dictionary +" Uncomment your choice. +if has("win16") || has("win32") || has("win64") || + \ has("win95") || has("win32unix") + " +" runtime mswin.vim +" set backupdir =$VIM\vimfiles\backupdir +" set dictionary=$VIM\vimfiles\wordlists/german.list +else +" set backupdir =$HOME/.vim.backupdir +" set dictionary=$HOME/.vim/wordlists/german.list +endif +" +" Using a backupdir under UNIX/Linux: you may want to include a line similar to +" find $HOME/.vim.backupdir -name "*" -type f -mtime +60 -exec rm -f {} \; +" in one of your shell startup files (e.g. $HOME/.profile) +" +"------------------------------------------------------------------------------- +" Use of dictionaries +"------------------------------------------------------------------------------- +" +set complete+=k " scan the files given with the 'dictionary' option +" +"------------------------------------------------------------------------------- +" Various settings +"------------------------------------------------------------------------------- +" +set autoread " read open files again when changed outside Vim +set autowrite " write a modified buffer on each :next , ... +set browsedir =current " which directory to use for the file browser +set incsearch " use incremental search +set nowrap " do not wrap lines +set shiftwidth =2 " number of spaces to use for each step of indent +set tabstop =2 " number of spaces that a <Tab> in the file counts for +set visualbell " visual bell instead of beeping +" +" +"------------------------------------------------------------------------------- +" some additional hot keys +"------------------------------------------------------------------------------- +" F2 - write file without confirmation +" F3 - call file explorer Ex +" F4 - show tag under curser in the preview window (tagfile must exist!) +" F5 - open quickfix error window +" F6 - close quickfix error window +" F7 - display previous error +" F8 - display next error +" S-Tab - Fast switching between buffers (see below) +" C-q - Leave the editor with Ctrl-q (see below) +"------------------------------------------------------------------------------- +" +map <silent> <F2> :write<CR> +map <silent> <F3> :Explore<CR> +nmap <silent> <F4> :exe ":ptag ".expand("<cword>")<CR> +map <silent> <F5> :copen<CR> +map <silent> <F6> :cclose<CR> +map <silent> <F7> :cp<CR> +map <silent> <F8> :cn<CR> +" +imap <silent> <F2> <Esc>:write<CR> +imap <silent> <F3> <Esc>:Explore<CR> +imap <silent> <F4> <Esc>:exe ":ptag ".expand("<cword>")<CR> +imap <silent> <F5> <Esc>:copen<CR> +imap <silent> <F6> <Esc>:cclose<CR> +imap <silent> <F7> <Esc>:cp<CR> +imap <silent> <F8> <Esc>:cn<CR> +" +"------------------------------------------------------------------------------- +" Fast switching between buffers +" The current buffer will be saved before switching to the next one. +" Choose :bprevious or :bnext +"------------------------------------------------------------------------------- +" + map <silent> <s-tab> <Esc>:if &modifiable && !&readonly && + \ &modified <CR> :write<CR> :endif<CR>:bprevious<CR> +imap <silent> <s-tab> <Esc>:if &modifiable && !&readonly && + \ &modified <CR> :write<CR> :endif<CR>:bprevious<CR> +" +"------------------------------------------------------------------------------- +" Leave the editor with Ctrl-q : Write all changed buffers and exit Vim +"------------------------------------------------------------------------------- +nmap <C-q> :wqa<CR> +" +"------------------------------------------------------------------------------- +" autocomplete parenthesis, brackets and braces +"------------------------------------------------------------------------------- +inoremap ( ()<Left> +inoremap [ []<Left> +inoremap { {}<Left> +" +vnoremap ( s()<Esc>P<Right>% +vnoremap [ s[]<Esc>P<Right>% +vnoremap { s{}<Esc>P<Right>% +" +"------------------------------------------------------------------------------- +" Change the working directory to the directory containing the current file +"------------------------------------------------------------------------------- +if has("autocmd") + autocmd BufEnter * :lchdir %:p:h +endif " has("autocmd") +" +"------------------------------------------------------------------------------- +" Filename completion +" +" wildmenu : command-line completion operates in an enhanced mode +" wildignore : A file that matches with one of these +" patterns is ignored when completing file or directory names. +"------------------------------------------------------------------------------- +" +set wildmenu +set wildignore=*.bak,*.o,*.e,*~ +" +"------------------------------------------------------------------------------- +" print options (pc = percentage of the media size) +"------------------------------------------------------------------------------- +set printoptions=left:8pc,right:3pc +" +"------------------------------------------------------------------------------- +" taglist.vim : toggle the taglist window +" taglist.vim : define the title texts for make +" taglist.vim : define the title texts for qmake +"------------------------------------------------------------------------------- + noremap <silent> <F11> <Esc><Esc>:Tlist<CR> +inoremap <silent> <F11> <Esc><Esc>:Tlist<CR> + +let tlist_make_settings = 'make;m:makros;t:targets' + +let tlist_qmake_settings = 'qmake;t:SystemVariables' + +if has("autocmd") + " ---------- qmake : set filetype for *.pro ---------- + autocmd BufNewFile,BufRead *.pro set filetype=qmake +endif " has("autocmd") + diff --git a/.vim/c-support/scripts/wrapper.sh b/.vim/c-support/scripts/wrapper.sh new file mode 100644 index 0000000..55d9961 --- /dev/null +++ b/.vim/c-support/scripts/wrapper.sh @@ -0,0 +1,34 @@ +#!/bin/bash +#=============================================================================== +# FILE: wrapper.sh +# USAGE: ./wrapper.sh executable [cmd-line-args] +# DESCRIPTION: Wraps the execution of a programm or script. +# Use with xterm: xterm -e wrapper.sh executable cmd-line-args +# This script is used by several plugins: +# bash-support.vim, c.vim and perl-support.vim +# OPTIONS: --- +# REQUIREMENTS: which(1) - shows the full path of (shell) commands. +# BUGS: --- +# NOTES: --- +# AUTHOR: Dr.-Ing. Fritz Mehner (Mn), mehner@fh-swf.de +# COMPANY: Fachhochschule Südwestfalen, Iserlohn +# CREATED: 23.11.2004 18:04:01 CET +# REVISION: $Id: wrapper.sh,v 1.3 2007/10/03 09:06:09 mehner Exp $ +#=============================================================================== + +command=${@} # the complete command line +executable=${1} # name of the executable; may be quoted + +fullname=$(which $executable) +[ $? -eq 0 ] && executable=$fullname + +if [ ${#} -ge 1 ] && [ -x "$executable" ] +then + shift + "$executable" ${@} + echo -e "> \"${command}\" returned ${?}" +else + echo -e "\n !! file \"${executable}\" does not exist or is not executable !!" +fi +echo -e " ... press return key ... " +read dummy diff --git a/.vim/c-support/syntax/c.vim b/.vim/c-support/syntax/c.vim new file mode 100644 index 0000000..395e0d9 --- /dev/null +++ b/.vim/c-support/syntax/c.vim @@ -0,0 +1,21 @@ +"=================================================================================== +" +" FILE: c.vim +" DESCRIPTION: syntax file +" enable syntax based folding +" part of the c-support plugin +" +" AUTHOR: Dr.-Ing. Fritz Mehner +" EMAIL: mehner@fh-swf.de +" COMPANY: FH Südwestfalen, Iserlohn +" VERSION: 1.0 +" CREATED: 11.03.2006 +" REVISION: --- +"=================================================================================== +" +" fold C blocks +" +syn region cBlock start="{" end="}" transparent fold +set foldmethod=syntax +set foldlevel=999 + diff --git a/.vim/c-support/templates/Templates b/.vim/c-support/templates/Templates new file mode 100644 index 0000000..9aa86fc --- /dev/null +++ b/.vim/c-support/templates/Templates @@ -0,0 +1,26 @@ +$ +$ ============================================================= +$ ========== USER MACROS ====================================== +$ ============================================================= +$ +|AUTHOR| = Ryan Kavanagh +|AUTHORREF| = ryanakca +|EMAIL| = ryanakca@kubuntu.org +|COPYRIGHT| = Copyright (c) 2008 Ryan Kavanagh +|LICENSE| = GNU GPL v2 +$ +$ ============================================================= +$ ========== FILE INCLUDES ==================================== +$ ============================================================= +$ +|includefile| = c.comments.template +|includefile| = c.cpp.template +|includefile| = c.idioms.template +|includefile| = c.preprocessor.template +|includefile| = c.statements.template + +$|includefile| = cpp.comments.template +$|includefile| = cpp.cpp.template +$|includefile| = cpp.idioms.template +$|includefile| = cpp.preprocessor.template +$|includefile| = cpp.statements.template diff --git a/.vim/c-support/templates/c.comments.template b/.vim/c-support/templates/c.comments.template new file mode 100644 index 0000000..8080968 --- /dev/null +++ b/.vim/c-support/templates/c.comments.template @@ -0,0 +1,147 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.end-of-line-comment == append == +/* <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.frame == +/*-------------------------------------------------------------------------- + * <CURSOR> + *------------------------------------------------------------------------*/ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.function == +/* + * === FUNCTION ========================================================== + * Name: |?FUNCTION_NAME| + * Description: <CURSOR> + * ========================================================================= + */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.method == +/* + *-------------------------------------------------------------------------- + * Class: |?CLASSNAME| + * Method: |?METHODNAME| + * Description: <CURSOR> + *-------------------------------------------------------------------------- + */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.class == +/* + * ========================================================================= + * Class: |?CLASSNAME| + * Description: <CURSOR> + * ========================================================================= + */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-description == start == +/* + * ========================================================================= + * + * Filename: |FILENAME| + * + * Description: <CURSOR> + * + * Version: 1.0 + * Created: |DATE| |TIME| + * Revision: none + * Compiler: gcc + * + * Author: |AUTHOR| (|AUTHORREF|), |EMAIL| + * License: |LICENSE| + * + * ========================================================================= + */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-bug == append == + /* :BUG:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-compiler == append == + /* :COMPILER:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-todo == append == + /* :TODO:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-tricky == append == + /* :TRICKY:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-warning == append == + /* :WARNING:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-workaround == append == + /* :WORKAROUND:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-keyword == append == + /* :|?KEYWORD:u|:|DATE| |TIME|:|AUTHORREF|: <CURSOR> */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-header-includes == +/* ##### HEADER FILE INCLUDES ################################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-macros == +/* ##### MACROS - LOCAL TO THIS SOURCE FILE ################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-typedefs == +/* ##### TYPE DEFINITIONS - LOCAL TO THIS SOURCE FILE ######################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-data-types == +/* ##### DATA TYPES - LOCAL TO THIS SOURCE FILE ############################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-defs == +/* ##### CLASS DEFINITIONS - LOCAL TO THIS SOURCE FILE ######################## */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-local-variables == +/* ##### VARIABLES - LOCAL TO THIS SOURCE FILE ################################ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-prototypes == +/* ##### PROTOTYPES - LOCAL TO THIS SOURCE FILE ############################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-exported == +/* ##### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ############################ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-local == +/* ##### FUNCTION DEFINITIONS - LOCAL TO THIS SOURCE FILE ##################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-exported == +/* ##### CLASS IMPLEMENTATIONS - EXPORTED CLASSES ############################# */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-local == +/* ##### CLASS IMPLEMENTATIONS - LOCAL CLASSES ################################ */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-header-includes == +/* ##### HEADER FILE INCLUDES ################################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-macros == +/* ##### EXPORTED MACROS ######################################################## */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-typedefs == +/* ##### EXPORTED TYPE DEFINITIONS ############################################## */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-data-types == +/* ##### EXPORTED DATA TYPES #################################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-class-defs == +/* ##### EXPORTED CLASS DEFINITIONS ############################################# */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-variables == +/* ##### EXPORTED VARIABLES ##################################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-function-declarations == +/* ##### EXPORTED FUNCTION DECLARATIONS ######################################### */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/c.cpp.template b/.vim/c-support/templates/c.cpp.template new file mode 100644 index 0000000..ce15421 --- /dev/null +++ b/.vim/c-support/templates/c.cpp.template @@ -0,0 +1,353 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.method-implementation == +<CURSOR>void +|?CLASSNAME|::|?METHODNAME| ( ) +{ + return ; +} /* ----- end of method |CLASSNAME|::|?METHODNAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class == +/* + * ===================================================================================== + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ===================================================================================== + */ +class |CLASSNAME| +{ + public: + /* ==================== LIFECYCLE ======================================= */ + |CLASSNAME| (); /* constructor */ + + /* ==================== OPERATORS ======================================= */ + + /* ==================== OPERATIONS ======================================= */ + + /* ==================== ACCESS ======================================= */ + + /* ==================== INQUIRY ======================================= */ + + /* ==================== DATA MEMBERS ======================================= */ + protected: + + private: + +}; /* ----- end of class |CLASSNAME| ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: |CLASSNAME| + * Description: constructor + *-------------------------------------------------------------------------------------- + */ +|CLASSNAME|::|CLASSNAME| () +{ +} /* ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new == +/* + * ===================================================================================== + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ===================================================================================== + */ +class |CLASSNAME| +{ + public: + + /* ==================== LIFECYCLE ======================================= */ + |CLASSNAME| (); /* constructor */ + |CLASSNAME| ( const |CLASSNAME| &other ); /* copy constructor */ + ~|CLASSNAME| (); /* destructor */ + + /* ==================== OPERATORS ======================================= */ + const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); /* assignment operator */ + + /* ==================== OPERATIONS ======================================= */ + + /* ==================== ACCESS ======================================= */ + + /* ==================== INQUIRY ======================================= */ + + /* ==================== DATA MEMBERS ======================================= */ + protected: + + private: + +}; /* ----- end of class |CLASSNAME| ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: |CLASSNAME| + * Description: constructor + *-------------------------------------------------------------------------------------- + */ +|CLASSNAME|::|CLASSNAME| () +{ +} /* ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: |CLASSNAME| + * Description: copy constructor + *-------------------------------------------------------------------------------------- + */ +|CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other ) +{ +} /* ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: ~|CLASSNAME| + * Description: destructor + *-------------------------------------------------------------------------------------- + */ +|CLASSNAME|::~|CLASSNAME| () +{ +} /* ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) ----- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: operator = + * Description: assignment operator + *-------------------------------------------------------------------------------------- + */ +const |CLASSNAME|& +|CLASSNAME|::operator = ( const |CLASSNAME| &other ) +{ + if ( this != &other ) { + } + return *this; +} /* ----- end of method |CLASSNAME|::operator = (assignment operator) ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.error-class == +/* + * ===================================================================================== + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ===================================================================================== + */ +class |CLASSNAME| +{ + public: |CLASSNAME| ( char *msg ):message(msg) { } + virtual ~|CLASSNAME| ( ) { } + virtual const char* what ( ) const throw ( ) { return message; } + protected: char *message; +}; /* ----- end of class |CLASSNAME| ----- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-method-implementation == +template < class T > +void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( ) +{ + return ; +} /* ----- end of method |CLASSNAME|<T>::|METHODNAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class == +/* + * ===================================================================================== + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ===================================================================================== + */ +template < class T > +class |CLASSNAME| +{ + public: + + /* ==================== LIFECYCLE ======================================= */ + |CLASSNAME| (); /* constructor */ + + /* ==================== OPERATORS ======================================= */ + + /* ==================== OPERATIONS ======================================= */ + + /* ==================== ACCESS ======================================= */ + + /* ==================== INQUIRY ======================================= */ + + /* ==================== DATA MEMBERS ======================================= */ + protected: + + private: + +}; /* ---------- end of template class |CLASSNAME| ---------- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: |CLASSNAME| + * Description: + *-------------------------------------------------------------------------------------- + */ +template < class T > +|CLASSNAME| < T >::|CLASSNAME| () +{ +} /* ---------- end of constructor of template class |CLASSNAME| ---------- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new == +/* + * ===================================================================================== + * Class: |?CLASSNAME:c| + * Description: <CURSOR> + * ===================================================================================== + */ +template < class T > +class |CLASSNAME| +{ + public: + + /* ==================== LIFECYCLE ======================================= */ + |CLASSNAME| (); /* constructor */ + |CLASSNAME| (const |CLASSNAME| &other); /* copy constructor */ + ~|CLASSNAME| (); /* destructor */ + + /* ==================== OPERATORS ======================================= */ + const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); /* assignment operator */ + + /* ==================== OPERATIONS ======================================= */ + + /* ==================== ACCESS ======================================= */ + + /* ==================== INQUIRY ======================================= */ + + /* ==================== DATA MEMBERS ======================================= */ + protected: + + private: + +}; /* ---------- end of template class |CLASSNAME| ---------- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: |CLASSNAME| + * Description: constructor + *-------------------------------------------------------------------------------------- + */ +template < class T > +|CLASSNAME|< T >::|CLASSNAME| () +{ +} /* ---------- end of constructor of template class |CLASSNAME| ---------- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: |CLASSNAME| + * Description: copy constructor + *-------------------------------------------------------------------------------------- + */ +template < class T > +|CLASSNAME|< T >::|CLASSNAME| ( const |CLASSNAME| &other ) +{ +} /* ---------- end of copy constructor of template class |CLASSNAME| ---------- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: ~|CLASSNAME| + * Description: destructor + *-------------------------------------------------------------------------------------- + */ +template < class T > +|CLASSNAME|< T >::~|CLASSNAME| () +{ +} /* ---------- end of destructor of template class |CLASSNAME| ---------- */ + +/* + *-------------------------------------------------------------------------------------- + * Class: |CLASSNAME| + * Method: operator = + * Description: assignment operator + *-------------------------------------------------------------------------------------- + */ +template < class T > +const |CLASSNAME|< T >& |CLASSNAME|< T >::operator = ( const |CLASSNAME| &other ) +{ + return *this; +} /* ---------- end of assignment operator of template class |CLASSNAME| ---------- */ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-function == +template <class T> +<CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param ) +{ + return ; +} /* ----- end of template function |?TEMPALTE_FUNCTION_NAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-in == +ostream & +operator << ( ostream & os, const |?CLASSNAME| & obj ) +{ + os << obj.<CURSOR> ; + return os; +} /* ----- end of function operator << ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-out == +istream & +operator >> ( istream & is, |?CLASSNAME| & obj ) +{ + is >> obj.<CURSOR> ; + return is; +} /* ----- end of function operator >> ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.try-catch == +try {<CURSOR> +<SPLIT>} +catch ( const &ExceptObj ) { /* handle exception: */ +} +catch (...) { /* handle exception: unspezified */ +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch == +catch ( <CURSOR>const &ExceptObj ) { /* handle exception: */ +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch-points == +catch (...) { /* handle exception: */ +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.extern == +extern "C" {<CURSOR> +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-input-file == +char *ifs_file_name = "<CURSOR>"; /* input file name */ +ifstream ifs; /* create ifstream object */ + +ifs.open (ifs_file_name); /* open ifstream */ +if (!ifs) { + cerr << "\nERROR : failed to open input file " << ifs_file_name << endl; + exit (EXIT_FAILURE); +} + + +ifs.close (); /* close ifstream */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-output-file == +char *ofs_file_name = "<CURSOR>"; /* output file name */ +ofstream ofs; /* create ofstream object */ + +ofs.open (ofs_file_name); /* open ofstream */ +if (!ofs) { + cerr << "\nERROR : failed to open output file " << ofs_file_name << endl; + exit (EXIT_FAILURE); +} + + +ofs.close (); /* close ofstream */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.namespace == +namespace |?NAMESPACE| +{<CURSOR> +<SPLIT>} /* ----- end of |NAMESPACE| name ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/c.idioms.template b/.vim/c-support/templates/c.idioms.template new file mode 100644 index 0000000..09bc0b7 --- /dev/null +++ b/.vim/c-support/templates/c.idioms.template @@ -0,0 +1,98 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function == +void<CURSOR> +|?FUNCTION_NAME| ( ) +{ +<SPLIT> return ; +} /* ----- end of function |FUNCTION_NAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function-static == +static void<CURSOR> +|?FUNCTION_NAME| ( ) +{ +<SPLIT> return ; +} /* ----- end of static function |FUNCTION_NAME| ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.main == +int +main ( int argc, char *argv[] ) +{<CURSOR> +<SPLIT> return EXIT_SUCCESS; +} /* ---------- end of function main ---------- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.enum == +enum |?ENUM_NAME| {<CURSOR> +<SPLIT>}; /* ---------- end of enum |ENUM_NAME| ---------- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.struct == +struct |?STRUCT_NAME| {<CURSOR> +<SPLIT>}; /* ---------- end of struct |STRUCT_NAME| ---------- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.union == +union |?UNION_NAME| {<CURSOR> +<SPLIT>}; /* ---------- end of union |UNION_NAME| ---------- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.calloc == +|?POINTER| = (<CURSOR>TYPE*)calloc ( (size_t)(COUNT), sizeof(TYPE) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.malloc == +|?POINTER| = (<CURSOR>TYPE*)malloc ( sizeof(TYPE) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-input-file == +FILE *|?FILEPOINTER|; /* input-file pointer */ +char *|FILEPOINTER|_file_name = "<CURSOR>"; /* input-file name */ + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "r" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + + +if( fclose(|FILEPOINTER|) == EOF ) { /* close input file */ + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-output-file == +FILE *|?FILEPOINTER|; /* output-file pointer */ +char *|FILEPOINTER|_file_name = "<CURSOR>"; /* output-file name */ + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "w" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + + +if( fclose(|FILEPOINTER|) == EOF ) { /* close output file */ + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.fprintf == +fprintf ( |?FILEPOINTER|, "<CURSOR>\n", ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.fscanf == +fscanf ( |?FILEPOINTER|, "<CURSOR>", & ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/c.preprocessor.template b/.vim/c-support/templates/c.preprocessor.template new file mode 100644 index 0000000..3ec674a --- /dev/null +++ b/.vim/c-support/templates/c.preprocessor.template @@ -0,0 +1,34 @@ +$------------------------------------------------------------------------- +== preprocessor.define == +#define <CURSOR> /* */ +$------------------------------------------------------------------------- +== preprocessor.undefine == +#undef <CURSOR> /* */ +$------------------------------------------------------------------------- +== preprocessor.if-else-endif == +#if |?CONDITION:u| +<CURSOR><SPLIT> +#else /* ----- not |CONDITION| ----- */ + +#endif /* ----- not |CONDITION| ----- */ +$------------------------------------------------------------------------- +== preprocessor.ifdef-else-endif == +#ifdef |?CONDITION:u| +<CURSOR><SPLIT> +#else /* ----- not |CONDITION| ----- */ + +#endif /* ----- not |CONDITION| ----- */ +$------------------------------------------------------------------------- +== preprocessor.ifndef-else-endif == +#ifndef |?CONDITION:u| +<CURSOR><SPLIT> +#else /* ----- not |CONDITION| ----- */ + +#endif /* ----- not |CONDITION| ----- */ +$------------------------------------------------------------------------- +== preprocessor.ifndef-def-endif == +#ifndef |?BASENAME:L|_INC +#define |BASENAME|_INC +<CURSOR><SPLIT> +#endif /* ----- #ifndef |BASENAME|_INC ----- */ +$------------------------------------------------------------------------- diff --git a/.vim/c-support/templates/c.statements.template b/.vim/c-support/templates/c.statements.template new file mode 100644 index 0000000..966ae3a --- /dev/null +++ b/.vim/c-support/templates/c.statements.template @@ -0,0 +1,62 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.do-while == +do { +<SPLIT>} while ( <CURSOR> ); /* ----- end do-while ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for == +for ( <CURSOR>; ; ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for-block == +for ( <CURSOR>; ; ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if == +if ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block == +if ( <CURSOR> ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-else == +if ( <CURSOR> ) +<SPLIT>else +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block-else == +if ( <CURSOR> ) { +<SPLIT>} else { +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while == +while ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while-block == +while ( <CURSOR> ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.switch == +switch ( <CURSOR> ) { + case : + <SPLIT>break; + + case : + break; + + case : + break; + + case : + break; + + default: + break; +} /* ----- end switch ----- */ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.case == +case <CURSOR>: +break; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.block == +{<CURSOR> +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.comments.template b/.vim/c-support/templates/cpp.comments.template new file mode 100644 index 0000000..9929eab --- /dev/null +++ b/.vim/c-support/templates/cpp.comments.template @@ -0,0 +1,139 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.end-of-line-comment == append == +// <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.frame == +//---------------------------------------------------------------------- +// <CURSOR> +//---------------------------------------------------------------------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.function == +// === FUNCTION =========================================================== +// Name: |?FUNCTION_NAME| +// Description: <CURSOR> +// ========================================================================== +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.method == +//--------------------------------------------------------------------------- +// Class: |?CLASSNAME| +// Method: |?METHODNAME| +// Description: <CURSOR> +//--------------------------------------------------------------------------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.class == +// ========================================================================== +// Class: |?CLASSNAME| +// Description: <CURSOR> +// ========================================================================== +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-description == start == +// ========================================================================== +// +// Filename: |FILENAME| +// +// Description: <CURSOR> +// +// Version: 1.0 +// Created: |DATE| |TIME| +// Revision: none +// Compiler: g++ +// +// Author: |AUTHOR| (|AUTHORREF|), |EMAIL| +// License: |LICENSE| +// +// ========================================================================== + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-bug == append == + // :BUG:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-compiler == append == + // :COMPILER:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-todo == append == + // :TODO:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-tricky == append == + // :TRICKY:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-warning == append == + // :WARNING:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-workaround == append == + // :WORKAROUND:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.keyword-keyword == append == + // :|?KEYWORD:u|:|DATE| |TIME|:|AUTHORREF|: <CURSOR> +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-header-includes == +// ##### HEADER FILE INCLUDES ################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-macros == +// ##### MACROS - LOCAL TO THIS SOURCE FILE ################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-typedefs == +// ##### TYPE DEFINITIONS - LOCAL TO THIS SOURCE FILE ######################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-data-types == +// ##### DATA TYPES - LOCAL TO THIS SOURCE FILE ############################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-defs == +// ##### CLASS DEFINITIONS - LOCAL TO THIS SOURCE FILE ######################## + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-local-variables == +// ##### VARIABLES - LOCAL TO THIS SOURCE FILE ################################ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-prototypes == +// ##### PROTOTYPES - LOCAL TO THIS SOURCE FILE ############################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-exported == +// ##### FUNCTION DEFINITIONS - EXPORTED FUNCTIONS ############################ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-function-defs-local == +// ##### FUNCTION DEFINITIONS - LOCAL TO THIS SOURCE FILE ##################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-exported == +// ##### CLASS IMPLEMENTATIONS - EXPORTED CLASSES ############################# + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-cpp-class-implementations-local == +// ##### CLASS IMPLEMENTATIONS - LOCAL CLASSES ################################ + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-header-includes == +// ##### HEADER FILE INCLUDES ################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-macros == +// ##### EXPORTED MACROS ######################################################## + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-typedefs == +// ##### EXPORTED TYPE DEFINITIONS ############################################## + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-data-types == +// ##### EXPORTED DATA TYPES #################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-class-defs == +// ##### EXPORTED CLASS DEFINITIONS ############################################# + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-variables == +// ##### EXPORTED VARIABLES ##################################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== comment.file-section-hpp-exported-function-declarations == +// ##### EXPORTED FUNCTION DECLARATIONS ######################################### + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.cpp.template b/.vim/c-support/templates/cpp.cpp.template new file mode 100644 index 0000000..7773989 --- /dev/null +++ b/.vim/c-support/templates/cpp.cpp.template @@ -0,0 +1,329 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.method-implementation == +<CURSOR>void +|?CLASSNAME|::|?METHODNAME| ( ) +{ + return ; +} // ----- end of method |CLASSNAME|::|METHODNAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + + // ==================== OPERATORS ======================================= + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| () +{ +} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.class-using-new == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor + ~|CLASSNAME| (); // destructor + + // ==================== OPERATORS ======================================= + const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| () +{ +} // ----- end of method |CLASSNAME|::|CLASSNAME| (constructor) ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: copy constructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::|CLASSNAME| ( const |CLASSNAME| &other ) +{ +} // ----- end of method |CLASSNAME|::|CLASSNAME| (copy constructor) ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: ~|CLASSNAME| +// Description: destructor +//-------------------------------------------------------------------------------------- +|CLASSNAME|::~|CLASSNAME| () +{ +} // ----- end of method |CLASSNAME|::~|CLASSNAME| (destructor) ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: operator = +// Description: assignment operator +//-------------------------------------------------------------------------------------- +const |CLASSNAME|& +|CLASSNAME|::operator = ( const |CLASSNAME| &other ) +{ + if ( this != &other ) { + } + return *this; +} // ----- end of method |CLASSNAME|::operator = (assignment operator) ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.error-class == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== +class |CLASSNAME| +{ + public: |CLASSNAME| ( char *msg ):message(msg) { } + virtual ~|CLASSNAME| ( ) { } + virtual const char* what ( ) const throw ( ) { return message; } + protected: char *message; +}; // ---------- end of class |CLASSNAME| ---------- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-method-implementation == +template < class T > +void<CURSOR> |?CLASSNAME|<T>::|?METHODNAME| ( ) +{ + return ; +} // ----- end of method |CLASSNAME|<T>::|METHODNAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + + // ==================== OPERATORS ======================================= + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME| <T>:: |CLASSNAME| () +{ +} // ----- end of constructor of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-class-using-new == +// ===================================================================================== +// Class: |?CLASSNAME:c| +// Description: <CURSOR> +// ===================================================================================== + +template < class T > +class |CLASSNAME| +{ + public: + + // ==================== LIFECYCLE ======================================= + |CLASSNAME| (); // constructor + |CLASSNAME| ( const |CLASSNAME| &other ); // copy constructor + ~|CLASSNAME| (); // destructor + + // ==================== OPERATORS ======================================= + + const |CLASSNAME|& operator = ( const |CLASSNAME| &other ); // assignment operator + + // ==================== OPERATIONS ======================================= + + // ==================== ACCESS ======================================= + + // ==================== INQUIRY ======================================= + + // ==================== DATA MEMBERS ======================================= + protected: + + private: + +}; // ----- end of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME|<T>::|CLASSNAME| () +{ +} // ----- end of constructor of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: |CLASSNAME| +// Description: copy constructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME|<T>::|CLASSNAME| ( const |CLASSNAME| &other ) +{ +} // ----- end of copy constructor of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: ~|CLASSNAME| +// Description: destructor +//-------------------------------------------------------------------------------------- +template < class T > +|CLASSNAME|<T>::~|CLASSNAME| () +{ +} // ----- end of destructor of template class |CLASSNAME| ----- + +//-------------------------------------------------------------------------------------- +// Class: |CLASSNAME| +// Method: operator = +// Description: assignment operator +//-------------------------------------------------------------------------------------- +template < class T > +const |CLASSNAME|<T>& |CLASSNAME|<T>::operator = ( const |CLASSNAME| &other ) +{ + if ( this != &other ) { + } + return *this; +} // ----- end of assignment operator of template class |CLASSNAME| ----- + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.template-function == +template <class T> +<CURSOR>void |?TEMPALTE_FUNCTION_NAME| ( T param ) +{ + return ; +} // ----- end of template function |?TEMPALTE_FUNCTION_NAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-in == +ostream & +operator << ( ostream & os, const |?CLASSNAME| & obj ) +{ + os << obj.<CURSOR> ; + return os; +} // ----- end of function operator << ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.operator-out == +istream & +operator >> ( istream & is, |?CLASSNAME| & obj ) +{ + is >> obj.<CURSOR> ; + return is; +} // ----- end of function operator >> ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.try-catch == +try {<CURSOR> +<SPLIT>} +catch ( const &ExceptObj ) { // handle exception: +} +catch (...) { // handle exception: unspezified +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch == +catch ( <CURSOR>const &ExceptObj ) { // handle exception: +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.catch-points == +catch (...) { // handle exception: +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.extern == +extern "C" {<CURSOR> +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-input-file == +char *ifs_file_name = "<CURSOR>"; // input file name +ifstream ifs; // create ifstream object + +ifs.open (ifs_file_name); // open ifstream +if (!ifs) { + cerr << "\nERROR : failed to open input file " << ifs_file_name << endl; + exit (EXIT_FAILURE); +} + + +ifs.close (); // close ifstream +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.open-output-file == +char *ofs_file_name = "<CURSOR>"; // output file name +ofstream ofs; // create ofstream object + +ofs.open (ofs_file_name); // open ofstream +if (!ofs) { + cerr << "\nERROR : failed to open output file " << ofs_file_name << endl; + exit (EXIT_FAILURE); +} + + +ofs.close (); // close ofstream +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== cpp.namespace == +namespace |?NAMESPACE| +{<CURSOR> +<SPLIT>} // ----- end of |NAMESPACE| name ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.idioms.template b/.vim/c-support/templates/cpp.idioms.template new file mode 100644 index 0000000..febc375 --- /dev/null +++ b/.vim/c-support/templates/cpp.idioms.template @@ -0,0 +1,98 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function == +void<CURSOR> +|?FUNCTION_NAME| ( ) +{ +<SPLIT> return ; +} // ----- end of function |FUNCTION_NAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.function-static == +static void<CURSOR> +|?FUNCTION_NAME| ( ) +{ +<SPLIT> return ; +} // ----- end of static function |FUNCTION_NAME| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.main == +int +main ( int argc, char *argv[] ) +{<CURSOR> +<SPLIT> return EXIT_SUCCESS; +} // ---------- end of function main ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.enum == +enum |?ENUM_NAME| {<CURSOR> +<SPLIT>}; // ---------- end of enum |ENUM_NAME| ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.struct == +struct |?STRUCT_NAME| {<CURSOR> +<SPLIT>}; // ---------- end of struct |STRUCT_NAME| ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.union == +union |?UNION_NAME| {<CURSOR> +<SPLIT>}; // ---------- end of union |UNION_NAME| ---------- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.calloc == +|?POINTER| = (<CURSOR>TYPE*)calloc ( (size_t)(COUNT), sizeof(TYPE) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.malloc == +|?POINTER| = (<CURSOR>TYPE*)malloc ( sizeof(TYPE) ); +if ( |POINTER|==NULL ) { + fprintf ( stderr, "\ndynamic memory allocation failed\n" ); + exit (EXIT_FAILURE); +} + +free (|POINTER|); + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-input-file == +FILE *|?FILEPOINTER|; // input-file pointer +char *|FILEPOINTER|_file_name = "<CURSOR>"; // input-file name + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "r" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + + +if( fclose(|FILEPOINTER|) == EOF ) { // close input file + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.open-output-file == +FILE *|?FILEPOINTER|; // output-file pointer +char *|FILEPOINTER|_file_name = "<CURSOR>"; // output-file name + +|FILEPOINTER| = fopen( |FILEPOINTER|_file_name, "w" ); +if ( |FILEPOINTER| == NULL ) { + fprintf ( stderr, "couldn't open file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + + +if( fclose(|FILEPOINTER|) == EOF ) { // close output file + fprintf ( stderr, "couldn't close file '%s'; %s\n", + |FILEPOINTER|_file_name, strerror(errno) ); + exit (EXIT_FAILURE); +} + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.fprintf == +fprintf ( |?FILEPOINTER|, "<CURSOR>\n", ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== idioms.fscanf == +fscanf ( |?FILEPOINTER|, "<CURSOR>", & ); +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.preprocessor.template b/.vim/c-support/templates/cpp.preprocessor.template new file mode 100644 index 0000000..dbf8abb --- /dev/null +++ b/.vim/c-support/templates/cpp.preprocessor.template @@ -0,0 +1,34 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== preprocessor.define == +#define <CURSOR> // +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== preprocessor.undefine == +#undef <CURSOR> // +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== preprocessor.if-else-endif == +#if |?CONDITION:u| +<CURSOR><SPLIT> +#else // ----- not |CONDITION| ----- + +#endif // ----- not |CONDITION| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== preprocessor.ifdef-else-endif == +#ifdef |?CONDITION:u| +<CURSOR><SPLIT> +#else // ----- not |CONDITION| ----- + +#endif // ----- not |CONDITION| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== preprocessor.ifndef-else-endif == +#ifndef |?CONDITION:u| +<CURSOR><SPLIT> +#else // ----- not |CONDITION| ----- + +#endif // ----- not |CONDITION| ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== preprocessor.ifndef-def-endif == +#ifndef |?BASENAME:L|_INC +#define |BASENAME|_INC +<CURSOR><SPLIT> +#endif // ----- #ifndef |BASENAME|_INC ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/templates/cpp.statements.template b/.vim/c-support/templates/cpp.statements.template new file mode 100644 index 0000000..8018334 --- /dev/null +++ b/.vim/c-support/templates/cpp.statements.template @@ -0,0 +1,62 @@ +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.do-while == +do { +<SPLIT>} while ( <CURSOR> ); // ----- end do-while ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for == +for ( <CURSOR>; ; ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.for-block == +for ( <CURSOR>; ; ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if == +if ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block == +if ( <CURSOR> ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-else == +if ( <CURSOR> ) +<SPLIT>else +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.if-block-else == +if ( <CURSOR> ) { +<SPLIT>} else { +} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while == +while ( <CURSOR> ) +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.while-block == +while ( <CURSOR> ) { +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.switch == +switch ( <CURSOR> ) { + case : + <SPLIT>break; + + case : + break; + + case : + break; + + case : + break; + + default: + break; +} // ----- end switch ----- +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.case == +case <CURSOR>: +break; + +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +== statements.block == +{<CURSOR> +<SPLIT>} +$%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/.vim/c-support/wordlists/c-c++-keywords.list b/.vim/c-support/wordlists/c-c++-keywords.list new file mode 100644 index 0000000..5a97dd6 --- /dev/null +++ b/.vim/c-support/wordlists/c-c++-keywords.list @@ -0,0 +1,209 @@ +adjustfield +basefield +boolalpha +floatfield +internal +scientific +setbase +setiosflags +setprecision +showbase +showpoint +showpos +uppercase + +auto +break +case +char +const +continue +default +double +else +enum +extern +float +goto +inline +long +register +restrict +return +short +signed +sizeof +static +struct +switch +typedef +union +unsigned +void +volatile +while +_Bool +_Complex +_Imaginary +EXIT_FAILURE +EXIT_SUCCESS + +bool +catch +class +const_cast +delete +dynamic_cast +explicit +export +false +friend +mutable +namespace +operator +private +protected +public +reinterpret_cast +static_cast +template +this +throw +true +typeid +typename +using +virtual +wchar_t + +and_eq +bitand +bitor +compl +not_eq +or_eq +xor_eq + +define +defined +elif +endif +error +ifdef +ifndef +include +pragma +undef + +exception +bad_alloc +bad_exception +bad_cast +bad_typeid +ios_base::failure +logic_error +domain_error +invalid_argument +length_error +out_of_range +runtime_error +range_error +overflow_error +underflow_error +uncaught_exception + +__DATE__ +__FILE__ +__LINE__ +__STDC__ +__STDC_HOSTED__ +__STDC_IEC_559__ +__STDC_IEC_559_COMPLEX__ +__STDC_ISO_10646__ +__STDC_VERSION__ +__TIME__ +__func__ +__cplusplus + +__BORLANDC__ +__CYGWIN__ +__CYGWIN32__ +__GNUC__ +__WIN32__ +__WINDOWS__ + +assert +ctype +errno +float +limits +locale +math +setjmp +signal +stdarg +stddef +stdio +stdlib +string +time + +complex +fenv +inttypes +iso646 +stdbool +stdint +tgmath +wchar +wctype + +algorithm +bitset +complex +deque +exception +fstream +functional +iomanip +ios +iosfwd +iostream +istream +iterator +limits +list +locale + +map +memory +new +numeric +ostream +queue +set +sstream +stack +stdexcept +streambuf +string +typeinfo +utility +valarray +vector + +cassert +cctype +cerrno +cfloat +climits +clocale +cmath +csetjmp +csignal +cstdarg +cstddef +cstdio +cstdlib +cstring +ctime diff --git a/.vim/c-support/wordlists/k+r.list b/.vim/c-support/wordlists/k+r.list new file mode 100644 index 0000000..805756a --- /dev/null +++ b/.vim/c-support/wordlists/k+r.list @@ -0,0 +1,108 @@ +address +allocator +allocation +argument +arithmetic +array +assignement +bitwise +block +character +command +condition +conditional +constant +conversion +declaration +decrement +defined +definition +descriptor +description +dimension +evaluation +expression +external +format +formatted +function +global +handling +identifier +implementation +increment +initialization +input +interface +label +lexical +local +logical +lookup +loop +lvalue +miscellaneous +notation +numerical +operator +operation +output +pointer +precedence +preprocessor +preprocessing +program +random +recursion +recursive +reference +referential +relational +scope +standard +statement +string +structure +system +undefined +variable + +abstract +algorithm +alignment +application +assignment +asynchronous +binary +buffer +component +constructor +container +destructor +difference +enumeration +exception +floating-point +horizontal +inheritance +instantiation +integer +internal +invariant +iterator +localization +overflow +overload +override +overwrite +polymorphic +portability +position +postcondition +precision +precondition +prototype +subscript +underflow +vertical +whitespace diff --git a/.vim/c-support/wordlists/stl_index.list b/.vim/c-support/wordlists/stl_index.list new file mode 100644 index 0000000..b5d98a3 --- /dev/null +++ b/.vim/c-support/wordlists/stl_index.list @@ -0,0 +1,202 @@ +accumulate +adjacent_difference +adjacent_find +advance +append +assign +auto_ptr +back +back_inserter +basic_string +bidirectional_iterator +bidirectional_iterator_tag +binary_compose +binary_function +binary_negate +binary_search +bind1st +bind2nd +bit_vector +bitset +capacity +char_producer +char_traits +char_type +compare +construct +copy +copy_backward +copy_n +count +count_if +deque +destroy +distance +distance_type +divides +equal +equal_range +equal_to +erase +fill +fill_n +find +find_end +find_first_not_of +find_first_of +find_if +find_last_not_of +find_last_of +for_each +forward_iterator +forward_iterator_tag +front +front_inserter +generate +generate_n +get_temporary_buffer +greater +greater_equal +hash +hash_map +hash_multimap +hash_multiset +hash_set +identity +includes +inner_product +inplace_merge +input_iterator +input_iterator_tag +insert +insert_iterator +inserter +int_type +iota +is_heap +is_sorted +istream_iterator +istream_type +istreambuf_iterator +iter_swap +iterator_category +iterator_traits +less +less_equal +lexicographical_compare +lexicographical_compare_3way +list +logical_and +logical_not +logical_or +lower_bound +make_heap +make_pair +map +max +max_element +mem_fun1_ref_t +mem_fun1_t +mem_fun_ref_t +mem_fun_t +merge +min +min_element +minus +mismatch +modulus +multimap +multiplies +multiset +negate +next_permutation +not_equal_to +nth_element +operator +ostream_iterator +ostreambuf_iterator +output_iterator +output_iterator_tag +pair +partial_sort +partial_sort_copy +partial_sum +partition +plus +pointer_to_binary_function +pointer_to_unary_function +pop_back +pop_front +pop_heap +power +prev_permutation +priority_queue +project1st +project2nd +ptr_fun +push_back +push_front +push_heap +queue +random_access_iterator +random_access_iterator_tag +random_sample +random_sample_n +random_shuffle +raw_storage_iterator +release +remove +remove_copy +remove_copy_if +remove_if +replace +replace_copy +replace_copy_if +replace_if +reset +resize +return_temporary_buffer +reverse +reverse_bidirectional_iterator +reverse_copy +reverse_iterator +rfind +rope +rotate +rotate_copy +search +search_n +select1st +select2nd +sequence_buffer +set +set_difference +set_intersection +set_symmetric_difference +set_union +slist +sort +sort_heap +stable_partition +stable_sort +stack +streambuf_type +substr +subtractive_rng +swap +swap_ranges +temporary_buffer +transform +unary_compose +unary_function +unary_negate +uninitialized_copy +uninitialized_copy_n +uninitialized_fill +uninitialized_fill_n +unique +unique_copy +upper_bound +value_comp +value_type +vector |