kent logo

CO538 Anonymous Questions and Answers Keyword Index

This page provides a keyword index to questions and answers. Clicking on a keyword will take you to a page containing all questions and answers for that keyword, grouped by year.

To submit a question, use the anonymous questions page. You may find the keyword index and/or top-level index useful for locating past questions and answers.

Keyword reference for vim


Question 84 (2004):

vim question: how does one indent multiple lines at once ?

Answer 84:

From command mode, use "shift + V" to start `visual line'. Move the cursor to the end of the block you want to indent, then "shift + >" to indent. You can repeat the indent with "." (as you can repeat any other command).

If you're using the Kent Vim extensions and GVim:

Select relevant lines. Indent with "tab" or "alt + right-arrow". Outdent with "shift + tab" or "alt + left". This also works for the current line (without having selected it). Exception: in insert mode "tab" inserts a "tab" (as expected). In normal mode or if text is selected, "tab" indents. The other shortcuts work in any case.

Keywords: vim , gvim

Question 69 (2004):

I am having trouble installing the vim extensions on my linux machine at home. My version does not highlight keywords or auto-indent etc. :( Do I just copy the vim-extensions folder into my vim directory as suggested on the vim website, or are there other things I need to do ? (the info on their website is very brief). I wasn't sure if vim would automatically detect and use the new folder/extensions.

Answer 69:

The kent vim extensions by default will replace your "~/.vimrc" file. This is where Vim looks for things when it starts up. You don't actually need the kent Vim extensions, however, since occam syntax highlighting is now included in the Vim distribution (as shipped for Linux distributions). You do need to turn syntax highlighting on, however (and this is generally a good idea for any editing in Vim, assuming you have a colour-capable terminal). My own "~/.vimrc" file contains, amongst other things:

    syntax enable
    set foldmethod=marker
    map <F2> zc
    map <S-F2> zC
    map <F3> zo
    map <S-F3> zO
    map <F4> zM
    map <F5> zR

The first command turns on syntax highlighting. The second tells Vim to use folding, based on the "marker" method (the fold markers are, by default, "{{{" and "}}}"). The remaining commands map my mostly unused function-keys to fold-operations. E.g. F2 and F3 close and open folds respectively. F4 and F5 open all and close all folds respectively.

The "~/.vimrc" file that the kent-vim-extensions should install is on raptor in "/usr/local/courses/co516/kent-vim-ext/-kent-vim-ext-vimrc". If you look at this file you'll see it sets up some things before loading other .vim initialisation files.

Keywords: linux , vim


Question 14 (2003):

I've just followed the instructions for setting up Vim (v6.2) at home. As far as I know, I have done everything properly yet when I try compiling an occam file I get this error message:

    'kroc' is not recognized as an internal or external command, operable program or batch file

Do you know what the problem could be??


(ps... I'm using MS Windoze XP if that helps)

Answer 14:

The KRoC occam system isn't available for windows. The kroc command (which you're seeing an error about), is the bit that compiles and links occam programs. We've tried a couple of times to make a version of KRoC for win32 (cygwin in particular), but there are still some outstanding problems. Added to which, UNIX is a much more suitable environment for programming.

You'll either have to use the KRoC installed on raptor, or find a Linux machine at home and install KRoC/Linux. To compile occam programs from a command-line on raptor, simply type:

    kroc file.occ

(replacing `file.occ' with the occam source file you want to compile). On KRoC/Linux, you need to explicitly add ``-lcourse'' if your occam program `#USE's' course.lib.:

    kroc file.occ -lcourse

It should even be possible (in theory) to create a setup where vim uploads the file to raptor, compiles it, then sends back the results. This would probably be tricky, however -- you'd need to get friendly with vim scripting and ssh/scp.

Keywords: vim , compiling , windows


Question 16 (2002):

I have a problem with the folding in GVIM. Before this, I could open and close a folder containing a section of code for a PROC or a whole section of comments based on the curly bracket notation --{{{ and --}}} you provide in your .occ files. Once the block of code is closed, it displays a line of text highlighted in blue with a '+' sign on the left with the code indented and encapsulated under this folder and it also has fold column on the far left.

But now my GVIM program running under Exceed seems to have been saved under different settings and is incapable of displaying this anymore where it was OK before, and now it just displays plain text. I find it much easier if I have the folding capabilities as it is much easier to hide lines of comments and PROC bodies - particularly for occam when there are large amounts of code.

How can I change back to the original settings before and is always displayed every time you open any .occ file without having to add folders manually??

Answer 16:

This problem is caused because /usr/local/work was renamed to /usr/local/courses on raptor. /usr/local/work doesn't exist any longer, i.e. some students' Vim resource files now point to the wrong (non-existing) directory, that's why the folding scripts are not loaded. To solve this, try to run the vim script again. Run:


and chose option 1 ("Replace old files").

Keywords: vim , gvim , folding

Referrers: Question 23 (2002)

Valid CSS!

Valid XHTML 1.0!

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.
Last modified Mon May 20 13:50:34 2013
This document is maintained by Fred Barnes, to whom any comments and corrections should be addressed.