Re: button t useless?

2007-04-25 Thread Karl Guertin

On 4/25/07, alebo [EMAIL PROTECTED] wrote:

Whats the reason vim has the function t
which does the same as f, only moving to the character
before? It seems useless to me; you can use f insted
of t always, or...?


I was using t (specifically ct) for years before I discovered f and
still tend to use it more often.


Re: bracket completion

2007-04-04 Thread Karl Guertin

On 4/4/07, Waters, Bill [EMAIL PROTECTED] wrote:

Can someone provide an example of how to enable this for a certain
language?  I assume that it is a condition around the remap in your
vimrc??


The easiest way to do language-specific customizations is to create
language.vim in your ~/.vim/after/ftplugin/ directory. This file is
sourced after everything else so the settings in this file override
previously set values.

e.g.

cat 'set expandtab'  ~/.vim/after/ftplugin/python.vim

ensures that spaces are inserted in your python files rather than tabs.


Re: bracket completion

2007-04-03 Thread Karl Guertin

On 3/31/07, Greg Fitzgerald [EMAIL PROTECTED] wrote:

Anyone know of a way to achieve bracket completion?


I've been sitting on a plugin that does this for a month or so. The
main difference between my plugin and the rest of the options here is
that I do the completion without breaking history or repeat.

Freshly uploaded to vim.org:

http://www.vim.org/scripts/script.php?script_id=1849

This plugin was pared down from a larger script that included a set of
less reusable mappings, so let me know if there's a problem.


Re: bracket completion

2007-04-03 Thread Karl Guertin

On 4/3/07, Silent1 [EMAIL PROTECTED] wrote:

where | is the cursor position. Is there any option to change this or
am i doing something wrong?


Sorry, no. I'll probably add support for {{ doing that, which was the
plan, but I never got around to it. Maybe this afternoon.


Re: bracket completion

2007-04-03 Thread Karl Guertin

On 4/3/07, Panos Laganakos [EMAIL PROTECTED] wrote:

Although, I'd prefer if I could use tab to move outside, instead of
the corresponding closing bracket char.


This should be fairly simple to add. I won't map it, but I'll set up a
Plug for you.

On 4/3/07, Jonas Persson [EMAIL PROTECTED] wrote:

Is it possible to have the {} pair inserted without disturbing the folds?


I use marker based folds and the script doesn't disturb them. If
you're doing syntax folding, I can imagine that the folding might get
confused, as there's a fair bit of sleight of hand going on. I'll try
to fix it, but I'm not sure that I can.

On 4/3/07, Greg Fitzgerald [EMAIL PROTECTED] wrote:

I do have a issue using it though. Every
time i load vim with your script i can no longer use directional keys
when in insert mode. This meaning up,down,left,right or h,j,k,l. Anytime
i try to use these keys vim starts printing capital letters when i hit
the keys instead of moving around. I have to leave insert mode to move
around then go back into insert mode to type again. Any ideas about
that?


I can't reproduce this under vim 7.0.122 (debian), gVim 7.0 windows,
on gVim 7.0.203 windows. Any ideas?


Re: How to display a omni-comletion menu from a vim script function?

2007-03-15 Thread Karl Guertin

On 3/15/07, Thomas [EMAIL PROTECTED] wrote:

Does somebody have an idea of how to display the menu?


I've been meaning to get around to doing this myself but haven't done
it. There's an example under :help complete-functions


Re: How to display a omni-comletion menu from a vim script function?

2007-03-15 Thread Karl Guertin

On 3/15/07, Thomas [EMAIL PROTECTED] wrote:

Does somebody have an idea of how to display the menu?


I've been meaning to get around to doing this myself but haven't done
it. There's an example under :help complete-functions


Re: Best way to repeat a sequence of keystrokes/commands with a single keypress ?

2007-03-13 Thread Karl Guertin

I flip between ex commands and macros for semi-automated file
conversion and most of what I'd say has been covered, but I'll toss in
a personal quirk from my .vimrc.

By default, both ` and ' do approximately the same thing in that they
jump to a mark (' is a linewise `, it positions the cursor at ^ in the
destination line). Since I don't find ' to be particularly useful, I
remap it to @a and record my macros to a (qa...q):

 executes the macro in register a
 nnoremap ' @a

 repeats the macro in register a for the entire visual selection
 xnoremap ' :normal @aCR

I find this to be convenient and it provided an easy way to
record/execute macros when I was learning vim.


