Upcase every keyword while editing

2006-11-16 Thread Thomas Michael Engelke

Hello!

I am looking for a way to mimic a functionality I've seen in the
editor ED4Win (http://www.softasitgets.com/). What I want to do is to
automagically upcase every written word that is considered a keyword.
I program in Progress 4GL and use the syntax file from the gvim
standard distribution.

Theoretically, in my understanding of the problem, I would need to
write a function to check the word before the cursor against the
keywords list and map this one to something. Usually, I leave the
boundaries of a keyword by using either space, tab, :, ,, enter or
.. So I would have to map this function to every of those keys in
insert mode.

This is not very elegant, but it would work. I'm not very good in
(g)vim scripting and would like to have some help in writing this
function or a pointer on where I could find a plugin performing this
feat.

Thank you for your time,

Thomas Engelke

gvim.exe --version says:

VIM - Vi IMproved 7.0 (2006 May 7, compiled May  7 2006 16:23:43)
MS-Windows 32 Bit GUI Version mit OLE-Unterstützung
Übersetzt von [EMAIL PROTECTED]
Große Version mit GUI. Ein- (+) oder ausschließlich (-) der Eigenschaften:
+arabic +autocmd +balloon_eval +browse ++builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+cryptv +cscope +cursorshape +dialog_con_gui +diff +digraphs -dnd -ebcdic
+emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path
+folding -footer +gettext/dyn -hangul_input +iconv/dyn +insert_expand +jumplist
+keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu
+mksession +modify_fname +mouse +mouseshape +multi_byte_ime/dyn +multi_lang
-mzscheme +netbeans_intg +ole -osfiletype +path_extra +perl/dyn -postscript
+printer -profile +python/dyn +quickfix +reltime +rightleft +ruby/dyn
+scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax
+tag_binary +tag_old_static -tag_any_white +tcl/dyn -tgetent -termresponse
+textobjects +title +toolbar +user_commands +vertsplit +virtualedit +visual
+visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup
-xfontset -xim -xterm_save +xpm_w32

System-vimrc-Datei: $VIM\vimrc
Benutzer-vimrc-Datei: $HOME\_vimrc
zweite Benutzer-vimrc-Datei: $VIM\_vimrc
Benutzer-exrc-Datei: $HOME\_exrc
zweite Benutzer-exrc-Datei: $VIM\_exrc
System-gvimrc-Datei: $VIM\gvimrc
Benutzer-gvimrc-Datei: $HOME\_gvimrc
zweite Benutzer-gvimrc-Datei: $VIM\_gvimrc
System-Menü-Datei: $VIMRUNTIME\menu.vim
Übersetzt: cl -c /W3 /nologo  -D_MT -MT -I. -Iproto -DHAVE_PATHDEF
-DWIN32   -DFEAT_CSCOPE
-DFEAT_NETBEANS_INTG   -DFEAT_XPM_W32   -DWINVER=0x0400
-D_WIN32_WINNT=0x0400  /Fo.\ObjGOLYTR/ /Ox
-DNDEBUG  -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME -DFEAT_GUI_W32
-DDYNAMIC_ICONV
-DDYNAMIC_GETTEXT -DFEAT_TCL -DDYNAMIC_TCL
-DDYNAMIC_TCL_DLL=\tcl83.dll\ -DDYNAMIC_TCL_VER=\8.3\
-DFEAT_PYTHON -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\python24.dll\
-DFEAT_PERL -DDYNAMIC_PERL
-DDYNAMIC_PERL_DLL=\perl58.dll\ -DFEAT_RUBY -DDYNAMIC_RUBY
-DDYNAMIC_RUBY_VER=18
-DDYNAMIC_RUBY_DLL=\msvcrt-ruby18.dll\ -DFEAT_BIG /Zi /Fd.\ObjGOLYTR/
Linken: link /RELEASE /nologo /subsystem:windows /incremental:no
/nodefaultlib:libc advapi32.lib shell32.lib gdi32.lib
comdlg32.lib ole32.lib uuid.lib oldnames.lib kernel32.lib gdi32.lib
version.lib   winspool.lib comctl32.lib advapi32.lib shell32.lib
/machine:i386 /nodefaultlib libcmt.lib oleaut32.lib  user32.lib
/nodefaultlib:python24.lib   e:\tcl\lib\tclstub83.lib WSock32.lib
e:\xpm\lib\libXpm.lib /PDB:.\ObjGOLYTR/gvim.pdb -debug

--
GPG-Key: tengelke.de/thomas_michael_engelke.asc


RE: Upcase every keyword while editing

2006-11-16 Thread David Fishburn
 

 -Original Message-
 From: Thomas Michael Engelke [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, November 16, 2006 10:42 AM
 To: vim-Mailingliste
 Subject: Upcase every keyword while editing
 
 Hello!
 
 I am looking for a way to mimic a functionality I've seen in 
 the editor ED4Win (http://www.softasitgets.com/). What I want 
 to do is to automagically upcase every written word that is 
 considered a keyword.
 I program in Progress 4GL and use the syntax file from the 
 gvim standard distribution.
 
 Theoretically, in my understanding of the problem, I would 
 need to write a function to check the word before the cursor 
 against the keywords list and map this one to something. 
 Usually, I leave the boundaries of a keyword by using either 
 space, tab, :, ,, enter or .. So I would have to map 
 this function to every of those keys in insert mode.

That is exactly why I wrote:
 SrchRplcHiGrp - Search and replace based on a syntax highlight group
 http://www.vim.org/script.php?script_id=848

Put your cursor on the word highlighted the colour that you want uppercased.
:SRChooseHiGrp
Or
:SRChooseHiGrp!

Visually select the range you want (or ggVG for whole file):
:','SRHiGrp 

The defaults selected will uppercase the words.

I wrote it mainly since I work with SQL and like the keywords uppercased.
But you can do anything with Vim's regex to the matches.

HTH,
Dave