tomkersten-vixploder 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/Manifest.txt +105 -0
- data/PostInstall.txt +21 -0
- data/README.rdoc +131 -0
- data/Rakefile +21 -0
- data/bin/256colors2.pl +63 -0
- data/bin/colortest +365 -0
- data/bin/vixplode +10 -0
- data/lib/dotfiles/aliases +30 -0
- data/lib/dotfiles/gvimrc +20 -0
- data/lib/dotfiles/vim/.VimballRecord +2 -0
- data/lib/dotfiles/vim/after/ftplugin/actionscript_snippets.vim +9 -0
- data/lib/dotfiles/vim/after/ftplugin/aspvbs_snippets.vim +17 -0
- data/lib/dotfiles/vim/after/ftplugin/c_snippets.vim +58 -0
- data/lib/dotfiles/vim/after/ftplugin/css_snippets.vim +30 -0
- data/lib/dotfiles/vim/after/ftplugin/django_model_snippets.vim +61 -0
- data/lib/dotfiles/vim/after/ftplugin/django_template_snippets.vim +32 -0
- data/lib/dotfiles/vim/after/ftplugin/f-script_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/haskell_snippets.vim +9 -0
- data/lib/dotfiles/vim/after/ftplugin/html_snippets.vim +57 -0
- data/lib/dotfiles/vim/after/ftplugin/java_snippets.vim +52 -0
- data/lib/dotfiles/vim/after/ftplugin/javascript_snippets.vim +10 -0
- data/lib/dotfiles/vim/after/ftplugin/latex_snippets.vim +13 -0
- data/lib/dotfiles/vim/after/ftplugin/logo_snippets.vim +9 -0
- data/lib/dotfiles/vim/after/ftplugin/markdown_snippets.vim +10 -0
- data/lib/dotfiles/vim/after/ftplugin/movable_type_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/objc_snippets.vim +53 -0
- data/lib/dotfiles/vim/after/ftplugin/ocaml_snippets.vim +26 -0
- data/lib/dotfiles/vim/after/ftplugin/perl_snippets.vim +23 -0
- data/lib/dotfiles/vim/after/ftplugin/php_snippets.vim +30 -0
- data/lib/dotfiles/vim/after/ftplugin/phpdoc_snippets.vim +19 -0
- data/lib/dotfiles/vim/after/ftplugin/propel_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/python_snippets.vim +202 -0
- data/lib/dotfiles/vim/after/ftplugin/rails_snippets.vim +54 -0
- data/lib/dotfiles/vim/after/ftplugin/ruby_snippets.vim +32 -0
- data/lib/dotfiles/vim/after/ftplugin/sh_snippets.vim +12 -0
- data/lib/dotfiles/vim/after/ftplugin/slate_snippets.vim +19 -0
- data/lib/dotfiles/vim/after/ftplugin/smarty_snippets.vim +35 -0
- data/lib/dotfiles/vim/after/ftplugin/symfony_snippets.vim +21 -0
- data/lib/dotfiles/vim/after/ftplugin/tcl_snippets.vim +14 -0
- data/lib/dotfiles/vim/after/ftplugin/template_toolkit_snippets.vim +13 -0
- data/lib/dotfiles/vim/after/ftplugin/tex_snippets.vim +13 -0
- data/lib/dotfiles/vim/after/ftplugin/xhtml_snippets.vim +48 -0
- data/lib/dotfiles/vim/autoload/fakeclip.vim +253 -0
- data/lib/dotfiles/vim/autoload/rails.vim +4377 -0
- data/lib/dotfiles/vim/autoload/rubycomplete.vim +802 -0
- data/lib/dotfiles/vim/colors/inkpot.vim +212 -0
- data/lib/dotfiles/vim/colors/ir_black.vim +212 -0
- data/lib/dotfiles/vim/colors/ir_black_mod.vim +213 -0
- data/lib/dotfiles/vim/colors/railscasts.vim +100 -0
- data/lib/dotfiles/vim/colors/rubyblue.vim +74 -0
- data/lib/dotfiles/vim/colors/twilight.vim +75 -0
- data/lib/dotfiles/vim/colors/twilight2.vim +74 -0
- data/lib/dotfiles/vim/colors/wombat256.vim +302 -0
- data/lib/dotfiles/vim/compiler/eruby.vim +41 -0
- data/lib/dotfiles/vim/compiler/ruby.vim +68 -0
- data/lib/dotfiles/vim/compiler/rubyunit.vim +35 -0
- data/lib/dotfiles/vim/doc/NERD_tree.txt +1235 -0
- data/lib/dotfiles/vim/doc/fakeclip.txt +190 -0
- data/lib/dotfiles/vim/doc/matchit.txt +406 -0
- data/lib/dotfiles/vim/doc/project.txt +710 -0
- data/lib/dotfiles/vim/doc/rails.txt +1123 -0
- data/lib/dotfiles/vim/doc/snippets_emu.txt +354 -0
- data/lib/dotfiles/vim/doc/surround.txt +218 -0
- data/lib/dotfiles/vim/doc/tags +433 -0
- data/lib/dotfiles/vim/filetype.vim +13 -0
- data/lib/dotfiles/vim/ftdetect/gist.vim +3 -0
- data/lib/dotfiles/vim/ftdetect/ruby.vim +14 -0
- data/lib/dotfiles/vim/ftplugin/eruby.vim +101 -0
- data/lib/dotfiles/vim/ftplugin/ruby.vim +230 -0
- data/lib/dotfiles/vim/indent/eruby.vim +73 -0
- data/lib/dotfiles/vim/indent/ruby.vim +373 -0
- data/lib/dotfiles/vim/plugin/NERD_tree.vim +3536 -0
- data/lib/dotfiles/vim/plugin/comments.vim +321 -0
- data/lib/dotfiles/vim/plugin/fakeclip.vim +174 -0
- data/lib/dotfiles/vim/plugin/fuzzyfinder.vim +1676 -0
- data/lib/dotfiles/vim/plugin/fuzzyfinder_textmate.vim +150 -0
- data/lib/dotfiles/vim/plugin/gist.vim +241 -0
- data/lib/dotfiles/vim/plugin/gitdiff.vim +141 -0
- data/lib/dotfiles/vim/plugin/matchit.vim +812 -0
- data/lib/dotfiles/vim/plugin/mru.vim +787 -0
- data/lib/dotfiles/vim/plugin/rails.vim +310 -0
- data/lib/dotfiles/vim/plugin/rspec.vim +12 -0
- data/lib/dotfiles/vim/plugin/snippets.vim +17 -0
- data/lib/dotfiles/vim/plugin/snippetsEmu.vim +973 -0
- data/lib/dotfiles/vim/plugin/supertab.vim +531 -0
- data/lib/dotfiles/vim/plugin/surround.vim +632 -0
- data/lib/dotfiles/vim/ref_vimrc +80 -0
- data/lib/dotfiles/vim/ruby/fuzzy_file_finder.rb +353 -0
- data/lib/dotfiles/vim/syntax/eruby.vim +85 -0
- data/lib/dotfiles/vim/syntax/haml.vim +113 -0
- data/lib/dotfiles/vim/syntax/mkd.vim +86 -0
- data/lib/dotfiles/vim/syntax/ruby.vim +324 -0
- data/lib/dotfiles/vim/syntax/sass.vim +93 -0
- data/lib/dotfiles/vimrc +269 -0
- data/lib/vixplode/cli.rb +73 -0
- data/lib/vixploder.rb +6 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/vixplode_cli_spec.rb +15 -0
- data/spec/vixploder_spec.rb +7 -0
- data/tasks/rspec.rake +21 -0
- metadata +202 -8
@@ -0,0 +1,321 @@
|
|
1
|
+
" *********************************************************************************************
|
2
|
+
" comments.vim
|
3
|
+
" *********************************************************************************************
|
4
|
+
" Description : Global Plugin to comment and un-comment different
|
5
|
+
" source files in both normal and visual <Shift-V> mode
|
6
|
+
" Last Change : 26th April, 2006
|
7
|
+
" Created By : Jasmeet Singh Anand <jasanand@hotmail.com>
|
8
|
+
" Version : 2.2
|
9
|
+
" Usage : For VIM 6 -
|
10
|
+
" Stick this file in your ~/.vim/plugin directory or
|
11
|
+
" in some other 'plugin' directory that is in your runtime path
|
12
|
+
" For VIM 5 -
|
13
|
+
" Stick this file somewhere and 'source <path>/comments.vim' it from
|
14
|
+
" your ~/.vimrc file
|
15
|
+
" Note : I have provided the following key mappings
|
16
|
+
" To comment <Ctrl-C> in both normal and visual <Shift-V> range select mode
|
17
|
+
" To un-comment <Ctrl-X> in both normal and visual <Shift-V> range select mode
|
18
|
+
" These can be changed based on user's likings or usage
|
19
|
+
" Contact : For any comments or bug fixes email me at <jasanand@hotmail.com>
|
20
|
+
" *********************************************************************************************
|
21
|
+
"Modification:
|
22
|
+
" *********************************************************************************************
|
23
|
+
" Jasmeet Anand 26th April, 2006 v2.0
|
24
|
+
" Fixed C commenting where a single line already had previous comments.
|
25
|
+
" int x=0; /*this is an x value*/
|
26
|
+
" Still working on situations like
|
27
|
+
" Issue A:
|
28
|
+
" 1 int x=0; /*this
|
29
|
+
" 2 is
|
30
|
+
" 3 an
|
31
|
+
" 4 x
|
32
|
+
" 5 value*/
|
33
|
+
" *********************************************************************************************
|
34
|
+
" Jasmeet Anand 26th April, 2006 v2.1
|
35
|
+
" Provided more granule checking for C Code but still working on Issue A
|
36
|
+
" *********************************************************************************************
|
37
|
+
" Jasmeet Anand 27th April, 2006 v2.2
|
38
|
+
" Fixed another minor C code commenting bug
|
39
|
+
" Provided for .csh, .php, .php2 and .php3 support
|
40
|
+
" Resolved Issue A with the following logic
|
41
|
+
" 1 /* int x=0; */ /*this*/
|
42
|
+
" 2 /*is*/
|
43
|
+
" 3 /*an*/
|
44
|
+
" 4 /*x*/
|
45
|
+
" 5 /*value*/
|
46
|
+
" However care should be taken when un-commenting it
|
47
|
+
" in order to retain the previous comments
|
48
|
+
" *********************************************************************************************
|
49
|
+
" Jasmeet Anand 1st May 2006 v2.3
|
50
|
+
" Provided [:blank:] to accomodate for space and tab characters
|
51
|
+
" *********************************************************************************************
|
52
|
+
" Jasmeet Anand 1st May 2006 v2.4
|
53
|
+
" Provided support for .css as advised by Willem Peter
|
54
|
+
" *********************************************************************************************
|
55
|
+
" Jasmeet Anand 2nd May 2006 v2.5
|
56
|
+
" Removed auto-indenting for .sql, .sh and normal files when un-commenting
|
57
|
+
" *********************************************************************************************
|
58
|
+
" Jasmeet Anand 5th June 2006 v2.6
|
59
|
+
" Added support for .html, .xml, .xthml, .htm, .vim, .vimrc
|
60
|
+
" files as provided by Jeff Buttars
|
61
|
+
" *********************************************************************************************
|
62
|
+
" Smolyar "Rastafarra" Denis 7th June 2007 v2.7
|
63
|
+
" Added support for .tex
|
64
|
+
" *********************************************************************************************
|
65
|
+
" Jasmeet Anand 5th June 2006 v2.8
|
66
|
+
" Added support for Fortran .f, .F, .f90, .F90, .f95, .F95
|
67
|
+
" files as provided by Albert Farres
|
68
|
+
" *********************************************************************************************
|
69
|
+
" Jasmeet Anand 8th March 2008 v2.9
|
70
|
+
" Added support for ML, Caml, OCaml .ml, mli, PHP (v.4) .php4, PHP (v.5) .php5
|
71
|
+
" files as provided by Denis Smolyar
|
72
|
+
" Added support for noweb (requires only a small enhancement to the tex type)
|
73
|
+
" as provided by Meik "fuller" Teßmer
|
74
|
+
" Added support for vhdl files provided by Trond Danielsen
|
75
|
+
" *********************************************************************************************
|
76
|
+
" Jasmeet Anand 20 th March 2008 v2.10
|
77
|
+
" Bug fixes for php files as pointed by rastafarra
|
78
|
+
" *********************************************************************************************
|
79
|
+
" Jasmeet Anand 29th November 2008 v2.11
|
80
|
+
" Added support for haskel
|
81
|
+
" files as provided by Nicolas Martyanoff
|
82
|
+
" File Format changed to UNIX
|
83
|
+
" *********************************************************************************************
|
84
|
+
"
|
85
|
+
|
86
|
+
" Exit if already loaded
|
87
|
+
if exists("loaded_comments_plugin")
|
88
|
+
finish
|
89
|
+
endif
|
90
|
+
|
91
|
+
let loaded_comments_plugin="v2.10"
|
92
|
+
|
93
|
+
" key-mappings for comment line in normal mode
|
94
|
+
noremap <silent> <C-C> :call CommentLine()<CR>
|
95
|
+
" key-mappings for range comment lines in visual <Shift-V> mode
|
96
|
+
vnoremap <silent> <C-C> :call RangeCommentLine()<CR>
|
97
|
+
|
98
|
+
" key-mappings for un-comment line in normal mode
|
99
|
+
noremap <silent> <C-X> :call UnCommentLine()<CR>
|
100
|
+
" key-mappings for range un-comment lines in visual <Shift-V> mode
|
101
|
+
vnoremap <silent> <C-X> :call RangeUnCommentLine()<CR>
|
102
|
+
|
103
|
+
" function to comment line in normal mode
|
104
|
+
function! CommentLine()
|
105
|
+
let file_name = buffer_name("%")
|
106
|
+
|
107
|
+
" for .cpp or .hpp or .java or .C files use //
|
108
|
+
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
|
109
|
+
execute ":silent! normal ^i//\<ESC>==\<down>^"
|
110
|
+
" for .c or .h or .pc or .css files use /* */
|
111
|
+
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
|
112
|
+
" if there are previous comments on this line ie /* ... */
|
113
|
+
if stridx(getline("."), "\/\*") != -1 && stridx(getline("."), "\*\/") != -1
|
114
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\([^\\/\\*]*\\)\\(\\/\\*.*\\*\\/\\)/\\1\\*\\/\\2/\<CR>:s/\\([^[:blank:]]\\+\\)/\\/\\*\\1/\<CR>:nohlsearch\<CR>=="
|
115
|
+
" if there is a /* but no */ like line 1 in Issue A above
|
116
|
+
elseif stridx(getline("."), "\/\*") != -1 && stridx(getline("."), "\*\/") == -1
|
117
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\(.*\\)\\(\\/\\*.*$\\)/\\/\\*\\1\\*\\/\\2\\*\\//\<CR>:nohlsearch\<CR>=="
|
118
|
+
" if there is a */ but no /* like line 5 in Issue A above
|
119
|
+
elseif stridx(getline("."), "\/\*") == -1 && stridx(getline("."), "\*\/") != -1
|
120
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\(.*\\*\\/\\)/\\/\\*\\1/\<CR>:nohlsearch\<CR>=="
|
121
|
+
" if there are no comments on this line
|
122
|
+
elseif stridx(getline("."), "\/\*") == -1 && stridx(getline("."), "\*\/") == -1
|
123
|
+
execute ":silent! normal ^i/*\<ESC>$a*/\<ESC>==\<down>^"
|
124
|
+
endif
|
125
|
+
"for .ml or .mli files use (* *)
|
126
|
+
elseif file_name =~ '\.ml$' || file_name =~ '\.mli$'
|
127
|
+
if stridx(getline("."), "\(\*") == -1 && stridx(getline("."), "\*)") == -1
|
128
|
+
execute ":silent! normal ^i(*\<ESC>$a*)\<ESC>==\<down>^"
|
129
|
+
endif
|
130
|
+
" .html,.xml,.xthml,.htm
|
131
|
+
elseif file_name =~ '\.html$' || file_name =~ '\.htm$' || file_name =~ '\.xml$' || file_name =~ '\.xhtml$'
|
132
|
+
if stridx( getline("."), "\<!--" ) != -1 && stridx( getline("."), "--\>" ) != -1
|
133
|
+
elseif stridx( getline("."), "\<!--" ) != -1 && stridx( getline("."), "--\>" ) == -1
|
134
|
+
" open, but a close "
|
135
|
+
execute ":silent! normal ^A--\>\<ESC>==\<down>^"
|
136
|
+
elseif stridx( getline("."), "\<!--" ) == -1 && stridx( getline("."), "--\>" ) != -1
|
137
|
+
execute ":silent! normal ^i\<\!--\<ESC>==\<down>^"
|
138
|
+
elseif stridx( getline("."), "\<!--" ) == -1 && stridx( getline("."), "--\>" ) == -1
|
139
|
+
execute ":silent! normal ^i\<\!--\<ESC>$a--\>\<ESC>==\<down>^"
|
140
|
+
endif
|
141
|
+
" for .vim files use "
|
142
|
+
elseif file_name =~ '\.vim$' || file_name =~ '\.vimrc$'
|
143
|
+
execute ":silent! normal ^i\"\<ESC>\<down>^"
|
144
|
+
" for .sql files use --
|
145
|
+
elseif file_name =~ '\.sql$'
|
146
|
+
execute ":silent! normal ^i--\<ESC>\<down>^"
|
147
|
+
" for .ksh or .sh or .csh or .pl or .pm files use #
|
148
|
+
elseif file_name =~ '\.[kc]\?sh$' || file_name =~ '\.pl$' || file_name =~ '\.pm$'
|
149
|
+
execute ":silent! normal ^i#\<ESC>\<down>^"
|
150
|
+
" for .tex files use %
|
151
|
+
elseif file_name =~ '\.tex$' || file_name =~ '\.nw$'
|
152
|
+
execute ":silent! normal ^i%\<ESC>\<down>^"
|
153
|
+
" for fortran 77 files use C on first column
|
154
|
+
elseif file_name =~ '\.f$' || file_name =~ '\.F$'
|
155
|
+
execute ":silent! normal ^gIC\<ESC>\<down>^"
|
156
|
+
" for fortran 90/95 files use !
|
157
|
+
elseif file_name =~ '\.f90$' || file_name =~ '\.F90$' || file_name =~ '\.f95$' || file_name =~ '\.F95$'
|
158
|
+
execute ":silent! normal ^i!\<ESC>\<down>^"
|
159
|
+
" for VHDL and Haskel files use --
|
160
|
+
elseif file_name =~ '\.vhd$' || file_name =~ '\.vhdl$' || file_name =~ '\.hs$'
|
161
|
+
execute ":silent! normal ^gI-- \<ESC>\<down>^"
|
162
|
+
" for all other files use #
|
163
|
+
else
|
164
|
+
execute ":silent! normal ^i#\<ESC>\<down>^"
|
165
|
+
endif
|
166
|
+
endfunction
|
167
|
+
|
168
|
+
" function to un-comment line in normal mode
|
169
|
+
function! UnCommentLine()
|
170
|
+
let file_name = buffer_name("%")
|
171
|
+
|
172
|
+
" for .cpp or .hpp or .java or .C files use //
|
173
|
+
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
|
174
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\/\\///\<CR>:nohlsearch\<CR>=="
|
175
|
+
" for .ml or .mli
|
176
|
+
elseif file_name =~ '\.ml$' || file_name =~ '\.mli$'
|
177
|
+
execute ":silent! normal :nohlsearch\<CR>:s/(\\*//\<CR>:nohlsearch\<CR>"
|
178
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\*)//\<CR>:nohlsearch\<CR>=="
|
179
|
+
" for .c or .h or .pc or .css files use /* */
|
180
|
+
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
|
181
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\/\\*//\<CR>:s/\\*\\///\<CR>:nohlsearch\<CR>=="
|
182
|
+
" for .vim files use "
|
183
|
+
elseif file_name =~ '\.vim$' || file_name =~ '\.vimrc$'
|
184
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\\"//\<CR>:nohlsearch\<CR>"
|
185
|
+
" for .sql files use --
|
186
|
+
elseif file_name =~ '\.sql$'
|
187
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\-\\-//\<CR>:nohlsearch\<CR>"
|
188
|
+
" for .ksh or .sh or .csh or .pl or .pm files use #
|
189
|
+
elseif file_name =~ '\.[kc]\?sh$' || file_name =~ '\.pl$' || file_name =~ '\.pm$'
|
190
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\#//\<CR>:nohlsearch\<CR>"
|
191
|
+
" for .xml .html .xhtml .htm use <!-- -->
|
192
|
+
elseif file_name =~ '\.html$' || file_name =~ '\.htm$' || file_name =~ '\.xml$' || file_name =~ '\.xhtml$'
|
193
|
+
execute ":silent! normal :nohlsearch\<CR>:s/<!--//\<CR>=="
|
194
|
+
execute ":silent! normal :nohlsearch\<CR>:s/-->//\<CR>=="
|
195
|
+
" for .tex use %
|
196
|
+
elseif file_name =~ '\.tex$' || file_name =~ '\.nw$'
|
197
|
+
execute ":silent! normal :nohlsearch\<CR>:s/%/\<CR>:nohlsearch\<CR>"
|
198
|
+
" for fortran 77 files use C on first column
|
199
|
+
elseif file_name =~ '\.f$' || file_name =~ '\.F$'
|
200
|
+
execute ":silent! normal ^x\<ESC>\<down>^"
|
201
|
+
" for fortran 90/95 files use !
|
202
|
+
elseif file_name =~ '\.f90$' || file_name =~ '\.F90$' || file_name =~ '\.f95$' || file_name =~ '\.F95$'
|
203
|
+
execute ":silent! normal :nohlsearch\<CR>:s/!//\<CR>:nohlsearch\<CR>"
|
204
|
+
" for VHDL and Haskel files use --
|
205
|
+
elseif file_name =~ '\.vhd$' || file_name =~ '\.vhdl$' || '\.hs$'
|
206
|
+
execute ":silent! normal :nohlsearch\<CR>:s/--//\<CR>:nohlsearch\<CR>"
|
207
|
+
" for all other files use #
|
208
|
+
else
|
209
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\#//\<CR>:nohlsearch\<CR>"
|
210
|
+
endif
|
211
|
+
endfunction
|
212
|
+
|
213
|
+
" function to range comment lines in visual mode
|
214
|
+
function! RangeCommentLine()
|
215
|
+
let file_name = buffer_name("%")
|
216
|
+
|
217
|
+
" for .cpp or .hpp or .java or .C files use //
|
218
|
+
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
|
219
|
+
execute ":silent! normal :s/\\S/\\/\\/\\0/\<CR>:nohlsearch<CR>=="
|
220
|
+
" for .c or .h or .pc or .css files use /* */
|
221
|
+
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
|
222
|
+
" if there are previous comments on this line ie /* ... */
|
223
|
+
if stridx(getline("."), "\/\*") != -1 && stridx(getline("."), "\*\/") != -1
|
224
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\([^\\/\\*]*\\)\\(\\/\\*.*\\*\\/\\)/\\1\\*\\/\\2/\<CR>:s/\\([^[:blank:]]\\+\\)/\\/\\*\\1/\<CR>:nohlsearch\<CR>=="
|
225
|
+
" if there is a /* but no */ like line 1 in Issue A above
|
226
|
+
elseif stridx(getline("."), "\/\*") != -1 && stridx(getline("."), "\*\/") == -1
|
227
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\(.*\\)\\(\\/\\*.*$\\)/\\/\\*\\1\\*\\/\\2\\*\\//\<CR>:nohlsearch\<CR>=="
|
228
|
+
" if there is a */ but no /* like line 5 in Issue A above
|
229
|
+
elseif stridx(getline("."), "\/\*") == -1 && stridx(getline("."), "\*\/") != -1
|
230
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\(.*\\*\\/\\)/\\/\\*\\1/\<CR>:nohlsearch\<CR>=="
|
231
|
+
" if there are no comments on this line
|
232
|
+
elseif stridx(getline("."), "\/\*") == -1 && stridx(getline("."), "\*\/") == -1
|
233
|
+
execute ":silent! normal :s/\\(\\S.*$\\)/\\/\\*\\1\\*\\//\<CR>:nohlsearch\<CR>=="
|
234
|
+
endif
|
235
|
+
" .html,.xml,.xthml,.htm
|
236
|
+
elseif file_name =~ '\.html$' || file_name =~ '\.htm$' || file_name =~ '\.xml$' || file_name =~ '\.xhtml$'
|
237
|
+
if stridx( getline("."), "\<!--" ) != -1 && stridx( getline("."), "--\>" ) != -1
|
238
|
+
elseif stridx( getline("."), "\<!--" ) != -1 && stridx( getline("."), "--\>" ) == -1
|
239
|
+
" open, but a close "
|
240
|
+
execute ":silent! normal ^A--\>\<ESC>==\<down>^"
|
241
|
+
elseif stridx( getline("."), "\<!--" ) == -1 && stridx( getline("."), "--\>" ) != -1
|
242
|
+
execute ":silent! normal ^i\<\!--\<ESC>==\<down>^"
|
243
|
+
elseif stridx( getline("."), "\<!--" ) == -1 && stridx( getline("."), "--\>" ) == -1
|
244
|
+
execute ":silent! normal ^i\<\!--\<ESC>$a--\>\<ESC>==\<down>^"
|
245
|
+
endif
|
246
|
+
" for .ml, .mli files use (* *)
|
247
|
+
elseif file_name =~ '\.ml$' || file_name =~ '\.mli'
|
248
|
+
if stridx(getline("."), "\(\*") == -1 && stridx(getline("."), "\*)/") == -1
|
249
|
+
execute ":silent! normal ^i\(*\<ESC>$a*)\<ESC>==\<down>^"
|
250
|
+
endif
|
251
|
+
" for .vim files use --
|
252
|
+
elseif file_name =~ '\.vim$' || file_name =~ '\.vimrc$'
|
253
|
+
execute ":silent! normal :s/\\S/\\\"\\0/\<CR>:nohlsearch<CR>"
|
254
|
+
" for .sql files use --
|
255
|
+
elseif file_name =~ '\.sql$'
|
256
|
+
execute ":silent! normal :s/\\S/\\-\\-\\0/\<CR>:nohlsearch<CR>"
|
257
|
+
" for .ksh or .sh or .csh or .pl or .pm files use #
|
258
|
+
elseif file_name =~ '\.[kc]\?sh$' || file_name =~ '\.pl$' || file_name =~ '\.pm$'
|
259
|
+
execute ":silent! normal :s/\\S/\\#\\0/\<CR>:nohlsearch<CR>"
|
260
|
+
" for .tex use %
|
261
|
+
elseif file_name =~ '\.tex$' || file_name =~ '\.nw$'
|
262
|
+
execute ":silent! normal :s/\\S/\\%\\0/\<CR>:nohlsearch<CR>"
|
263
|
+
" for fortran 77 files use C on first column
|
264
|
+
elseif file_name =~ '\.f$' || file_name =~ '\.F$'
|
265
|
+
execute ":silent! normal ^gIC\<ESC>\<down>^"
|
266
|
+
" for fortran 90/95 files use !
|
267
|
+
elseif file_name =~ '\.f90$' || file_name =~ '\.F90$' || file_name =~ '\.f95$' || file_name =~ '\.F95$'
|
268
|
+
execute ":silent! normal :s/\\S/!\\0/\<CR>:nohlsearch<CR>"
|
269
|
+
" for VHDL and Haskel files use --
|
270
|
+
elseif file_name =~ '\.vhd$' || file_name =~ '\.vhdl$' || '\.hs$'
|
271
|
+
execute ":silent! normal ^gI--\<ESC>\<down>^"
|
272
|
+
" for all other files use #
|
273
|
+
else
|
274
|
+
execute ":silent! normal :s/\\S/\\#\\0/\<CR>:nohlsearch<CR>"
|
275
|
+
endif
|
276
|
+
endfunction
|
277
|
+
|
278
|
+
" function to range un-comment lines in visual mode
|
279
|
+
function! RangeUnCommentLine()
|
280
|
+
let file_name = buffer_name("%")
|
281
|
+
|
282
|
+
" for .cpp or .hpp or .java files use //
|
283
|
+
if file_name =~ '\.cpp$' || file_name =~ '\.hpp$' || file_name =~ '\.java$' || file_name =~ '\.php[2345]\?$' || file_name =~ '\.C$'
|
284
|
+
execute ":silent! normal :s/\\/\\///\<CR>:nohlsearch\<CR>=="
|
285
|
+
" for .c or .h or .pc or .css files use /* */
|
286
|
+
elseif file_name =~ '\.c$' || file_name =~ '\.h$' || file_name =~ '\.pc$' || file_name =~ '\.css$' || file_name =~ '\.js$'
|
287
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\/\\*//\<CR>:s/\\*\\///\<CR>:nohlsearch\<CR>=="
|
288
|
+
" for .vim files use "
|
289
|
+
elseif file_name =~ '\.vim$' || file_name =~ '\.vimrc$'
|
290
|
+
execute ":silent! normal :s/\\\"//\<CR>:nohlsearch\<CR>"
|
291
|
+
" for .sql files use --
|
292
|
+
elseif file_name =~ '\.sql$'
|
293
|
+
execute ":silent! normal :s/\\-\\-//\<CR>:nohlsearch\<CR>"
|
294
|
+
" for .ml .mli
|
295
|
+
elseif file_name =~ '\.ml$' || file_name =~ '\.mli$'
|
296
|
+
execute ":silent! normal :nohlsearch\<CR>:s/(\\*//\<CR>=="
|
297
|
+
execute ":silent! normal :nohlsearch\<CR>:s/\\*)//\<CR>=="
|
298
|
+
" for .xml .html .xhtml .htm use <!-- -->
|
299
|
+
elseif file_name =~ '\.html$' || file_name =~ '\.htm$' || file_name =~ '\.xml$' || file_name =~ '\.xhtml$'
|
300
|
+
execute ":silent! normal :nohlsearch\<CR>:s/<!--//\<CR>=="
|
301
|
+
execute ":silent! normal :nohlsearch\<CR>:s/-->//\<CR>=="
|
302
|
+
elseif file_name =~ '\.[kc]\?sh$' || file_name =~ '\.pl$' || file_name =~ '\.pm$'
|
303
|
+
execute ":silent! normal :s/\\#//\<CR>:nohlsearch\<CR>"
|
304
|
+
" for .tex use %
|
305
|
+
elseif file_name =~ '\.tex$' || file_name =~ '\.nw$'
|
306
|
+
execute ":silent! normal :s/%/\<CR>:nohlsearch\<CR>"
|
307
|
+
" for fortran 77 files use C on first column
|
308
|
+
elseif file_name =~ '\.f$' || file_name =~ '\.F$'
|
309
|
+
execute ":silent! normal ^x\<ESC>\<down>^"
|
310
|
+
" for fortran 90/95 files use !
|
311
|
+
elseif file_name =~ '\.f90$' || file_name =~ '\.F90$' || file_name =~ '\.f95$' || file_name =~ '\.F95$'
|
312
|
+
execute ":silent! normal :s/!//\<CR>:nohlsearch\<CR>"
|
313
|
+
" for VHDL and Haskel files use --
|
314
|
+
elseif file_name =~ '\.vhd$' || file_name =~ '\.vhdl$' || '\.hs$'
|
315
|
+
execute ":silent! normal :s/--//\<CR>:nohlsearch\<CR>"
|
316
|
+
" for all other files use #
|
317
|
+
else
|
318
|
+
execute ":silent! normal :s/\\#//\<CR>:nohlsearch\<CR>"
|
319
|
+
endif
|
320
|
+
endfunction
|
321
|
+
|
@@ -0,0 +1,174 @@
|
|
1
|
+
" fakeclip - pseude clipboard register for non-GUI version of Vim
|
2
|
+
" Version: 0.2.1
|
3
|
+
" Copyright (C) 2007-2008 kana <http://whileimautomaton.net/>
|
4
|
+
" License: MIT license {{{
|
5
|
+
" Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
" a copy of this software and associated documentation files (the
|
7
|
+
" "Software"), to deal in the Software without restriction, including
|
8
|
+
" without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
" distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
" permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
" the following conditions:
|
12
|
+
"
|
13
|
+
" The above copyright notice and this permission notice shall be included
|
14
|
+
" in all copies or substantial portions of the Software.
|
15
|
+
"
|
16
|
+
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
17
|
+
" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
19
|
+
" IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
20
|
+
" CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
21
|
+
" TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
22
|
+
" SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
" }}}
|
24
|
+
" Prologue "{{{1
|
25
|
+
|
26
|
+
if exists('g:loaded_fakeclip') || has('clipboard')
|
27
|
+
finish
|
28
|
+
endif
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
" Key Mappings "{{{1
|
38
|
+
" Interface key mappings "{{{2
|
39
|
+
|
40
|
+
nnoremap <silent> <Plug>(fakeclip-y)
|
41
|
+
\ :<C-u>set operatorfunc=fakeclip#clipboard_yank<Return>g@
|
42
|
+
vnoremap <silent> <Plug>(fakeclip-y)
|
43
|
+
\ :<C-u>call fakeclip#yank('clipboard', visualmode())<Return>
|
44
|
+
nnoremap <silent> <Plug>(fakeclip-Y)
|
45
|
+
\ :<C-u>call fakeclip#yank_Y('clipboard')<Return>
|
46
|
+
vnoremap <silent> <Plug>(fakeclip-Y)
|
47
|
+
\ :<C-u>call fakeclip#yank('clipboard', 'V')<Return>
|
48
|
+
|
49
|
+
nnoremap <silent> <Plug>(fakeclip-p)
|
50
|
+
\ :<C-u>call fakeclip#put('clipboard', '', 'p')<Return>
|
51
|
+
nnoremap <silent> <Plug>(fakeclip-P)
|
52
|
+
\ :<C-u>call fakeclip#put('clipboard', '', 'P')<Return>
|
53
|
+
nnoremap <silent> <Plug>(fakeclip-gp)
|
54
|
+
\ :<C-u>call fakeclip#put('clipboard', '', 'gp')<Return>
|
55
|
+
nnoremap <silent> <Plug>(fakeclip-gP)
|
56
|
+
\ :<C-u>call fakeclip#put('clipboard', '', 'gP')<Return>
|
57
|
+
vnoremap <silent> <Plug>(fakeclip-p)
|
58
|
+
\ :<C-u>call fakeclip#put('clipboard', visualmode(), 'p')<Return>
|
59
|
+
vnoremap <silent> <Plug>(fakeclip-P)
|
60
|
+
\ :<C-u>call fakeclip#put('clipboard', visualmode(), 'P')<Return>
|
61
|
+
vnoremap <silent> <Plug>(fakeclip-gp)
|
62
|
+
\ :<C-u>call fakeclip#put('clipboard', visualmode(), 'gp')<Return>
|
63
|
+
vnoremap <silent> <Plug>(fakeclip-gP)
|
64
|
+
\ :<C-u>call fakeclip#put('clipboard', visualmode(), 'gP')<Return>
|
65
|
+
|
66
|
+
inoremap <Plug>(fakeclip-insert) <C-r>=fakeclip#content('clipboard')<Return>
|
67
|
+
cnoremap <Plug>(fakeclip-insert) <C-r>=fakeclip#content('clipboard')<Return>
|
68
|
+
|
69
|
+
|
70
|
+
nnoremap <silent> <Plug>(fakeclip-screen-y)
|
71
|
+
\ :<C-u>set operatorfunc=fakeclip#screen_yank<Return>g@
|
72
|
+
vnoremap <silent> <Plug>(fakeclip-screen-y)
|
73
|
+
\ :<C-u>call fakeclip#yank('screen', visualmode())<Return>
|
74
|
+
nnoremap <silent> <Plug>(fakeclip-screen-Y)
|
75
|
+
\ :<C-u>call fakeclip#yank_Y('screen')<Return>
|
76
|
+
vnoremap <silent> <Plug>(fakeclip-screen-Y)
|
77
|
+
\ :<C-u>call fakeclip#yank('screen', 'V')<Return>
|
78
|
+
|
79
|
+
nnoremap <silent> <Plug>(fakeclip-screen-p)
|
80
|
+
\ :<C-u>call fakeclip#put('screen', '', 'p')<Return>
|
81
|
+
nnoremap <silent> <Plug>(fakeclip-screen-P)
|
82
|
+
\ :<C-u>call fakeclip#put('screen', '', 'P')<Return>
|
83
|
+
nnoremap <silent> <Plug>(fakeclip-screen-gp)
|
84
|
+
\ :<C-u>call fakeclip#put('screen', '', 'gp')<Return>
|
85
|
+
nnoremap <silent> <Plug>(fakeclip-screen-gP)
|
86
|
+
\ :<C-u>call fakeclip#put('screen', '', 'gP')<Return>
|
87
|
+
vnoremap <silent> <Plug>(fakeclip-screen-p)
|
88
|
+
\ :<C-u>call fakeclip#put('screen', visualmode(), 'p')<Return>
|
89
|
+
vnoremap <silent> <Plug>(fakeclip-screen-P)
|
90
|
+
\ :<C-u>call fakeclip#put('screen', visualmode(), 'P')<Return>
|
91
|
+
vnoremap <silent> <Plug>(fakeclip-screen-gp)
|
92
|
+
\ :<C-u>call fakeclip#put('screen', visualmode(), 'gp')<Return>
|
93
|
+
vnoremap <silent> <Plug>(fakeclip-screen-gP)
|
94
|
+
\ :<C-u>call fakeclip#put('screen', visualmode(), 'gP')<Return>
|
95
|
+
|
96
|
+
inoremap <Plug>(fakeclip-screen-insert)
|
97
|
+
\ <C-r>=fakeclip#content('screen')<Return>
|
98
|
+
cnoremap <Plug>(fakeclip-screen-insert)
|
99
|
+
\ <C-r>=fakeclip#content('screen')<Return>
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
" Default key mappings "{{{2
|
105
|
+
|
106
|
+
command! -bang -bar -nargs=0 FakeclipDefaultKeyMappings
|
107
|
+
\ call s:cmd_FakeclipDefaultKeyMappings()
|
108
|
+
|
109
|
+
function! s:cmd_FakeclipDefaultKeyMappings()
|
110
|
+
" Clipboard
|
111
|
+
for _ in ['+', '*']
|
112
|
+
execute 'nmap "'._.'y <Plug>(fakeclip-y)'
|
113
|
+
execute 'nmap "'._.'Y <Plug>(fakeclip-Y)'
|
114
|
+
execute 'nmap "'._.'yy <Plug>(fakeclip-Y)'
|
115
|
+
execute 'vmap "'._.'y <Plug>(fakeclip-y)'
|
116
|
+
execute 'vmap "'._.'Y <Plug>(fakeclip-Y)'
|
117
|
+
|
118
|
+
execute 'nmap "'._.'p <Plug>(fakeclip-p)'
|
119
|
+
execute 'nmap "'._.'P <Plug>(fakeclip-P)'
|
120
|
+
execute 'nmap "'._.'gp <Plug>(fakeclip-gp)'
|
121
|
+
execute 'nmap "'._.'gP <Plug>(fakeclip-gP)'
|
122
|
+
execute 'vmap "'._.'p <Plug>(fakeclip-p)'
|
123
|
+
execute 'vmap "'._.'P <Plug>(fakeclip-P)'
|
124
|
+
execute 'vmap "'._.'gp <Plug>(fakeclip-gp)'
|
125
|
+
execute 'vmap "'._.'gP <Plug>(fakeclip-gP)'
|
126
|
+
|
127
|
+
execute 'imap <C-r>'._.' <Plug>(fakeclip-insert)'
|
128
|
+
execute 'cmap <C-r>'._.' <Plug>(fakeclip-insert)'
|
129
|
+
endfor
|
130
|
+
|
131
|
+
" GNU screen
|
132
|
+
nmap "&y <Plug>(fakeclip-screen-y)
|
133
|
+
nmap "&Y <Plug>(fakeclip-screen-Y)
|
134
|
+
nmap "&yy <Plug>(fakeclip-screen-Y)
|
135
|
+
vmap "&y <Plug>(fakeclip-screen-y)
|
136
|
+
vmap "&Y <Plug>(fakeclip-screen-Y)
|
137
|
+
|
138
|
+
nmap "&p <Plug>(fakeclip-screen-p)
|
139
|
+
nmap "&P <Plug>(fakeclip-screen-P)
|
140
|
+
nmap "&gp <Plug>(fakeclip-screen-gp)
|
141
|
+
nmap "&gP <Plug>(fakeclip-screen-gP)
|
142
|
+
vmap "&p <Plug>(fakeclip-screen-p)
|
143
|
+
vmap "&P <Plug>(fakeclip-screen-P)
|
144
|
+
vmap "&gp <Plug>(fakeclip-screen-gp)
|
145
|
+
vmap "&gP <Plug>(fakeclip-screen-gP)
|
146
|
+
|
147
|
+
imap <C-r>& <Plug>(fakeclip-screen-insert)
|
148
|
+
cmap <C-r>& <Plug>(fakeclip-screen-insert)
|
149
|
+
endfunction
|
150
|
+
|
151
|
+
if !exists('g:fakeclip_no_default_key_mappings')
|
152
|
+
FakeclipDefaultKeyMappings
|
153
|
+
endif
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
" Epilogue "{{{1
|
163
|
+
|
164
|
+
let g:loaded_fakeclip = 1
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
" __END__ "{{{1
|
174
|
+
" vim: foldmethod=marker foldlevel=0
|