Inserting text on the right side of the cursor and the repeat command

2007-03-02 Thread Karl Guertin

I was recently playing around with Tim Pope's surround.vim and noticed
that it suffers the same problem that my unreleased AutoClose.vim.

Namely, the plugin provides an i_ctrl-gs mapping which inserts an
opening string and a closing string, placing the cursor between the
two. For example, typing c-gs'foo results in 'foo|' appearing in the
doucment (with the | being the cursor). My plugin behaves similarly,
typing 'foo gets you 'foo|' and typing ' gets you 'foo'|.

This is fine, this is good, but when you try to repeat the insertion
(.) after a surround.vim c-gs you don't get 'foo' like you expect,
but rather some odd behavior related to how he implemented his insert
function. My problem manifests itself differently -- I'd get ''foo on
a repeat -- but the cause is the same.

I'm not aware of any plugins that insert text on the right side of the
cursor without breaking repeat. I've avoided releasing AutoClose
because of this*. Is such a thing possible?

* Well, this and the issue of how to insert single openers/closers
without having to toggle the plugin or use ^v.


Re: vim 7 python completion

2006-12-12 Thread Karl Guertin

On 12/12/06, Andrea Spadaccini [EMAIL PROTECTED] wrote:

Hello everybody,
I can't get the python omni-completion to work, can anybody help me?

Are there any special steps to make it work? Can you point me to a
tutorial?


To cover the basics, is your vim compiled with +python?

vim --version | grep +python


Re: Useful Tools to Assist Editing (Not just VIM)

2006-12-01 Thread Karl Guertin

I'm surprised nobody's mentioned AutoHotkey, the swiss army knife of
windows utilities.

http://www.autohotkey.com/


Re: VIM 7.0 under Windows and Unicode fonts

2006-10-28 Thread Karl Guertin

On 10/28/06, Alexander C. Gaber [EMAIL PROTECTED] wrote:

If you can suggest the most complete Unicode font (the used languages, I don't 
care about math symbols, but definitely care about *all* used languages today). 
I seriously switch through all languages in a week's worth and definitely three 
character sets a day, I'd hate having to change fonts based on what I need to 
edit right then.

Or, if I can use Windows fonts, please let me know how.


I hit that page on ubuntu linux using bitstream vera [1] and the
coverage is decent.

It's missing Old Irish, Gothic, Burmese, Mongolian, Tibetan and has a
few characters missing from Braille,  Turkish (Ottoman), Urdu, Pashto,
Vietnamese (nôm). The rest have glyphs but I have no clue whether
they're correct or not.

[1] http://packages.ubuntulinux.org/edgy/x11/ttf-bitstream-vera


Re: Need to write a language

2006-10-25 Thread Karl Guertin

On 10/25/06, Billy Patton [EMAIL PROTECTED] wrote:

 I assume excel has a limit to the number of columns.


I believe the max is 65000 but that may be increased by now.


Is it possible, in vim/gvim to open a special version of vim so that the
user can begin to type, spac , and it would complete the word?


Yes.


Would it also be possible to not allow a word to be type'd if that word was
not in a list.


Harder, but probably.


My questions.
1. Can vim be configured to automatically start in edit mode?


Yes, but I forget what the setting is, you can just push it into
insert mode when you enter a buffer if nothing else.


2. Can vim monitor each word that is being typed?


You can remap the spacebar to trigger a function without difficulty or
you can monitor every keystroke if you want something fancier.

:help map.txt
:help map-arguments
:help autocmd
:help autocmd-events


3. Can vim do word completion?


Many types. :help completion


4. Can vim offer all possible spellings for partial word completion?


It does by default and you can view them as a menu if you're using Vim
7. If you want to provide a list of possible words to be completed, it
can be done by creating a ctags file.

:help completeopt


If the answer to most of qeustion above is yes
5. Can I do the programming?  I do perl, c, c++, csh and sh programming.


Most vim scripting is done in vimscript, which I consider to be fairly
close to bash/sh. You can also do scripting in Python. I'm not sure
about the perl interface.


Re: Question about listchars

2006-10-19 Thread Karl Guertin

On 10/19/06, Jeff Lanzarotta [EMAIL PROTECTED] wrote:

That all work well and good, but I would like to disable this display
of visual white space temporarily, do something, and then reset it back
to what I had. Is there a way to do this?


:map silent Leaderl :set invlistCR

