Friday, January 28, 2011

Re: Typing numbers

On Fri, Jan 28, 2011 at 09:18:46AM EST, adroid28 wrote:
>
> Hi all :)
>
> I am fairly new in vim and also my touch typing is not that great.
> Although I can deal very well with all the vim commands I found my self
> always looking down when I need to write a number argument. I was
> wondering wether there is a way in vim to input numbers without leaving
> the home row. Or is it that with time I will be able to reach the numbers
> row without looking?

If you think you can benefit by others' mistakes you may find some notes
& practical advice re: typing numbers is this famous Q&A:

http://www.diniwed.net/typing.html

I concur that prefixing Vim normal mode commands with a count, such as
'7dw' to delete the next seven words is ineffective.. Something like
'dw....' where you delete the next word (dw) and repeat the last command
(.) a number of times is the way I normally do it because I don't have
to count the words before I even start deleting. While I hit the dot (.)
repeatedly, I can see what I'm deleting and I know when to stop.. And
I can always hit 'u' for undo to bring back the words I deleted one at
a time in the event I got carried away.

Come to think of it, the only pratical use I have for counts is when
I need something like a line of dashes:

i - <Esc> x 80p

IOW - i for insert mode, one dash, <Esc> back to normal mode, 'x' to
delete the dash and yank it to the unnamed register, and finally 80p to
create a line of eighty dashes..

cj

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: cp1252 characters when enc=utf-8, fenc=cp1252

On Fri, Jan 28, 2011 at 11:15:18AM EST, Benjamin Fritz wrote:
> On Thu, Jan 27, 2011 at 10:43 PM, Chris Jones <cjns1989@gmail.com> wrote:

[..]

> > Maybe you should set your locale to latin1 instead of UTF-8 and the
> > encoding to cp1251?
> >
>
> Latin1 has no representation for various characters which I like to
> use in my personal notes. However most of the code I work with is
> Latin1. And I want UTF-8 as my encoding so I can use fancy multibyte
> characters in 'listchars', for example, and to view the source of web
> pages encoded in UTF-8 or other unicode encodings.

Another possibility that comes to mind might be to convert your files to
UTF-16.. which I believe is the Windows way of doing unicode.

I haven't seriously looked into it, but if you stick with UTF-8, could
your initial problem be addressed by creating a mapping that sets the
value of 'encoding' to match 'fenc', issues the ga command, and resets
'encoding' to utf8 immediately afterwards?

I may be wrong about this, and I can't say I understand the
implications, but the root cause of the problem here would appear to be
that contrary to 'fenc', 'encoding' is one of those options that cannot
be set locally - if you do a ':setl enc=latin1' and switch to another
buffer, a ':set enc?' reveals that the encoding has been globally
changed to 'latin1'. I'm sure there must be very good reasons for this
behavior. The above sequence is obviously not exactly 'atomic' but
I don't see it messing up anything.

> I have the following at the top of my .vimrc right after "set
> nocompatible", it seems to work very well:

[..]

Thanks for the clarification.

I ran into similar problems when I reviewed an APL derivate called A+
that does not support any form of unicode and has its own peculiar
extended ASCII code page. I had to say good-bye to my funky unicode
listchars, tabline.. etc. and use a different .vimrc.. not wanting to
mess up the original one with a bunch of conditionals..

Not being a Windows user, I cannot think of anything practical..

You may find additional ideas by reading this document I came across
a few days ago:

| http://www.cs.tut.fi/~jkorpela/chars.html#10646

cj


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Show method name in gutter

On Jan 28, 3:25 am, Ovid <publiustemp-...@yahoo.com> wrote:
>
> This looks like it would be a great start, but I'm working with some large files
> and it's grinding my vim to a halt when I switch buffers. I might have to go
> with a lightweight, but less correct option.
>

What about some of the options in another current discussion?

http://groups.google.com/group/vim_use/browse_thread/thread/4fcf8659806f76ef

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Remapping CTRL-I to

On 01/28/2011 12:14 PM, Chris Jones wrote:
> In my environment, this causes the<Alt+I> combo to send<Esc>
> to Vim.. and it looks like it might work with no side effects
> -- I first checked in insert mode that<Alt+I> did not do
> anything that I could see and I don't remember ever using it
> for anything else (?).

The only catch is that (depending on your encoding and other
stellar alignments) some alt+letter combinations produce various
accented & ASCII characters >128. If you type those characters
intentionally (which it sounds like you don't), it may interfere.
Otherwise, they should be safe to use (as mentioned in a
sibling reply, they're case-sensitive).

-tim

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Show method name in gutter

On Fri, Jan 28, 2011 at 02:25, Ovid <publiustemp-vim@yahoo.com> wrote:
> This looks like it would be a great start, but I'm working with some large files
> and it's grinding my vim to a halt when I switch buffers. I might have to go
> with a lightweight, but less correct option.

Yeah. I see several problems that I don't know how to fix.

The first is, the function has to load each line and add them to a
string. I haven't found a way of just slurping the entire file in.

The second is, the code has to be reparsed on every update.

Finally, it has to do this *every* time the statusline is updated,
whether or not the buffer has been changed.

So, I need to figure out how to:

o load the contents of the file faster
o how to have a variable for each buffer so it doesn't need to be
reloaded all the time
o figure out how often to actually rescan and reparse the file
--
Alan Young

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Remapping CTRL-I to

On Jan 28, 12:14 pm, Chris Jones <cjns1...@gmail.com> wrote:
>
> Actually, while writing my reply, I tried a:
>
> | :inoremap <Esc>i <Esc>
>
> In my environment, this causes the <Alt+I> combo to send <Esc> to Vim..
> and it looks like it might work with no side effects -- I first checked
> in insert mode that <Alt+I> did not do anything that I could see and
> I don't remember ever using it for anything else (?).
>

Alt keys do nothing special in Vim by default. If you're using GUI Vim
you may need to read :help 'winaltkeys' but it sounds like you're
sticking with the terminal.

You can probably map it directly:

:inoremap <A-i> <Esc>

or

:inoremap <M-i> <Esc>

Note that Alt maps, unlike CTRL maps, are case-sensitive.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Re: Starting out with VIM and C++

On Jan 28, 11:18 am, nickatron <ntro...@gmail.com> wrote:
> Hello,
>
> I just started an introductory course on C++, and I would like to take the
> time to use VIM as an IDE. What do I need to do to get colored syntax and
> make it more usable for C++ programming?

To enable syntax highlight and such, you will need to create a .vimrc.
This is highly recommended anyway. There is a reasonable example that
ships with Vim.

Specifically, you will need these lines in your .vimrc file:

filetype plugin indent on
syntax on

Take a look at:

(within Vim): :help usr_05
http://vim.wikia.com/wiki/vimrc
http://vim.wikia.com/wiki/Category:Getting_started

>
> Also for the course I need "Any ANSI or ISO standard C++ compiler". What do
> you recommended?
>

This depends on the platform you will be developing on. gcc is pretty
good and I think it comes standard on most *nix platforms these days.
MinGW provides the same compiler for Windows.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php