-
Notifications
You must be signed in to change notification settings - Fork 6
/
README
126 lines (88 loc) · 3.5 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
This is a mirror of http://www.vim.org/scripts/script.php?script_id=5105
h2cppx(vim-port): parse the c++ header file and generate c++ implement code
===========================================================================
**Purpose:** Parse the c++ header file and generate c++ implement code for vim plugin
**Required:** python 2.x
**Author:** xiaok
**External module required:** cheetah yaml(python package)
**Third-party(the plugin already include):** pyvisitor CppHeaderParser(modification)
[Github-Link](https://github.com/xuqix/h2cppx.git)
Installation
------------
Before start, make sure you have installed the python package "yaml",
Then run below command:
cd ~/.vim/plugin
git clone 'https://github.com/xuqix/h2cppx.git
cd h2cppx
git checkout vim-port
or you can use bundle to install it:
add `Bundle 'xuqix/h2cppx'` to ~/.vimrc and install it,then:
cd ~/.vim/bundle/h2cppx
git checkout vim-port
Now you can start using it.
After the installation is complete,
You can map the key in .vimrc to quickly use the command.
e.g:
nmap <F3> :H2cppx<ESC>
nmap <F4> :H2cppxLine<ESC>
nmap <F3>p :CpH2cppx<ESC>
nmap <F4>p :CpH2cppxLine<ESC>
nmap <F5> :H2cppxAuto<ESC>
Config
------
If the plugin can't find the python path in your computer,
you need set "g:python_path" in the .vimrc file like this:
let g:h2cppx_python_path = '/usr/bin/python'
and you can specify the cppfile name extension like this:
(default value is 'cpp')
let g:h2cppx_postfix = 'cxx'
five code-generate template file are provided by default,you
can config it in '.vimrc' like this(template0-4,default is template1):
let g:h2cppx_template = 'template4'
if needed,you can refer to the default template and write your own template
files,and use absolute path config it :
let g:h2cppx_template = '/home/xxx/.../xxx'
Finally,you can add a configuration file `.h2cppx_conf` in your project
directory to help plugin search for cppfile,otherwise the plugin will find
cppfile in your header file directory.
The configuration file might look like:
/home/test/temp/src
src1
src2
see the project_sample directory.
Usage
-----
The plugin function description:
* :H2cppx
Parse c++ header file and generate cpp file
* :CpH2cppx
Like :H2cppx,but generat code in your clipboard, no file writed,you can use "p" to get it.
* :H2cppxLine
Generate cpp code in the cursor line,and append to the end of the cpp file
* :CpH2cppxLine
Like :H2cppxLine,but generat code in your clipboard, no file writed,you can use "p" to get it.
* :H2cppxAuto (Recommendation)
Auto Contrast header and implementation files, find
function declarations in the header file and append
the newly added to the implementation file, if the
file does not exist to achieve a new file is created!
Example:
-------
vim test.h
:H2cppx
Now you can find new file "test.cpp" in your directory
vim test.h
:H2cppxLine
Now you can find defined in your file "test.cpp" from current line of cursor
vim test.h
:CpH2cppx
Like :H2cppx, but defined in your clipboard, no file writed, just use "p" to get it.
vim test.h
:CpH2cppxLine
Like :H2cppxLine, but defined in your clipboard, no file is writed.
vim test.h
:H2cppxAuto
Auto Contrast header and implementation files, find function
declarations in the header file and append the newly added to
the implementation file, if the file does not exist to achieve
a new file is created!