Then type \l when you want to toggle (Leader is \ by default).
Change the binding however you like, but invfoo inverts the foo
setting.


Re: Move cursor in insert mode without breaking history?

2006-09-29 Thread Karl Guertin

On 9/28/06, Karl Guertin [EMAIL PROTECTED] wrote:

I'm trying to get vim to auto-close parenthesis and set it up so that
the closing paren jumps past the end of the inserted one. This mapping
does the trick


A followup. I do have this working

inoremap ()C-R=NoUndoMove(-1)CR
inoremap ) C-R=JumpTo(')').NoUndoMove(1)CR

function JumpTo(char)
   undojoin | exe 'normal f'.a:char
   return 
endf

function NoUndoMove(offset)
  call cursor(line('.'),col('.)+a:offset)
endf

Which does the movement without changing the undo stack. Hoorah.
Unfortunately, repeat (.) doesn't seem to repeat the cursor command.
It also doesn't repeat setpos() and setline(). As a result, the parens
move to the beginning of the insert on the repeats. E.g. typing (abc
shows up as (abc|) where | is the cursor position. Repeating the
insert gets me ()abc|. Any tips would be appreciated.


Move cursor in insert mode without breaking history?

2006-09-28 Thread Karl Guertin

I'm trying to get vim to auto-close parenthesis and set it up so that
the closing paren jumps past the end of the inserted one. This mapping
does the trick:

inoremap ( ()Left
inoremap ) C-Cf)a

But it breaks history so repeat (.) doesn't re-insert the entire
string. Is there any built in way to do a normal mode movement command
from insert mode? Or alternatively do what I want in a more robust
way?

I can write a C-R function that returns the appropriate number of
Right, but I'm trying to avoid that.


Detecting when in omnicomplete

2006-09-26 Thread Karl Guertin

I'm playing around with keybindings and omnicompletion and I'd like a
special set of keybindings when pumvisible() and it's an omnicomplete
match. I can mostly do this by setting a buffer variable in all my
mappings that would cause me to enter/exit omnicomplete, but I keep
missing edge cases. Is there a better way to detect which completion
mode vim is in?


Re: Detecting when in omnicomplete

2006-09-26 Thread Karl Guertin

On 9/26/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

If you have a look at ftplugin/sql.vim it does this.


sql.vim does have different functionality based on whether the popup
menu is visible or not, but I don't see where it distinguishes between
omnicomplete and keyword completion. E.g. if you hit C-nC-Right on
windows, you still attempt to drill down instead of doing C-Right.


Strange behavior when set cot=longest and set ignorecase

2006-09-26 Thread Karl Guertin

Vim 7.0.35

vim --noplugin -u NONE -U NONE
:set cot=menu,longest
:set ignorecase

If you do a keyword complete on words with mixed case, the initial
state is blown away. E.g. say you have 'context','convex','Convent'
and type  'conC-NC-P', you're left with nothing on the line. With
every other completion type, you're left with 'con'. Is this by
design?


Re: Generic xml omnicomplete

2006-07-18 Thread Karl Guertin

On 7/18/06, David Purton [EMAIL PROTECTED] wrote:

But, how can I get a generic xml omnifunction system where vim will just
close the last open tag for me.


It's not the vim7 way, but I use Devin Weaver's xmledit [1]. I
strongly prefer automatically closing tags as they're created.

[1] http://www.vim.org/scripts/script.php?script_id=301


Re: Motions in visual(line|block)

2006-07-14 Thread Karl Guertin

On 7/14/06, Max Dyckhoff [EMAIL PROTECTED] wrote:

I was approached by another engineer last week and asked if
I thought vim would increase his productivity. Needless to say I said
yes immediately.


I find that the key advantage of using vim is not necessarily the
speed with which you edit, but the reduction in mental noise when
working. You spend less time moving a cursor around and more time
focusing on coding, which is the entire point. My personal favorite
command is ct


Re: Vim Job board?

2006-04-14 Thread Karl Guertin
On 4/9/06, Bertram Scharpf [EMAIL PROTECTED] wrote:
 my boss says that his editor is as least as good as mine and
 he wants me to give up using Vim.

I'm late to the party on this one, but unless the company editor
forces a radically different concept of project editing[1], I don't
see why you'd have to use a given editor. I could see having to adjust
the vim formatting to match corporate standards, but not forcing an
editor.

[1] http://leo.sf.net