Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: GVIM Editor

From: tim:johnsons-web at: 12-Mar-2002 20:11

Hello Louis:
> Thanks for the respect, but Louis is fine. I'm no Dr. of programming, but > just a struggling amateur. In this field you are the Dr. You are the pro.
Disclaimer-1: Been working in Vim for only a little over a year. That makes me a relative newbie myself. Disclaimer-2: Use vim mostly on Linux.
> I'm confused about insert mode. If I type i to enter insert mode, then > type "+p it just types in those three characters, as I would assume it > should. What am I missing here?
You should be doing that in 'normal' mode. If you have type 'i' to go into insert mode, then (given proper setup), Ctrl-V should work with the default windows configuration, I think. (I use Ctrl_insert on both platforms) Hint: at command line, type :h p and you will be lots of docs on 'p' Hint: You might want to look at evim, which is a way of starting vim in modeless editing style. But I don't use it. Try :h evim for help on that.
> Also, could the vimrc file be causing my paste problem? If so, what do I > look for to correct it?
In windows, I believe you want to look for _vimrc in "topmost" folder of your installation. Also, you can use the :mapc command to clear all mappings for normal mode and :imapc to clear all mappings in insert mode.
> Yes, this increased productivity is what I'm hoping for.
To advocate for Chris here, I believe that emacs is an easier start than vim. Now I've got a thought - perhaps it would be worthwhile for vim users on this list to exchange resources. AND it might be worthwhile for emacs users on this list to exchange resources too. Sterling uses Emacs and has written some articles for the webzine that I and friends publish...... I believe a tremendous rebol IDE could be "constructed" from either vim or emacs. AND frankly most IDEs don't accomodate multiple languages in the same session. (Like try loading a perl file into C++ Builder, aargh!)
> May I please get a copy?
I am attaching filetype.vim and rebol.vim. I would suggest backing up the originals...
> Except for the paste problem, there is only one thing about vim I have > found so far that I don't like: when long lines are wrapped vim skips the > wrapped part of the line completely when pressing j or k, and goes to the > next line. Is it possible to change this?
:set nowrap
> Thanks, > Louis
You're welcome. -- Tim Johnson <[tim--johnsons-web--com]> http://www.alaska-internet-solutions.com http://www.johnsons-web.com -- Attached file included as plaintext by Listar -- Vim support file to detect file types Maintainer: Bram Moolenaar <[Bram--vim--org]> Last change: 2001 Sep 21 Listen very carefully, I will say this only once if exists( did_load_filetypes") finish endif let did_load_filetypes = 1 Line continuation is used here, remove 'C' from 'cpoptions' let s:cpo_save = &cpo set cpo&vim augroup filetypedetect Ignored extensions au BufNewFile,BufRead *.orig,*.bak,*.old,*.new,*.rpmsave,*.rpmnew \ exe "doau filetypedetect BufRead " . expand("<afile>:r") au BufNewFile,BufRead *~ \ let s:name = expand("<afile>") | \ let s:short = substitute(s:name, '\~$', '', '') | \ if s:name != s:short && s:short != "" | \ exe "doau filetypedetect BufRead " . s:short | \ endif | \ unlet s:name | \ unlet s:short au BufNewFile,BufRead *.in \ if expand("<afile>:t") != "configure.in" | \ exe "doau filetypedetect BufRead " . expand("<afile>:r") | \ endif Abaqus or Trasys au BufNewFile,BufRead *.inp call FTCheck_inp() fun! FTCheck_inp() if getline(1) =~ '^\*' setf abaqus else let n = 1 if line( $") > 500 let nmax = 500 else let nmax = line("$") endif while n <= nmax if getline(n) =~? "^header surface data" setf trasys break endif let n = n + 1 endwhile endif endfun ABC music notation au BufNewFile,BufRead *.abc setf abc ABEL au BufNewFile,BufRead *.abl setf abel ABEL au BufNewFile,BufRead *.abl setf abel AceDB au BufNewFile,BufRead *.wrm setf acedb Ada (83, 9X, 95) au BufNewFile,BufRead *.adb,*.ads setf ada AHDL au BufNewFile,BufRead *.tdf setf ahdl Apache style config file au BufNewFile,BufRead proftpd.conf* setf apachestyle Apache config file au BufNewFile,BufRead httpd.conf*,srm.conf*,access.conf*,.htaccess,apache.conf* setf apache Applix ELF au BufNewFile,BufRead *.am \ if expand( <afile>") !~? 'Makefile.am\>' | setf elf | endif Arc Macro Language au BufNewFile,BufRead *.aml setf aml ASN.1 au BufNewFile,BufRead *.asn,*.asn1 setf asn Active Server Pages (with Visual Basic Script) au BufNewFile,BufRead *.asa \ if exists( g:filetype_asa") | \ exe "setf " . g:filetype_asa | \ else | \ setf aspvbs | \ endif Active Server Pages (with Perl or Visual Basic Script) au BufNewFile,BufRead *.asp \ if exists( g:filetype_asp") | \ exe "setf " . g:filetype_asp | \ elseif getline(1) . getline(2) . getline(3) =~? "perlscript" | \ setf aspperl | \ else | \ setf aspvbs | \ endif Assembly (all kinds) *.lst is not pure assembly, it has two extra columns (address, byte codes) au BufNewFile,BufRead *.asm,*.[sS],*.[aA],*.mac,*.lst call <SID>FTasm() This function checks for the kind of assembly that is wanted by the user, or can be detected from the first five lines of the file. fun! <SID>FTasm() " make sure b:asmsyntax exists if !exists("b:asmsyntax") let b:asmsyntax = "" endif if b:asmsyntax == "" call FTCheck_asmsyntax() endif " if b:asmsyntax still isn't set, default to asmsyntax or GNU if b:asmsyntax == "" if exists("g:asmsyntax") let b:asmsyntax = g:asmsyntax else let b:asmsyntax = "asm" endif endif exe "setf " . b:asmsyntax endfun fun! FTCheck_asmsyntax() " see if file contains any asmsyntax=foo overrides. If so, change " b:asmsyntax appropriately let head = " ".getline(1)." ".getline(2)." ".getline(3)." ".getline(4). \" ".getline(5)." " if head =~ '\sasmsyntax=\S\+\s' let b:asmsyntax = substitute(head, '.*\sasmsyntax=\(\S\+\)\s.*','\1', "") endif endfun Atlas au BufNewFile,BufRead *.atl,*.as setf atlas Automake au BufNewFile,BufRead [mM]akefile.am setf automake Avenue au BufNewFile,BufRead *.ave setf ave Awk au BufNewFile,BufRead *.awk setf awk B au BufNewFile,BufRead *.mch,*.ref,*.imp setf b BASIC or Visual Basic au BufNewFile,BufRead *.bas call <SID>FTVB("basic") Check if one of the first five lines contains VB_Name". In that case it is probably a Visual Basic file. Otherwise it's assumed to be alt" filetype. fun! <SID>FTVB(alt) if getline(1).getline(2).getline(3).getline(4).getline(5) =~? 'VB_Name' setf vb else exe "setf " . a:alt endif endfun Visual Basic Script (close to Visual Basic) au BufNewFile,BufRead *.vbs,*.dsm setf vb Batch file for MSDOS (*.cmd is close enough) au BufNewFile,BufRead *.bat,*.cmd,*.sys setf dosbatch Batch file for 4DOS au BufNewFile,BufRead *.btm setf btm BC calculator au BufNewFile,BufRead *.bc setf bc BDF font au BufNewFile,BufRead *.bdf setf bdf BibTeX bibliography database file au BufNewFile,BufRead *.bib setf bib BIND configuration au BufNewFile,BufRead named.conf setf named BIND zone au BufNewFile,BufRead named.root setf bindzone Blank au BufNewFile,BufRead *.bl setf blank C au BufNewFile,BufRead *.c setf c C# au BufNewFile,BufRead *.cs setf cs Cyn++ au BufNewFile,BufRead *.cyn setf cynpp Cynlib .cc and .cpp files can be C++ or Cynlib. au BufNewFile,BufRead *.cc \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cpp|endif au BufNewFile,BufRead *.cpp \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cpp|endif C++ if has( fname_case") au BufNewFile,BufRead *.cxx,*.c++,*.C,*.H,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp else au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.moc,*.tcc,*.inl setf cpp endif .h files can be C or C++, set c_syntax_for_h if you want C au BufNewFile,BufRead *.h \ if exists( c_syntax_for_h") | setf c | else | setf cpp | endif Cascading Style Sheets au BufNewFile,BufRead *.css setf css Century Term Command Scripts (*.cmd too) au BufNewFile,BufRead *.con setf cterm Changelog au BufNewFile,BufRead changelog.Debian,changelog.dch setf debchangelog au BufNewFile,BufRead [cC]hange[lL]og if getline(1) =~ '; urgency=' \| setf debchangelog | else | setf changelog | endif CHILL au BufNewFile,BufRead *..ch setf ch Changes for WEB and CWEB or CHILL au BufNewFile,BufRead *.ch call <SID>FTchange() This function checks if one of the first ten lines start with a ['--']. In that case it is probably a change file, otherwise CHILL is assumed. fun! <SID>FTchange() let lnum = 1 while lnum <= 10 if getline(lnum)[0] == ['--'] setf change return endif let lnum = lnum + 1 endwhile setf ch endfun Clean au BufNewFile,BufRead *.dcl,*.icl setf clean Clever au BufNewFile,BufRead *.eni setf cl Clever or dtd au BufNewFile,BufRead *.ent call <SID>FTent() fun! <SID>FTent() " This function checks for valid cl syntax in the first five lines. " Look for either an opening comment, '#', or a block start, '{". " If not found, assume SGML. let lnum = 1 while lnum < 6 let line = getline(lnum) if line =~ '^\s*[#{]' setf cl return elseif line !~ '^\s*$' " Not a blank line, not a comment, and not a block start, " so doesn't look like valid cl code. break endif let lnum = lnum + 1 endw setf dtd endfun Clipper (or FoxPro) au BufNewFile,BufRead *.prg \ if exists( g:filetype_prg") | \ exe "setf " . g:filetype_prg | \ else | \ setf clipper | \ endif Cobol au BufNewFile,BufRead *.cbl,*.cob,*.cpy,*.lib setf cobol Cold Fusion au BufNewFile,BufRead *.cfm,*.cfi setf cf Configure scripts au BufNewFile,BufRead configure.in,configure.ac setf config Enlightenment configuration files au BufNewFile,BufRead *enlightenment/*.cfg setf c Eterm au BufNewFile,BufRead *Eterm/*.cfg setf eterm Lynx config files au BufNewFile,BufRead lynx.cfg setf lynx Configure files au BufNewFile,BufRead *.cfg setf cfg Communicating Sequential Processes au BufNewFile,BufRead *.csp,*.fdr setf csp CUPL logic description and simulation au BufNewFile,BufRead *.pld setf cupl au BufNewFile,BufRead *.si setf cuplsim Debian Control au BufNewFile,BufRead */debian/control setf debcontrol Diff files au BufNewFile,BufRead *.diff,*.rej setf diff Diva (with Skill) or InstallShield au BufNewFile,BufRead *.rul \ if getline(1).getline(2).getline(3).getline(4).getline(5).getline(6) =~? 'InstallShield' | \ setf ishd | \ else | \ setf diva | \ endif DCL (Digital Command Language - vms) or DNS zone file au BufNewFile,BufRead *.com \ if getline(1) =~ '\($ORIGIN\|$TTL\|IN\s*SOA\)' \ || getline(2) =~ '\($ORIGIN\|$TTL\|IN\s*SOA\)' \ || getline(1).getline(2).getline(3).getline(4) =~ 'BIND.*named' \ | setf dns | else | setf dcl | endif DOT au BufNewFile,BufRead *.dot setf dot Dylan - lid files au BufNewFile,BufRead *.lid setf dylanlid Dylan - intr files (melange) au BufNewFile,BufRead *.intr setf dylanintr Dylan au BufNewFile,BufRead *.dylan setf dylan Microsoft Module Definition au BufNewFile,BufRead *.def setf def Dracula au BufNewFile,BufRead *.drac,*.drc,*lvs,*lpe setf dracula dsl au BufNewFile,BufRead *.dsl setf dsl DTD (Document Type Definition for XML) au BufNewFile,BufRead *.dtd setf dtd Embedix Component Description au BufNewFile,BufRead *.ecd setf ecd Eiffel or Specman au BufNewFile,BufRead *.e,*.E call FTCheck_e() fun! FTCheck_e() let n = 1 while n < 100 && n < line( $") if getline(n) =~ "^\\s*\\(<'\\|'>\\)\\s*$" set ft=specman return endif let n = n + 1 endwhile setf eiffel endfun ERicsson LANGuage au BufNewFile,BufRead *.erl setf erlang Elm Filter Rules file au BufNewFile,BufRead filter-rules setf elmfilt ESQL-C au BufNewFile,BufRead *.ec,*.EC setf esqlc Essbase script au BufNewFile,BufRead *.csc setf csc Expect au BufNewFile,BufRead *.exp setf expect Exports au BufNewFile,BufRead exports setf exports Focus Executable au BufNewFile,BufRead *.fex,*.focexec setf focexec Focus Master file au BufNewFile,BufRead *.mas,*.master setf master Forth au BufNewFile,BufRead *.fs,*.ft setf forth Fortran au BufNewFile,BufRead *.f,*.F,*.for,*.fpp,*.ftn,*.f77,*.f90,*.f95 setf fortran GDB command files au BufNewFile,BufRead .gdbinit setf gdb GDMO au BufNewFile,BufRead *.mo,*.gdmo setf gdmo Gedcom au BufNewFile,BufRead *.ged setf gedcom GP scripts (2.0 and onward) au BufNewFile,BufRead *.gp setf gp Gnuplot scripts au BufNewFile,BufRead *.gpi setf gnuplot GNU Server Pages au BufNewFile,BufRead *.gsp setf gsp GTK RC au BufNewFile,BufRead .gtkrc,gtkrc setf gtkrc Haskell au BufNewFile,BufRead *.hs setf haskell au BufNewFile,BufRead *.lhs setf lhaskell Hercules au BufNewFile,BufRead *.vc,*.ev,*.rs,*.sum,*.errsum setf hercules HEX (Intel) au BufNewFile,BufRead *.hex,*.h32 setf hex HTML (.shtml for server side) au BufNewFile,BufRead *.html,*.htm,*.shtml setf html HTML with M4 au BufNewFile,BufRead *.html.m4 setf htmlm4 Hyper Builder au BufNewFile,BufRead *.hb setf hb Icon au BufNewFile,BufRead *.icn setf icon IDL (Interface Description Language) au BufNewFile,BufRead *.idl setf idl Inform au BufNewFile,BufRead .indent.pro setf indent IDL (Interactive Data Language) au BufNewFile,BufRead *.pro setf idlang Inform au BufNewFile,BufRead *.inf,*.INF setf inform Informix 4GL (source - canonical, include file, I4GL+M4 preproc.) au BufNewFile,BufRead *.4gl,*.4gh,*.m4gl setf fgl .INI file for MSDOS au BufNewFile,BufRead *.ini setf dosini SysV Inittab au BufNewFile,BufRead inittab setf inittab Inno Setup au BufNewFile,BufRead *.iss setf iss Jam au BufNewFile,BufRead *.jpl,*.jpr setf jam Java au BufNewFile,BufRead *.java,*.jav setf java JavaCC au BufNewFile,BufRead *.jj,*.jjt setf javacc JavaScript au BufNewFile,BufRead *.js,*.javascript setf javascript Java Server Pages au BufNewFile,BufRead *.jsp setf jsp Java Properties resource file (note: doesn't catch font.properties.pl) au BufNewFile,BufRead *.properties,*.properties_??,*.properties_??_??,*.properties_??_??_* setf jproperties Jess au BufNewFile,BufRead *.clp setf jess Jgraph au BufNewFile,BufRead *.jgr setf jgraph Kixtart au BufNewFile,BufRead *.kix setf kix Kimwitu[++] au BufNewFile,BufRead *.k setf kwt KDE script au BufNewFile,BufRead *.ks setf kscript Lace (ISE) au BufNewFile,BufRead *.ace,*.ACE setf lace Latte au BufNewFile,BufRead *.latte,*.lte setf latte LambdaProlog (*.mod too, see Modsim) au BufNewFile,BufRead *.sig setf lprolog Lex au BufNewFile,BufRead *.lex,*.l setf lex LFTP au BufNewFile,BufRead lftp.conf,.lftprc,*lftp/rc setf lftp Lilo: Linux loader au BufNewFile,BufRead lilo.conf* setf lilo Lisp (*.el = ELisp, *.cl = Common Lisp, *.jl = librep Lisp) if has("fname_case") au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,*.L,.emacs setf lisp else au BufNewFile,BufRead *.lsp,*.lisp,*.el,*.cl,*.jl,.emacs setf lisp endif Lite au BufNewFile,BufRead *.lite,*.lt setf lite LOTOS au BufNewFile,BufRead *.lot,*.lotos setf lotos Lout (also: *.lt) au BufNewFile,BufRead *.lou,*.lout setf lout Lua au BufNewFile,BufRead *.lua setf lua Lynx style file au BufNewFile,BufRead *.lss setf lss M4 au BufNewFile,BufRead *.m4 \ if expand("<afile>") !~? 'html.m4$' | setf m4 | endif MaGic Point au BufNewFile,BufRead *.mgp setf mgp Mail (for Elm, trn, mutt, rn, slrn) au BufNewFile,BufRead snd.\d\+,.letter,.letter.\d\+,.followup,.article,.article.\d\+,pico.\d\+,mutt-*-\d\+,mutt\w\{6\},ae\d\+.txt,/tmp/SLRN[0-9A-Z.]\+,*.eml setf mail Makefile au BufNewFile,BufRead [mM]akefile,GNUmakefile,*.mk,*.mak,*.dsp setf make MakeIndex au BufNewFile,BufRead *.ist,*.mst setf ist Manpage au BufNewFile,BufRead *.man setf man Maple V au BufNewFile,BufRead *