Re: make inside vim session.

2008-10-23 Thread Chris Jones

On Thu, Oct 23, 2008 at 12:15:04PM -0700, Gary Johnson wrote:
 The other way is to run make in the background and redirect its 
 output to a file.  When it's done, read that file into your quickfix 
 buffer with a command such as :cf.  See

This to me seems ideal. I mucked around with it and the make parameters
trying to get this done using :set shellpipe and :set makeef

set shellpipe=\2\\\1\
set makeef=/tmp/foo.error

:make -j4

... trouble is stuff still gets output to the screen... it is very odd.

If I could just get that to go away... I'd be fine.

Let me know if you have any more ideas. Alos, any idea how I would know
when the make had finished using this method?

Thanks again for the thelp

Cheers,
   Chris

-- 
You must be the change you wish to see in the world. -- Mahatma Gandhi


--~--~-~--~~~---~--~~
You received this message from the vim_use maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Does anybody use cscope together with VIM?

2008-12-16 Thread Chris Jones

On Mon, Dec 15, 2008 at 05:08:54AM +0100, Tony Mechelynck wrote:
 This is the third almost identical post on the same subject. Before the 
 second one, you had already received two replies, so please read them.
 
 Regards,
 Tony.

Tony;

This is probably someone thinking the original message did not go
through. I've encountered some serious lag on this mailing list between
the time I send and the time it actually appears to be posted. Also it
appears that only sending to v...@vim.org works for me. The
reply_to address of vim_use@googlegroups.com doesn't work.

Cheers,
   Chris

-- 
You must be the change you wish to see in the world. -- Mahatma Gandhi


--~--~-~--~~~---~--~~
You received this message from the vim_use maillist.
For more information, visit http://www.vim.org/maillist.php
-~--~~~~--~~--~--~---



Re: Opening files in new buffers

2010-12-03 Thread Chris Jones
On Wed, Dec 01, 2010 at 05:07:19PM EST, Ven Tadipatri wrote:

[..]

 There's tabbed browsing in vim as well right?

More like tabbed editing. ;-)

 Sometimes I notice links being opened in horizontal tabs. What's the
 difference between these tabs and the buffers that are opened? In
 other words, what are the advantages/disadvantages of using tabs
 versus buffers?

This may help clarify buffers vs. windows  tabs:

  :help buffers
  :help window
  :help tabpage

Chasing the web browser analogy, Vim's windows and tab pages loosely
correspond to a tabbed browser's tabs, while Vim's buffers are a bit
like the browser's cache.

Do you mean (dis)advantages of using ‘windows’ vs. using ‘tab pages’?

This Vim tip provides many interesting suggestions of things you can do
to put Vim's ‘tab pages’ to good use:

  http://vim.wikia.com/wiki/Quick_tips_for_using_tab_pages

If you enter ‘tabs’ in the wiki's search box you will get a list of all
the currently available tips relative to ‘tabs pages’:

  http://vim.wikia.com/wiki/Category:Tabs

HTH

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: how to solve this strange issue?

2010-12-03 Thread Chris Jones
On Thu, Dec 02, 2010 at 05:38:42PM EST, Israel Chauca F. wrote:
 
 On Dec 2, 2010, at 2:23 AM, bsmile wrote:
 
  
  Dear members,
  
  I copy something and paste to another vi editor, but the leading white space
  adds up for subsequent lines. For example, what is copied is
  
   aa
   bb
   cc
   dd
  
  when pasted into another vi, what I get is
  
   aa
 bb
   cc
 dd
  
  Any idea to why this happens and how to solve it?
 
 See  :h 'paste'

See also 

:h 'pt'

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: introducing vmail

2010-12-15 Thread Chris Jones
On Tue, Dec 14, 2010 at 02:49:01PM EST, Daniel Choi wrote:

 Today I'm releasing a new open source project which I've been working
 on over the last two weeks, but which I've been daydreaming about for
 over a year.
 
 It's called vmail. It's a Vim client for Gmail. It's a hybrid
 Ruby/VimScript application.
 
 http://danielchoi.com/software/vmail.html
 
 This is the first release of vmail so there is a lot of room for
 improvement and feedback will be highly appreciated

I have not tried vmail as yet, but while reading the above, I did not
see a ‘reply-to-list’ alongside the ‘reply’, ‘reply to all’, etc.
options.

When a message originates from a mailing list, this automatically sets
the To: header to the mailing list, rather than the OP's email address,
thus helping avoid the familiar: ‘why do you reply to me directly, I am
subscribed to the list’ .. ‘oh, sorry.. my mailer does not support reply
to list’.. etc. etc. exchanges.. :-)

More to the point, possibly:

I see on the web page that ‘some people love using Vim 1000 times more
than using a web browser or a GUI mail program’. Personally, I use
‘mutt’ and I have set it up to use Vim to compose my messages, and where
possible, I have customized it to use Vim-like keyboard actions in the
index and the pager.

Even for those who currently use a GUI mailer, I think it would be nice
to add a short section to your web page that lists the features of vmail
that might make it a better choice for vimmers, rather than using
half-baked solutions such as mutt+Vim (or TB + vimperator).

Something like:

- supports Vim color schemes and syntax highlighting
- supports Vim windowing  tab pages
- uses the same Vim keyboard shortcuts
- supports Vim's Ex mode
- uses Vim's registers and cutpaste mechanisms 
- communicates seamlessly with a Vim instance via the system's clipboard
- etc.

Of course, I have no idea if vmail does any of the above (although the
mention of the completion mechanism  C-W C-O to switch to full screen
mode sound promising), and these are only examples of features that an
average vimmer such as myself might care about. 

In other words, I suggest that vimmers would probably want to know if
they will feel right at home with vmail from the start and how well it
integrates with Vim and their pre-existing Vim setup.

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: Slow vim loading , how to find it out

2010-12-18 Thread Chris Jones
On Sat, Dec 18, 2010 at 01:57:37AM EST, sc wrote:
 On Friday 17 December 2010 23:51:27 Tom Link wrote:
 
   it's using over half of all startup time
 
  In this case it won't work because you probably want to load
  the plugin on every startup, but you can use plugins like
  asneeded, tplugin to load plugins on demand (e.g. when
  invoking a command for the first time) or vim-addon-manager
  or pathogen to enable a plugin after startup. This way you
  have better control over which plugins are loaded when.
 
 i'm not sure what you're saying won't work
 
 what does work is this:  i removed CSApprox from my autoload,
 doc, and plugin paths, and my startup time for vim dropped
 from 194 milliseconds to 60 ms -- the last thing i want is
 more plugins -- i'm down to just netrw now -- when i need to
 see pretty colors i'll use gvim

Or this (?) from the CSApprox web page:

‘If for some reason this transparent method isn't suitable to you (for
instance if your environment can't be configured to meet the
|csapprox-requirements|, or you need to work in Vim 6), another option
is also available: using the |:CSApproxSnapshot| command to create a new
GUI/88-/256-color terminal colorscheme.  To use this command, a user
would generally start GVim, choose a colorscheme that sets up the
desired colors, and then use |:CSApproxSnapshot| to create a new
colorscheme based on those colors that works in high color terminals.
This method is more flexible than the transparent mode and works in more
places, but also requires more user intervention, and makes it harder to
deal with colorschemes being updated and such.’

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: introducing vmail

2010-12-18 Thread Chris Jones
On Thu, Dec 16, 2010 at 09:08:52PM EST, Daniel Choi wrote:
 
 These are all very good suggestions. 

Thanks! 

After posting, I was a little concerned you might take my comments as
negative, which they were not meant to be.

One possible route might be to take a hard look at mutt's interface,
since mutt basically does pretty much everything you'll ever need when
working with mail messages¹ but it often does so in rather ‘mysterious’
ways, and see if the same could be offered in a more vim-ish way.

Mutt's user interface is not particularly user-friendly, especially for
those who come from a GUI environment, but the one aspect that still
aggravates me on a regular basis, is that its browser does not provide
a windowing mode: so that when you start replying to a message, the only
way you can take another look at other messages in the current thread²
is either to exit your incomplete reply and save it to your ‘drafts’
folder, or fire up another instance of mutt in another terminal³. In
terms of usability, it would make a big difference if mutt had something
akin to vim's buffer windowing mode and bufferlist so that you could
easily display several messages concurrently, and navigate and switch
between them via the ‘:b*’ family of commands.

I guess what I'm suggesting is that if someone had the time, energy,
motivation, and talent to write a general-purpose text-mode mailer from
scratch, he could do a lot worse than basing it on Vim's (not Gvim's)
model.

Does vmail offer such capabilities or does this go beyond what you plan
to do?

cj

¹ Even exotic stuff like breaking and joining threads, which sometimes
  comes in handy.

² Or.. vim-like help files! Try F1 in mutt and ‘/’ to find help on
  anything for a really nerve-wracking experience :-)

³ There are other circumstances, such as when you suddenly remember that
  you urgently need to reply to mail that just came in..

-- 
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: Make vim recognize my bashrc aliases

2010-12-18 Thread Chris Jones
On Sat, Dec 18, 2010 at 04:41:06PM EST, Roger wrote:

 csupport plugin is awesome!
 
 I have one issue with VIM, trying to make it recognize my bashrc aliases.
 
 ie:
 :!indent ./foo.c
 
 From what I've read, the cause is Bash starting in non-interactive mode.

 So I've modified $HOME/.vimrc:
 shell=bash
 shellcmdflags=-ic

 Also note, I must specify -ic, as not even -i\ -c will work from within
 VIM.
 
 Is this the proper solution?

Not sure, but this what I did:

1. in .bash_profile I added:

   export BASH_ENV=~/.bash_ni

   cf. ‘man bash‘ for details..

2. Then, I created the following ~/.bash_ni file
   
   # ~/.bash_ni: get bash to load aliases  functions for non-interactive
   #  shells - e.g. when issuing `:!cmd' commands from Vim
   #set -x 
   #-
   # functions
   #-
   if [ -d /etc/bash_functions ]; then
   cd /etc/bash_functions
   for i in $(ls);  do
   . $i
   done
   cd -
   fi
   
   if [ -d /home/gavron/.bash_functions ]; then
   cd /home/gavron/.bash_functions
   for i in $(ls);  do
   . $i
   done
   cd -
   fi
   #- ---
   # source aliases
   #-
   shopt -s expand_aliases
 
   if [ -f ~/.bash_aliases ]; then
   . ~/.bash_aliases 
   fi

I tend to use bash functions rather than aliases because they are a lot
more powerful and flexible, hence the functions-related code above. If
you don't use functions you can skip that part.

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: Slow vim loading , how to find it out

2010-12-19 Thread Chris Jones
On Sat, Dec 18, 2010 at 01:51:57PM EST, Benjamin R. Haskell wrote:

[..]

 Unless you're starting and stopping Vim hundreds of times per day, 

See below.

 the  amount of time it took to write that email and change the way you
 use  CSApprox dwarfs the time savings you'll ever see from removing it
 from  startup.

 I can see the OP wanting to reduce Vim startup below three seconds --
 that's a perceptible delay.  But the difference in startup time
 between  .194 seconds and .060 seconds is barely noticeable.

But with.. say, a dozen such plugins or more, this could climb to
something like a couple of seconds. 

Now suppose you use Vim to edit your email messages (a common setup if
mutt is your mailer of choice) this may result in something like a total
4-5 seconds lag every time you hit the ‘L’ key (reply-to-list) and then
it does become noticeable.

OTOH, this pales in comparison with wasting hours (days?) when some
exotic and no-longer maintained plugin that one may have installed years
ago and completely forgotten about, starts playing foul in mysterious
ways when upgrading Vim or the OS. 

This is why I suggested using the plugin in ‘batch mode’, so-to-speak,
and disabling it after after converting the color schemes.

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: Make vim recognize my bashrc aliases

2010-12-19 Thread Chris Jones
On Sun, Dec 19, 2010 at 08:50:42AM EST, Roger wrote:

[..]

 Granted, functions are more useful, but I haven't gotten around to
 really incorporating any of my own functions into $HOME/.bashrc yet.
 Aliases can be written much faster.

 The above clippings seem to be a very very good solution.  However,
 think Bash should be smart enough (ie. have an option) to source any
 aliases (or functions in bashrc) if called non-interactively.

Well that's precisely what setting the ‘reserved’ $BASH_ENV environment
variable does.

Why they had to implement it in this roundabout way rather than via
a straightforward command-line flag is something you may want to ask the
bash maintainers.

May be worth your time, come to think of it: I am running a fairly old
bash 3.2 (debian stable) and things may have improved in this respect.

Let me know if you find anything useful.

Thanks,

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


[OT] Re: Make vim recognize my bashrc aliases

2010-12-19 Thread Chris Jones
On Sun, Dec 19, 2010 at 12:55:41PM EST, Roger wrote:
 On Sun, Dec 19, 2010 at 12:29:52PM -0500, Chris Jones wrote:

[..[

 Let me know if you find anything useful.
 
 =app-shells/bash-4.1_p9 here. ;-)  Gentoo.

Yes, not a bad choice it appears.

I am migrating my current systems to a new laptop and I have been
fighting legacy debian (re)installs for most of the weekend. 

I was thinking of waiting till squeeze becomes the new stable, but the
rumor now has it that that's not going to happen until the spring.

sigh... :-)

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: AX: change letters on the fly

2010-12-26 Thread Chris Jones
On Sun, Dec 26, 2010 at 02:39:02AM EST, rameo wrote:
 Zyx, Dominique,
 
 I know the ctrl-k feature.
 
 I also use Texter on my pc to send advanced keystrokes to a program
 p.e. \\e -- transforms in ë on my pc
 
 I also have a number of blind keys on my keyboard to create foreign
 letters p.e. AltGRe creates an ë
 
 However AX is much quicker.
 I created this key sequence in AX:
 aâäæa AÀÂÄÆA bßb BßB CÇC eêëe EÉÊÈËE iîïi IÎÏI oôöœo OÔÖŒO uûüu UÛÙÜU
 
 when I write the letter a and push F8, the a becomes an â when i
 push F8 again the â becomes an ä, so on.
 It cut out the character to the left of the cursor, it look it up in a
 string of characters and paste the next one.
 Unfortunately, it doesn't work in gvim.
 It works writing this text, it works in other editors but not in my
 default editor gvim. :)

You might be interested in the ‘Unicycle.vim’ plugin by Jason Diamond.

You could modify it to do pretty much what you need without having to
reach for a hot key and end up with something that works pretty much
along the lines of the T9 mode of your cell phone. Take it from someone
who has next to no Vimscript skills, I once customized this plugin to
add stuff like fancy arrows, bullets, etc. to the original, and it
shouldn't take you more than a couple of hours. 

Otherwise, what with Vim's lists and dictionaries, writing a function
that overwrites the character before the cursor by the next character in
a given sequence shouldn't be too hard.

In the long run, probably less of a headache than trying to adapt
someone else's code to Vim.

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: Pasting text without indentation

2011-01-14 Thread Chris Jones
On Fri, Jan 14, 2011 at 09:46:15AM EST, Reid Thompson wrote:
 On Fri, 2011-01-14 at 12:26 +, jaye...@gmail.com wrote: 
 
   
  Say I copy some text from a browser. Normally I hit ctrl+v to paste it. 
 Works but all of the text is indented like this:-
   
  Blah
   Something
 More text. 
  
 Blah-de-la-blah
  
  How to avoid this?
   
   
   before pasting do
   :set paste 

If you often paste multiline text, add this to your .virmrc:

:set pastetoggle=F11   or other Fx

.. and hit F11 before pasting.

Make sure you hit it again immediately after pasting to avoid unwanted
‘paste mode’ side effects:

:h 'paste'

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: Matching Multiple Columns in Vim

2011-01-14 Thread Chris Jones
On Fri, Jan 14, 2011 at 12:10:10PM EST, Stephen Rasku wrote:

 I want to find anything that is not 'E' in the 11th column followed by
 an 'R' in 56th column.  Is this possible?
 
 I've tried the following and none have worked:
 
 /\%11v[^E].*\%56vR
 /\%11v[^E]\%56vR
 /\%11c[^E].*\%56cR
 /\%11c[^E]\%56cR
 
 I am using vim 7.0.
 
 Also, what's the difference between a virtual and a real column?

I am not sure I have figured that one out completely, but I think that
provided your vim was compiled with +virtualedit, you can issue a :set
ve command and then you will be able to access any position on the
screen, even beyond the end of lines. 

In this context, a virtual column would be a column that does not
correspond to anything in the file associated to the current buffer,
while a real column does.

Quite useful if you need to duplicate a column to the right of an
existing table.

Not sure it this makes sense in your context, and s/o correct me if
I misunderstood Vim's ‘virtual editing’.

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

2011-01-22 Thread Chris Jones
On Sat, Jan 22, 2011 at 05:34:01PM EST, Ben Fritz wrote:
 
 
 On Jan 22, 3:48 am, Ben Schmidt mail_ben_schm...@yahoo.com.au wrote:
 
  I think so. :help 'fileencoding' describes conversion as taking place
  when files are written and read, implying that when a file is actually
  being edited, it is in 'encoding', and commands within Vim working on
  the file would be expected to use 'encoding' also. 'fileencoding'
  doesn't affect the encoding with which the file is edited and
  manipulated in Vim; it just changes the way it is read and written.
 
 
 Thanks, Ben. That explanation makes a ton of sense. I figured there
 was something subtle I was missing!
 
 So, is there a command to show the byte value of the character under
 the cursor, as it will be written? If I need to I can convert to
 binary but I'd rather just do something like 'ga'.

Not sure what you want, but take a look at ‘g8’..

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

2011-01-27 Thread Chris Jones
On Sat, Jan 22, 2011 at 05:41:33PM EST, Ben Fritz wrote:

[..]

 I work in Windows XP mostly, I actually have never heard of xkb and
 don't have the slightest idea what it's level 3 is. Converting to
 UTF-8 for this particular file would be OK but doesn't serve much
 purpose, and most of the files I work with are latin1 and need to stay
 that way.

Maybe you should set your locale to latin1 instead of UTF-8 and the
encoding to cp1251?

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


Remapping CTRL-I to Esc

2011-01-27 Thread Chris Jones
Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
remapping Tab at the same time?

I normally use CTRL+[ because the Escape key on my laptop is impossible
to reach but even that is not really comfortable.

Thanks,

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: Remapping CTRL-I to Esc

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 12:52:55AM EST, Ben Schmidt wrote:
 On 28/01/11 3:56 PM, Chris Jones wrote:

 Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
 remappingTab  at the same time?

 I normally use CTRL+[ because the Escape key on my laptop is
 impossible to reach but even that is not really comfortable.

 No, this isn't currently possible with Vim.

 I don't think it will ever be possible with terminal Vim. 

Thanks. A quick test showed me that the CTRL-I = Tab equivalence is
indeed ‘inherited’ from the underlying XTerm. So this is probably where
I should start looking.

 But one day it might be possible with gVim, 

Me.. ‘gVim’.. that'll be the day.. :-)

 if the keyboard code gets a thorough 
 reworking. It probably won't happen any time soon.

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: Remapping CTRL-I to Esc

2011-01-28 Thread Chris Jones
CM SPAM detection: spam
References: 20110128045628.GD4117@pavo.local
 4d42bb15.6020...@tim.thechases.com
User-Agent: Mutt/1.5.18 (2008-05-17)
X-Original-Sender: cjns1...@gmail.com
X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com:
 167.206.4.200 is neither permitted nor denied by domain of
 cjns1...@gmail.com) smtp.mail=cjns1...@gmail.com
Reply-To: vim_use@googlegroups.com
Precedence: list
Mailing-list: list vim_use@googlegroups.com; contact 
vim_use+own...@googlegroups.com
List-ID: vim_use.googlegroups.com
List-Post: http://groups.google.com/group/vim_use/post?hl=en_US, 
mailto:vim_use@googlegroups.com
List-Help: http://groups.google.com/support/?hl=en_US, 
mailto:vim_use+h...@googlegroups.com
List-Archive: http://groups.google.com/group/vim_use?hl=en_US
Sender: vim_use@googlegroups.com
List-Subscribe: http://groups.google.com/group/vim_use/subscribe?hl=en_US, 
mailto:vim_use+subscr...@googlegroups.com
List-Unsubscribe: http://groups.google.com/group/vim_use/subscribe?hl=en_US, 
mailto:vim_use+unsubscr...@googlegroups.com
Content-type: text/plain; charset=windows-1252
Content-transfer-encoding: quoted-printable
Content-disposition: inline

On Fri, Jan 28, 2011 at 07:48:21AM EST, Tim Chase wrote:

[..]

 As others have mentioned, using ^I is a tough choice because it's usually=
=20
 treated as a tab. =20

One thing I haven't looked at is using the underlying XTerm's Xresources
to remap CTRL-I. In theory, I would then be able to limit the scope of
this customization to a single XTerm by using its =91-name=92 command-line
flag to run it under a different name and thus customize its keyboard
map. Unfortunately, I run pretty much everything under a single instance
of XTerm multiplexed via GNU/screen.. so where I'm concerned, the change
would pretty much be =91system-wide=92 anyway.

 However there are other keys that may be accessible on your laptop.
 I happen to have F1 remapped to esc as well because they're so
 physically close (and if I want help, I know to ask for it at the
 command-line) it's easy for me to mash a finger in the top-left of my
 keyboard to hit one of them.

That's precisely the problem I am running into with this new laptop: the
folks at Lenovo have placed the Esc key ais ll by itself above the
function keys row. But in any case, I tend to use function key mappings
only for stuff that I do once in a while (the pastetoggle key is a good
example). Speaking of toggles, I like them for very frequent keyboard
actions especially when they result in switching back and forth between
two keyboard states.. but obviously I couldn't =91imap=92 the I-key to
escape :-) .. and so I thought that the next best thing would be to use
=91i=92 to switch to insert mode and modifier+I to go back to normal mode=
.

 Alternatively, you could use some other control combination that you
 don't use frequently in insert-mode.  Very few folks I know use ^A in
 insert mode (I can only think of about twice in my ~10yrs of vimming
 where it wasn't (a) to learn what it did or (b) to try and weasel down
 a keystroke on vimgolf.com) so it might make a good candidate --
 especially if you've remapped/swapped your control-key and your
 caps-lock key.  Another open candidate is ^B which non longer has any
 meaning.

Ah.. i_CTRL-A indeed.. And I thought I knew everything.. :-)=20

I'll have to decide whether it's worth integrating to my working
habits.. there might be cases where doing a bunch of those in quick
succession might be a valuable timesaver.

Actually, while writing my reply, I tried a:

| :inoremap Esci 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 (?).

Hm. Touch wood, but this would be perfect.. it's as close as I'll get to
using the I key as a toggle.. and for a home-row person like me.. it
works very well indeed in terms of accessibiity.. My left thumb usually
rests on top of the left Alt key.. goody.. goody..!

Thanks to all for your comments. If this holds.. you very much helped
make my day!

cj

--=20
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

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 11:15:18AM EST, Benjamin Fritz wrote:
 On Thu, Jan 27, 2011 at 10:43 PM, Chris Jones cjns1...@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: Typing numbers

2011-01-28 Thread Chris Jones
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 QA:

  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: Remapping CTRL-I to Esc

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 02:20:06PM EST, Ben Fritz wrote:
 
 
 On Jan 28, 12:14 pm, Chris Jones cjns1...@gmail.com wrote:
 
  Actually, while writing my reply, I tried a:
 
  | :inoremap Esci 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.

Ah, yes.. that's probably what I had at the back of my mind re: using
the Alt modifier.

 You can probably map it directly:
 
 :inoremap A-i Esc
 
 or
 
 :inoremap M-i Esc

Well, you know what.. I've never been able to use the A- or M- syntax..
Tha's why I always specify Esc instead in my mappings. Time to revisit
this maybe..

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

Interesting.. would mean that I can map Alt+key and Shift+Alt+key to
different things.. right?

Thanks,

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: Remapping CTRL-I to Esc

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 03:14:36PM EST, Tim Chase wrote:
 On 01/28/2011 12:14 PM, Chris Jones wrote:

 In my environment, this causes theAlt+I  combo to sendEsc to
 Vim.. and it looks like it might work with no side effects -- I first
 checked in insert mode thatAlt+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.  

Sounds promising.. Straight US-ASCII boy that I am.. this shouldn't be
a problem. Matter of fact, the first thing I do to an XTerm is make sure
the 8th bit is disabled, so I can use Alt+. in the shell to retrieve the
last word of the previous command.

As in:

| $ mkdir foofoofoobarbarbar
| $ cd Alt+.  # gives me: cd foofoofoobarbarbar etc.

I use this all the time.

 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).

I usually enter such characters either via the compose key, level three
mappings accessed by pressign the Winkeys, or occasionally Vim digraphs.

Thanks,

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: Typing numbers

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 05:35:02PM EST, Tim Chase wrote:
 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.

 This breaks when using t/T with ;  to repeat the motion as it just finds 
 the same one you just found.  I have to break down and count for those :)

Another reason why I don't use t/T (and don't care much for f/F either).

There's only so much can fit under my skull.. and I prefer to stick with
a limited subset of keyboard actions that may not be the quickest and
most efficient for all occasions.. but that I can use without hesitation
or incurring any overhead rememberiing. Namely that if the cursor is at
the beginning of the line above and I want to get to the ‘..ii..’ typo
in ‘rememberiing.’, I find it considerably more effective when all is
told to just hit ‘w’ till I get to the beginning of the word
‘rememberiing’.. and either hit .. or hit ‘e’ to get to the end of
the word and then ‘hh‘ followed by ‘x’ to delete the last of the two
‘i’'s.. What would I really gain by counting 1, 2, 3.. it's the 3rd ‘i’
I want to remove.. or wait a minute.. is it the second..? Huh.. 

Now I'm aware that I could also jump to the next sentence and work
backward.. and there are probably other ways to get to that extra ’i’ in
fewer keystrokes than my clumsy approach, but all in all, I much prefer
sticking to .. or .. and occasionally bbb.. etc. because it
would take me longer to produce the ‘find the third i’ or ’jump to next
sentence’ key sequence than typing three or four (five or six..) ‘w’'s
in succession. 

And on a really bad day, after such a minor distraction.. I might even
need another little extra effort to remember why I moved the cursor
there in the first place.. Clever is not always better..

 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..

 I just use

   80I-esc

 to save the cut/yank :)

Thanks Tim, even better illustrates my point... 

Incidentally, you have just put paid to maybe 2-3 years of frustration..
I vaguely remembered that there was a better way (probably saw it in vim
tips, or maybe s/o once mentioned it on this list) and never memorized
it properly.. Once in a while, I would try.. hm.. starts with typing 80-
in normal mode.. then what..?? and I was never able to bring it back.
I actually stopped trying because it so annoyed me. :-) 

To make sure it'll stick *this* time, I'll practice it for the next few
days.. :-)

One nice touch about the above sequence and makes it really elegant is
the upper case ‘I’ because you can type it regardless of where the
cursor is located on the current line: after you hit Esc, the cursor
sits on the last of your inserted dashes, which means that you just need
to type ‘a’ to switch to insert mode with the cursor on the first
character following the last dash and ‘Enter’ to separate your line of
dashes and the previous contents of the line and move down any ensuing
text.

Thanks again for your comments.

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: Typing numbers

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 11:12:10PM EST, Ben Schmidt wrote:

 Hehe. Since we're sharing...If I were fixing 'rememberiing', I probably
 would have done:

 /iiEnterx

 No need to count, and no need to watch what I'm doing to know when to
 stop repeatedly pushing something either. I do this a lot. If I see an
 error on the screen, I just use / to quickly jump to it, or at least to
 something 'unique' in its near vicinity,

Yeah.. that's why I love sticking those pseudo-ellipses all over my
prose.

 and then fix it. Sometimes I don't type enough to get me straight
 there, and need an n or two, but that still tends to be quicker for me
 than moving around by repeating other movement keys. YMMV.

Hehe.. That's the problem about giving examples just to make a point:
contrary to f/F/t/T, that I really don't like all that much.. I use
/string a lot to move the cursor around the buffer.. Especially since
it's  a standard mechanism with many other applications.. so now you
mention it.. that's more often than not what I would normally do..

Spoilsport.. :-)

cj

P.S. Not to mention that I would in most cases not even have noticed the
typo in the first place and spellchecking would have had to take care of
it for me..

-- 
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: Typing numbers

2011-01-28 Thread Chris Jones
On Fri, Jan 28, 2011 at 11:28:27PM EST, Ben Schmidt wrote:

 [*] you can add more than one character, so if you wanted, you could
 get fancy with something like

 40i-=esc

 to get a nice row of 80 characters like -=-=-=-...=-=-=-= but again
 you then have to do the math and divide down. Not grievous, but I can
 count the real-world times I've done that on one hand.

This has a flavor of déja-vu, Tim.. The more I think about it, the more
it sounds like it was you who gave out this tip initially.. I thought..
nice.. and then was never able to remember it properly.

 Or you can start taking down a receipt number without pushing i, as I
 did last week. I typed 1011 before realising it hadn't appeared on the
 screen. So then I pushed i and typed the whole 13-digit number, and when
 I hit Esc I got 1011 copies of it, all running together as I had typed
 no spaces or newlines or anything. Brilliant! There's 12 KB right there!

 Was that too off-topic?

Well, the OP certainly appears to have lost interest.. if that's anything
to go by.. :-)

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: Typing numbers

2011-02-01 Thread Chris Jones
On Sun, Jan 30, 2011 at 09:03:03AM EST, Dotan Cohen wrote:
 On Fri, Jan 28, 2011 at 16:18, adroid28 d.athina...@gmail.com wrote:

[..]

  Or is it that with time I will be able to reach the numbers row
  without looking?
 
 
 I took a file to the F, J, 4, 8, F4, and F8 keys on the keyboard to
 help find them faster. 

Interesting.. But shouldn't it be 4  7 rather than 4  8..?

 Then I painted the whole keyboard black!

Like so..?

  http://www.daskeyboard.com/model-s-ultimate/

 Although painting may be a bit extreme, I do recommend filing a notch
 into the aforementioned keys. Years later and it still saves me
 precious seconds tens of times per day.
 
 If you really want to go wild on the keyboard, you can cut the silicon
 domes inside to make the keys easier to press. 

No sure about that.. I usually find keyboards way too soft out of the
box.. 

 That is the third thing that I do to any new keyboard now (while the
 paint on the key caps is drying, after filing notches).
 
 Keyboard pictures upon request.

I for one would be interested. 

Thanks,

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: Remapping CTRL-I to Esc

2011-02-01 Thread Chris Jones
On Tue, Feb 01, 2011 at 05:49:13AM EST, Erik Christiansen wrote:
 On Fri, Jan 28, 2011 at 07:37:17AM +0100, Christophe-Marie Duquesne wrote:
  On Fri, Jan 28, 2011 at 6:52 AM, Ben Schmidt
  mail_ben_schm...@yahoo.com.au wrote:
   On 28/01/11 3:56 PM, Chris Jones wrote:
  
   Is it possible to remap CTRL-I to ‘Escape’ in insert mode without
   remappingTab  at the same time?
  
  I think using an external tool such as xmodmap, you could remap c-i
  to esc, but this solution would affect the whole system.
 
 Originally to compensate for a uselessly small laptop ESC key, I long
 ago remapped Caps Lock to ESC:

I tried that.. but the problem is that I have switched the location of
CapsLock and Left Control.. And on a ThinkPad keyboard, the left Control
key sits between the Fn key and the Logo key.. it's also smaller than on
most keyboards.. Makes hitting it accurately even more of a challenge
than hitting the CTRL-[ combo. 

Other things that I tried include remapping Escape to a double keystroke
such as in

  :inoremap ;; Esc
  
 but that didn't work out very well either.

 To change CAPS_LOCK to ESCAPE, put into ~/.Xmodmap:
keycode 0x42 =  Escape
clear Lock # Disable Caps-Lock

 Now I use it on desktops as well, because I've never found a use for
 Caps Lock [1]. 

Apart from old-fashioned typing drills.. 

 Since ESC is used so much in vim, it seems useful to have it on
 a single key. Consistent behaviour across all applications is an
 advantage, I find.

Yes that's the main problem with remapping. Pretty useless if it clashes
with any other environment you use freaquently.. And the reason I am
dreaming of a desktop that gives you the option of some form of Vim
mode. I actually patched Window Maker, so that I could use hjkl to move
around menus.

Thanks,

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: Typing numbers

2011-02-01 Thread Chris Jones
On Sun, Jan 30, 2011 at 05:52:59AM EST, John Little wrote:

 In the spirit of this thread, I'll bite...
 
 Chris said:

  There's only so much can fit under my skull..

 I don't believe that limit is relevant; there's only a few hundred vim
 commands, if you use them you'll remember them.

Sloppy wording.. sorry.. let me rephrase: ‘There's only so much that
I can commit to muscle memory’. What I can ’remember’ while quizzed or
otherwise cross-examined is irrelevant. 

  ... and I prefer to stick with a limited subset of keyboard actions
  that may not be the quickest and most efficient for all occasions..
  but that I can use without hesitation or incurring any overhead
  rememberiing.

 Use more commands often enough and you'll use them without hesitation
 also.

Too many notes Mozart.. too many notes.. :-)

  Clever is not always better..

 True, but vim really rewards being open to cleverness.  From
 http://www.moolenaar.net/habits.html: If you think like this, you
 will get stuck in the stone age of computing. Some people use Notepad
 for everything, and then wonder why other people get their work done
 in half the time... 

You can edit twice as fast as me..? 

 Read the rest of that article for some balance on this.

Hehe..I have read Bram's ‘Seven habits’ a few times.. Sometimes I get
delusional and start thinking I wrote it myself :-)

Yes, ‘some balance’ .. which is what I meant when I wrote ‘not ALWAYS
better’..

Here's some of the ‘balance’.. there's lots of it: 

’You might object that you can't possibly learn all these commands
- there are hundreds of different movement commands, some simple, some
very clever - and it would take weeks of training to learn them all.
WELL, YOU DON'T NEED TO; instead realize what your specific way of
editing is, and LEARN ONLY THOSE COMMANDS THAT MAKE YOUR EDITING MORE
EFFECTIVE.’

More to the point, just after the ‘stone age’ bit..

‘DON'T OVERDO IT. If you always try to find the perfect command for
every little thing you do, YOUR MIND WILL HAVE NO TIME LEFT TO THINK
ABOUT THE WORK YOU WERE ACTUALLY DOING. Just pick out those actions that
take more time than necessary, and train the commands until you don't
need to think about it when using them. THEN YOU CAN CONCENTRATE ON THE
TEXT.’

And how about:

’YOU SHOULD NOT TRY TO LEARN EVERY COMMAND AN EDITOR OFFERS.  That would
be a complete waste of time. Most people only need to learn 10  to 20
percent of the commands for their work. BUT IT'S A DIFFERENT SET OF
COMMANDS FOR EVERYBODY.’

And then there's the bigger picture:

’One last remark to remind you of what happens when people ignore all
the above:  I still see people who spend half their day behind a VDU
looking up at  their screen, then down at two fingers, then up at the
screen, etc. - and  then wonder why they get so tired... Type with ten
fingers! It's not just faster,  it also is much less tiresome. Using
a computer program for one hour each day, IT ONLY TAKES A COUPLE OF
WEEKS TO LEARN TO TOUCH-TYPE.’

I'm a bit skeptical about this last one... the time frame, I mean.. I've
been working at it for about five years now, and I'm just  beginning to
reach the point where I can type anything automatically and with no
overhead.. as when I am writing with a pen on a piece of paper.

Anyway, thank you for your comments.. let me get back to sharpening my
saw.

cj

Note: the caps in the quoted passages are obviously mine.. Not yelling,
just hilighting. 

-- 
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: right align in block

2011-02-07 Thread Chris Jones
On Mon, Feb 07, 2011 at 10:23:19AM EST, rameo wrote:

 Let say I have these dates:
 
 Variable 1 - 21.185 Variable a - 22.345
 Variable 2 - 1.401.218Variable b -   1.821
 Variable 3 - apples Variable c - 17.643
 Variable 4 - water   Variable d - 56.030
 Variable 5 - 656.647   Variable e - 65.123
 Variable 6 - 92.200 Variable f -   2.000
 
 I would like to select the 2nd column (21.185 to 92.200) and right
 align all the info in the block
 
 I use this to left align the data in a block:
 :C-U','s/\%V\(\s*\)\(.\{-}\)\%(\%V\@!\\|$\)/\2\1/
 
 How do I right align the data in a block?

 I tried to switch the space block with the text block in the code but
 something doesn't work.

’Some people, when confronted with a problem, think ’’I know, I'll
use regular expressions.’’ Now they have two problems.’ -- JMZ

Unless you absolutely insist on getting cross-eyed and ‘Mastering
Regular Expressions’... like the book sez, you could also try the awk
approach:

| awk '{printf %-10s %s %s %10s %-10s\n,$1,$2,$3,$4,$5}' .. etc.

Untested, but some variation or other, possibly used as a Vim ‘!!’
filter should get you there quicker..  while remaining _legible_.

;-)

Not what you asked, but since nobody stepped up to the plate..

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: Reflowing paragraph text.

2011-02-07 Thread Chris Jones
On Mon, Feb 07, 2011 at 05:00:41PM EST, Ben Schmidt wrote:
 Also you can use gqap to format current complete paragraph.

 Or gqip which I find easier to type as I don't have to use the same
 finger twice in a row. :-)

I favor ‘gwap’ because the cursor stays put. And the ‘w’ is easier on my
fingers than the ‘q’ anyway. :-)

As to the OP, if he is a keypress miser like me.. he might consider
living with the mess for a while.. and visually select said mess when it
becomes unbearable and ‘gw’.

But this requires discipline with one's own stuff, and especially where
e-mails are concerned, he could be in for some suprises unless he takes
care to clean up quoted material first..

S.. he should use ‘gwap’ like me.. natural as a drum roll.. :-)

Could even map it to, say.. a quick ‘ff’ (as in formatformat) if it's
really too much trouble: 

| noremap ff gwap

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: right align in block

2011-02-07 Thread Chris Jones
On Mon, Feb 07, 2011 at 05:50:16PM EST, Roy Fulbright wrote:

 Mastering Regular Expressions (Second Edition), by Jeffrey F. F.
 Friedl  ISBN: 0-596-00289-0 You should check to see if there is a more
 recent edition. Great book!

As much as I dislike regex's.. I fully agree.. 

Which does not absolve your top-posting.. btw.. goes AGAINST THE LIST'S
POLICY, you know.. :-)

And incidentally, caused me write this reply twice, because I couldn't
see your contribution the first time around. Thought I was replying to
the wrong message.. and mutt being mutt.. well.. I had to hit :q! to
go take a closer look. 

[..]

   ’Some people, when confronted with a problem, think ’’I know, I'll
   use regular expressions.’’ Now they have two problems.’ -- JMZ
  
  :D
  
   Unless you absolutely insist on getting cross-eyed and ‘Mastering
   Regular Expressions’... like the book sez
  ^^^
  What's that for a book? I googled but cannot find it.

Are you being facetious, huh..? OK, sorry.. _I_ was being facetious.. 

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: Typing numbers

2011-02-07 Thread Chris Jones
On Mon, Feb 07, 2011 at 05:08:36AM EST, Dotan Cohen wrote:
 Here's a closeup photo of the cutting of the silicon domes.

Hello Dotan,

Thanks much for this pic and the other. Till I saw it I honestly had no
clue what you meant.. I thought there was something like a rubber nipple
in there and you were shaving off part of the top of said nipple.. :-)

In any case, I appreciate your Cc:'ing me to make sure I at least would
get to see the pics.. very interesting.

As to you folks not being the conventional type.. down to the kids and
the entire household, etc.. quite refreshing.. it is depressing at times
to spend many hours on IT mailing lists, read millions of posts and not
one thinks outside the box..

Thanks again for your time.

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: right align in block

2011-02-07 Thread Chris Jones
On Mon, Feb 07, 2011 at 09:27:06PM EST, Roy Fulbright wrote:

[..]

 Sorry about the top post. It's my email's default and it's so easy to
 forget. I will be more diligent in the future. :-(
   

Doesn't bother me all that much.. sometimes I forget to top-post when in
a different context.. where emails with quoted material can become
rather lengthy.. and then I folks complaint they got an ‘empty’ reply
from me As they say, when in Rome..

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: Start/Stop Cursor Colors

2011-02-16 Thread Chris Jones
On Tue, Feb 15, 2011 at 08:15:00PM EST, pansz wrote:
 On Wed, Feb 16, 2011 at 2:52 AM, Andy Leak akl...@gmail.com wrote:

  Can you configure Vim to send an escape sequence to the terminal when it
  starts and stops?

 You should ask Can I, instead of Can you.

Hmm.. ‘can you’ here means ‘can one’.. but if Andy wrote ‘can one’..
you'd say ‘can too’... because toucans too can..

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: How to move to beginning of command line

2011-02-16 Thread Chris Jones
On Wed, Feb 16, 2011 at 01:04:15PM EST, Jeremy wrote:

 When typing a command, (i.e., su/.../.../) how can I jump around on the 
 command line without using the arrow keys.  That is, how can I jump to the 
 beginning, or the end, or move backward/forward?  In a terminal, I can just 
 use the CTRL-A and CTRL-E to go to the beginning and end of the command.  Is 
 there something similar in Vim?

These mappings emulate the key combos I use most frequently in
bash/readline's emacs mode::

  cnoremap  C-O   C-D
  cnoremap  C-D   Del
  cnoremap  C-A   Home
  cnoremap  C-B   Left
  cnoremap  C-E   End
  cnoremap  C-F   Right
  cnoremap  C-N   Down
  cnoremap  C-P   Up
  cnoremap  Escb  S-Left
  cnoremap  Escf  S-Right

In order to make CTRL-D reproduce bash's behavior (delete the character
before the cursor), I first had to remap it to CTRL-O so that the
original functionality (pattern matching) remains available.

I use pattern matching extensively to find what I'm looking for in Vim's
help system and I find it much more practical than ‘wildmenu’.

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: OT: Vim Humans are...

2011-02-17 Thread Chris Jones
On Thu, Feb 17, 2011 at 01:43:42PM EST, meino.cra...@gmx.de wrote:

[..]

 Is there a kind of vim psychology??? ;)
 
 I am interested in answers as I am interested in questions... :)

I don't recall making a choice, but if I did, it was likely dictated by
such considerations as the portability of vi across UNIX systems. 

I must say that at first I was not too fond of continually having to hit
‘i’ to switch to insert mode and the Escape key to return to normal
mode. Felt like a lot of unnecessary extra work.. But I was young and
foolish so I stuck with it and kept Notepadding my Vim and cussing every
time I forgot to hit the Escape key. 

It took a couple of years before I began to understand the cleverness of
Vim's design. Having a default ‘normal’ mode where hundreds of editing
commands only require pressing a couple of keys one at a time with *no
modifiers involved* was a stroke of genius.. in this perspective, the
minimal overhead caused by mode-switching is a very small price to pay. 

As to a ‘Vim psychology’.. I don't know..  maybe.. same as programmers,
it might boil down to ‘laziness, impatience, and hubris’.

:-)

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: Using no hard line breaks

2011-02-20 Thread Chris Jones
On Sun, Feb 20, 2011 at 08:31:02AM EST, Sebastian Humenda wrote:
 Tim Chase v...@tim.thechases.com wrote on Sun, Feb 20, 2011 at 07:24:01AM 
 -0600:
 On 02/20/2011 07:12 AM, Sebastian Humenda wrote:

  :h 'linebreak' and
  :h 'breakat'

  With the correct key words (now), I found

  http://vim.wikia.com/wiki/Word_wrap_without_line_breaks

  Which essentially works, but I thought one could then threat the lines
  as logical lines withj  andk.

  I've seen many folks remap j and k (or up and down) to their
  screen-line motions gj and gk which will move as you expect.
  That leaves the other pair (if you remap j/k then up/down, or
  vice-versa) for traversing physical lines.
 
   :nnoremap down gj
   :nnoremap up gk

 That's great, many thanks!

Since in my case flowed long lines are the exception, I use the
following mapping:

  :map Escj gj
  :map Esck gk (¹)

If I have a long line that spans half a dozen or more screen lines for
instance, I find it a lot easier to depress the left Alt key with my
left thumb and hit j/k repeatedly (or even keep them depressed) to move
around than using the standard ‘gq’ and ‘gq’.

It's also more mnemonic where I'm concerned.. I never manage to remember
gj/gk.. ;-)

cj

¹ The mapping I use in XTerm+GNU/screen+Vim.. Not sure about other
  environments.

-- 
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: Using no hard line breaks

2011-02-21 Thread Chris Jones
On Mon, Feb 21, 2011 at 03:57:17AM EST, Erik Christiansen wrote:
 On Sun, Feb 20, 2011 at 02:37:33PM -0500, Chris Jones wrote:

[..]

 Bt, I don't understand how Esc becomes alt/meta, and my vim
 needs:

:map M-j gj
 
 to gain the described benefit.

I vaguely remember having problems with M- mappings at one point and
discovered that Esc worked.

Too busy to look into it and for consistency's sake continued using the
latter syntax.

Time I revisited and straightened this out.. ;-)

Thanks,

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: vim-orgmode

2012-02-06 Thread Chris Jones
On Mon, Feb 06, 2012 at 01:40:33PM EST, Jan Christoph Ebersbach wrote:
 Hi Stephan,
 
  The other course of action would be to complain to the orgmode-author
  that his mappings are not compatible with all vim versions. Also,
  mappings that use the shift and control key a lot are really not
  something you should use in vim. Actually it reminds me more of this...
  other... editor.
 
 It's true, S-CR can not be used in the command-line version of vim.
 I haven't found a good replacement for it, yet. If you need to use vim
 on the command-line I recommend mapping the functionality to another
 key.

In X11, a simple workaround (regardless of the terminal emulator) is to
map Shift+Enter to a character that is not bound to a Vim command by
default, via xmodmap:

| $ xmodmap -e keysym Return = Return currency¹

You can check at the bash prompt that hitting Shift+Enter now
generates ‘¤’, not ‘
’.

Then map the ‘currency’ character to S-CR in Vim:

| :map ¤ S-CR²

If your plugin's custom mapping is something like,

| :map S-CR :echo 'Hello Shift Enter'

hitting Shift+Enter should cause Hello Shift Enter to be displayed
at the bottom of your Vim screen.

I used the '¤' currency symbol for the sake of example, hoping both your
locale and font will display the above correctly.

Another example:

| $ xmodmap -e keysym Return = Return eacute
| :map é S-CR²
| :map S-CR :echo 'Hello Shift Enter'

CJ

¹ or keyboard remapping options of popular desktops?

² CTRL+K Cu - ¤ .. CTRL+K 'e - é .. etc.

-- 
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: Using vim as a syntax highlighter

2012-03-16 Thread Chris Jones
On Mon, Mar 12, 2012 at 12:28:58AM EDT, Gary Johnson wrote:

[..]

 Use the -E and -s options, e.g.,
 
 vim -E -s -n $1 -cTOhtml -cw! $2 -cq! -cq!
 
 See
 
 :help -E

I've been using Vim daily for a few years, but I'd never even heard of
an ‘extended Ex-mode’ :-)  

So I issued the above ‘:help -E’ command, which did not tell me much,
and proceeded to drill down to ‘*gQ’.. and I found this:

gQSwitch to Ex mode like with Q, but really behave
  like typing : commands after another.  All command
  line editing, completion etc. is available.
  Use the :vi command |:visual| to exit Ex mode.
  {not in Vi}

What does ‘really behave like typing : commands after another’ exactly
mean..? another what? Did the writer mean ‘typing : commands one after
the other’ ?? What did he have in mind when he wrote ‘*really* behave..?
‘really’.. as opposed to what..? Virtually..?

Failing to understand the documentation, I decided to give this extended
Ex-mode a go.. and all I could see was the same exact message as when
you enter regular Ex-mode via the ‘Q’ command: ‘Entering Ex mode. Type
visual to go to Normal mode..’ 

What additional features or functionality does this mode provide..? how
does it differ from regular Ex-mode..?

Is this extended Ex-mode described anywhere else in the help files, and
if so why is it not referenced by a link in the ‘*gQ’ article?

Please clarify.

CJ

-- 

AHH! The neurotic monkeys are after me!

-- 
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: Using vim as a syntax highlighter

2012-03-19 Thread Chris Jones
On Sat, Mar 17, 2012 at 02:23:09AM EDT, Dominique Pellé wrote:
 Chris Jones  wrote:

[..]

 Completion only works with -E. Examples:
 
   # this does not complete when using -e:
   $ vim -NONE -e
   :hiC-D
 
   # this completes successfully with -E
   $ vim -NONE -E
   :hiC-D

Ah, yes.. just tested it. 

Not sure why one would need two different modes for that - rather than
having completion work in plain Ex-mode to begin with - i.e. when you
type ‘Q’ rather than ‘gQ’.

 Keys for command line editing described in :help cmdline-editing
 also only work with vim -u NONE -E. Examples:
 
 - moving by words with C-Left or C-Right
 - C-W to delete previous word
 - etc.

Same..

 To clarify the doc, how about adding the links to |cmdline-editing|
 and |cmdline-completion| in the description of :help gQ as in
 attached patch?

Well I don't fancy myself as an expert on the English language, far from
it.. :-( but where I'm concerned, ‘really behave like typing : after
another’ strikes me as something a native speaker of English would never
write/pronounce. Isn't it ungrammatical..?

Shouldn't ‘another’ introduces a noun or pronoun..?

As it stands, I'm still not sure what the author means.

Well, no big deal anyway, and I'm certainly not going to make an issue
of it, especially since I rarely (if ever) use any of the two modes.

Thanks,

CJ
-- 

Have a nice day!

-- 
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: How to search in digraphs?

2012-04-10 Thread Chris Jones
On Tue, Apr 10, 2012 at 03:41:02PM EDT, Peng Yu wrote:
 Hi,

 I have a hard time to find the symbol that I need in :diagraph. Is
 there a table that better organize the symbols? In particular, I want
 to type in $\times$. Could anybody let me know what is the shortcut?

RFC1345 is another option, with better coverage than Vim's digraph-table.

CJ

-- 
ALL YOUR BASE ARE BELONG TO US!

-- 
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: How to search in digraphs?

2012-04-11 Thread Chris Jones
On Wed, Apr 11, 2012 at 02:26:03PM EDT, Boyko Bantchev wrote:

  I have a hard time to find the symbol that I need in :diagraph. Is
  there a table that better organize the symbols? In particular, I want
  to type in $\times$. Could anybody let me know what is the shortcut?
 
 rfc1345 is worth checking at times, but its digraph set is different
 from Vim's, 

In Vim 7.2's help:

:h digraphs-default

| ‘These default digraphs are taken from the RFC1345 mnemonics 
| [...] Exception: RFC1345 doesn't specify the euro sign.’

And the way things are going, that ‘euro exception’ shouldn't be
relevant for much longer anyway.. :-)

Of course there are ‘variable length’ mnemonics (trigraphs mostly) in
rfc1345 that are not supported by Vim, but in my experience the digraphs
are exactly the same.

I guess you could write a script to compare the output of the :digraphs
command with the table in rfc1345.

 and that document does not display the characters themselves.

Well.. if you don't know the digraph, it's not going to be possible to
search for it anyway.. It makes more sense to do a search on the ISO
10646 long descriptive name (3rd column of rfc1345). e.g. you need an
arrow and you do a ‘/arrow’.. a star symbol.. ‘/star’ etc.

If you need to see the glyphs, for instance to check that it's covered
by your font, it's not too hard to do a lookup of the hex code points in
column 2 of the rfc1345 table and generate an extra glyph/char column.

 digraph.txt or, more specifically, :help digraph-table only show part
 of the available digraphs (less than a half, I think).

About 10%. It only covers the 00-FF range.

 I don't know of a best option than using the :digraphs command. You
 can find there all available digraphs, and it is immediately seen
 which of the respective characters are correctly displayed on your
 system.  For more convenient browsing of the table, redirect the
 output of :digraphs and read it in Vim as normal text.

I was getting cross-eyed trying to find what I was looking for in the
output of the :digraphs command, so I converted rfc1345 to a local vim
help file and added the correponding glyphs via a five-line script that
looked them up in the python ‘unicodedata’ module.

If you have any use for it, drop me a line off-list and I'll send you
a copy.¹

CJ

¹ Come to think of it, s/o who's familiar with Vim developement might
  use it as the basis of a patch that would provide a digraph-table in
  sync' with the ouput of the ‘:digraphs’ command on unicode-capable
  systems.

-- 
Oh My God!!! Larry is back!

-- 
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: How to search in digraphs?

2012-04-11 Thread Chris Jones
On Wed, Apr 11, 2012 at 04:00:27PM EDT, Christian Brabandt wrote:
 Hi Boyko!
 
 On Mi, 11 Apr 2012, Boyko Bantchev wrote:

[..]

  digraph.txt or, more specifically, :help digraph-table only show part
  of the available digraphs (less than a half, I think).

[..]

 That is not true. Since 7.3.116 digraph.txt contains all digraphs 
 available.

Hehe.. now everyone knows I (among others) am not current..

Now I can trash my local rfc1345 vim page..

CJ
-- 
HOW ARE YOU GENTLEMEN?

-- 
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: How to search in digraphs?

2012-04-11 Thread Chris Jones
On Wed, Apr 11, 2012 at 04:00:27PM EDT, Christian Brabandt wrote:

[..]

 That is not true. Since 7.3.116 digraph.txt contains all digraphs 
 available.

Is there a format of the ‘:digraphs’ command that lets you list only
custom user-defined digraphs - i.e. those that are different from the
defaults..?

Couldn't find such a thing in Vim 7.2.. 

If there isn't, something like ‘:dig!’ would be nice..

Depending on screen size, in a UTF-8 locale I may have to hit the space
bar three or four times to reach the end of the listing and if I hit it
once too many, I have to start over.

CJ

-- 

Hi! My name is bobby...

-- 
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: How to search in digraphs?

2012-04-12 Thread Chris Jones
On Thu, Apr 12, 2012 at 02:13:32AM EDT, Boyko Bantchev wrote:

 The Euro sign is not the only difference between rfc1345 and the
 output of :digraphs.  

It's the only exception listed in the documentation.

 I cannot tell what all of them are, but, e.g., the already mentioned
 /\ is known to Vim but is not in the rfc. Perhaps, as well, Vim misses
 some definitions that the rfc has.

The standard mnemonic for ‘×’ is ‘*X’. I have no idea where the ‘/\’
came into the picture, but it looks like some non-standard Vim-ism that
may be there for historical reasons. After all when you run the :dig
command, it's listed with a bunch of others out of code point sequence
right near the end of the listing while the ‘*X’ rfc1345 mnemonic is
listed near the beginning where it belongs, between code point ‘214’ and
‘216’. Seems to be the same for the other mnemonics that appear right at
the end of the listing such as ‘11’ - ‘¹’...‘22’ - ‘²’... 

My guess is that they predate the RFC (or rather the integration of the
RFC's mnemonics to Vim) and were kept as aliases so that users who had
grown accustomed to them wouldn't have to add them back manually.

CJ

-- 
Oh My God!!! Larry is back!

-- 
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: How to search in digraphs?

2012-04-12 Thread Chris Jones
On Thu, Apr 12, 2012 at 05:03:52PM EDT, Christian Brabandt wrote:
 Bram,
 
 On Mi, 11 Apr 2012, Chris Jones wrote:
 
  Is there a format of the ‘:digraphs’ command that lets you list only
  custom user-defined digraphs - i.e. those that are different from the
  defaults..?

  Couldn't find such a thing in Vim 7.2.. 
  
  If there isn't, something like ‘:dig!’ would be nice..
 
 Here is a patch, that makes :dig! display only user-defined digraphs and
 :dig! xy remove the digraph, that is defined by the chars xy
 
 This sounds like a useful addition.

Not sure if/when I'll be able to test it since I'm on debian and I don't
have a vim source environment set up. 

Shouldn't there be a patch against the digraph.txt help file as well..
or does that work differently..?

CJ

-- 
SOMEBODY SET UP US THE BOMB

-- 
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: How to search in digraphs?

2012-04-14 Thread Chris Jones
On Sat, Apr 14, 2012 at 08:42:00AM EDT, Bram Moolenaar wrote:
 
 Christian Brabandt wrote:
 
  On Fr, 13 Apr 2012, Bram Moolenaar wrote:
  
   Can we use another command to list user-defined digraphs?  Perhaps
   :dig ??
   
   This patch would also need documentation.  And a test would be good too.
  
  Updated patch.
  The patch introduces the following changes:
  1) :dig?print only user-defined digraphs
  2) :dig? char1[char2]   print an exact match, if 2 chars are given,
  else print all digraphs matching char1
  3) :dig? Number print digraph for decimal value Number
  4) :dig!clear all user-defined digraphs
  5) :dig! char1char2 clear user-defined digraph char1char2
  6) documentation update
  7) including a test (test85)
 
 Thanks for the quick update.
 
 We don't use ? like this in any command, but somehow it feels right. Or
 would there be something better?
 
 :dig ? Number is OK, but this looks like it only works for user
 digraps.  I suppose leaving out the ? has the problem that it would look
 like defining a digraph, although :dig 12 currently gives an error.
 So perhaps we can use that.

So I noticed as well.. I think I was the one who originally mentioned
‘:dig!’ to list user-defined digraphs (without giving it much thought..
it was mostly for the sake of example..) and I may have had the way
‘:map’ vs. ‘:map!’.. in a mathematical sense, listing two different
subsets:

What I probably had in my mind was something along the lines of ‘:dig’
- default digraphs vs. ‘:dig!’ - custom digraphs.

Personally, I can't say I'm crazy about usin ‘?’ after a command because
it breaks syntax consistency, one of Vim's strong points, I think..

The same goes for using ‘!’ to clear/delete custom digraphs.

CJ

-- 
WE GET SIGNAL

-- 
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: How to search in digraphs?

2012-04-14 Thread Chris Jones
On Sat, Apr 14, 2012 at 08:48:54AM EDT, Tim Chase wrote:
 On 04/14/12 07:42, Bram Moolenaar wrote:
 We don't use ? like this in any command, but somehow it feels right.
 
 I think it feels right because of the :set foo? syntax which is the
 tell me this setting, even if it's boolean.  I like it.

As to syntax consistency, rather an argument to the contrary, in fact..
since they are very different beasts: ‘foo’ is an 'option' while ‘:dig’
is a command. 

CJ

-- 
SOMEBODY SET UP US THE BOMB

-- 
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: How to map ctrl-space in maemo's vim

2012-04-15 Thread Chris Jones
On Sun, Apr 15, 2012 at 09:47:11AM EDT, Yue Wu wrote:

 I'm using vim on maemo, which is a OS for nokia's n900 smartphone.
 
 I'm trying to map ctrl-space to a function, but nmap ctrl-space
 :call Myfunc()CR does nothing. When I hit C-vctrl-space in
 insert mode, vim inputs ^@, so I also tried with nmap ^@ :call
 Myfunc()CR, but still not work, what should I do?

Try:

  :map C-@ :call Myfunc()CR

CJ

-- 
WHAT YOU SAY??

-- 
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: How to map ctrl-space in maemo's vim

2012-04-15 Thread Chris Jones
On Sun, Apr 15, 2012 at 07:50:38PM EDT, Yue Wu wrote:
 On Mon, 16 Apr 2012 05:26:01 +0800, Chris Jones cjns1...@gmail.com wrote:
 
 On Sun, Apr 15, 2012 at 09:47:11AM EDT, Yue Wu wrote:

  I'm using vim on maemo, which is a OS for nokia's n900 smartphone.
 
  I'm trying to map ctrl-space to a function, but nmap ctrl-space
  :call Myfunc()CR does nothing. When I hit C-vctrl-space in
  insert mode, vim inputs ^@, so I also tried with nmap ^@ :call
  Myfunc()CR, but still not work, what should I do?
 
  Try:
 
   :map C-@ :call Myfunc()CR
 
  CJ
 
 
 Thank you, it works fine :)

The only caveat being that I can only hope it doesn't break anything in
your setup. I use Ctrl-Space to switch desktops, so in my case, Vim
never gets to see it.

| :h keycodes
| :h index
| :h map-special-chars
| :h map-which-keys

CJ

-- 
Have a nice day!

-- 
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: How to map ctrl-space in maemo's vim

2012-04-16 Thread Chris Jones
On Mon, Apr 16, 2012 at 03:48:49AM EDT, Yue Wu wrote:
 On Mon, 16 Apr 2012 08:51:06 +0800, Chris Jones cjns1...@gmail.com wrote:
 
 On Sun, Apr 15, 2012 at 07:50:38PM EDT, Yue Wu wrote:

[..]

 Maemo doesn't use ctrl-space to switch desktops :) Can it?

I don't run Maemo.. just GNU/linux.. so you're probably in a better
position to figure that out ;-)

I didn't even know Maemo ran on systems that actually have a keyboard..
never mind a control key..!

The reason I mentioned it was to let you know that I have no direct
experience of mapping C-Space in Vim.. and what to expect.. amounts to
a disclaimer along the lines of: I entirely decline any responsibility,
should anything bad happen.. etc. Routine, really.. because I'd be quite
surprised if this particular mapping broke anything.

CJ

-- 
AHH! The neurotic monkeys are after me!

-- 
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: cmap to use a substitute command

2012-04-20 Thread Chris Jones
On Fri, Apr 20, 2012 at 04:47:04PM EDT, Ben Fritz wrote:
 On Friday, April 20, 2012 2:07:24 PM UTC-5, Andy Wokula wrote:

  
   :h getcmdline()
   :h c_CTRL-\_e

 Awesome, I didn't know about c_CTRL-\_e, I was wondering why there
 wasn't a setcmdline() function. Now I know! That functionality is
 elsewhere.

Rather than changing one's working habits and resorting to a cmap'd key
combo, is there any way I could transparently cause a custom function to
be invoked, say.. each time I enter a ‘:!...’ command (or even any Ex
command) so that I could inspect the content of the command and fiddle
with it in certain cases.

I have not looked into it, but I'm thinking of doing :cabbrev's on
either ‘!’ or the final CR .. but this looks s ugly to start off
with that I'm a little reluctant to go down that road without making
sure that there is not a clean/standard Vim solution that I missed.

The context is that I am revisiting this iFAQ where once in a while
a *nix user complains that bash aliases and functions are not available
when invoking the shell via ‘:!’.. I have come to the conclusion that
the $BASH_ENV hack is not satisfactory. 

Not sure if I'm hijacking this thread.. If so, please let me know and
I'll open a separate ticket.

Thanks,

CJ

-- 
ALL YOUR BASE ARE BELONG TO US!

-- 
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: cmap to use a substitute command

2012-04-20 Thread Chris Jones
addendum.. more likely ‘!’ or CR cmap's than :cabbrev's..

CJ

-- 
ALL YOUR BASE ARE BELONG TO US!

-- 
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


Syntax highlighting...

2012-04-22 Thread Chris Jones
I have a few hundred text files, mostly documentation, and all of them
basically have the following structure:

| 1. first section
| ...
| 2. second section
| ...
| etc..

I would like to have Vim automatically create folds so that I could use
the usual ‘z’ commands to easily collapse ‘first’, ‘second’.. above, for
a quick overview of the contents..

Any way I can do this using Vim's native folding capabilities..? 

CJ

P.S. I'm NOT interested in outliner plugins, writing a parser and even
less spending the next couple of weeks manually adding markers to all
these files. :-)

-- 
HOW ARE YOU GENTLEMEN?

-- 
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: foldmethod=syntax

2012-04-22 Thread Chris Jones
On Sun, Apr 22, 2012 at 07:47:19AM EDT, Christian Brabandt wrote:

 Hi Chris!

Hallo Christian, wie geht's..?

 On So, 22 Apr 2012, Chris Jones wrote:

  I have a few hundred text files, mostly documentation, and all of
  them basically have the following structure:

  
  | 1. first section
  | ...
  | 2. second section
  | ...
  | etc..

  I would like to have Vim automatically create folds so that I could
  use the usual ‘z’ commands to easily collapse ‘first’, ‘second’..
  above, for a quick overview of the contents..

 set fdm=expr fde=getline(v:lnum)=~'^\\d\\+.*section$'?'1':'='

It was getting really late last night and so I thought I'd figure out
a more relevant ‘Subject:’ later.. and forgot to change it.. :-(

Initially, I was planning on using fdm=syntax rather than fdm=expr for
the sake of scalability, in case I needed to add stuff later: the sample
above is a slightly simplified version as there are for instance nested
levels in some of the actual files: 1.1 subsection.. 1.2.. etc. as well
as some lists where items are prepended with a dash/asterisk/dot..

The difficulty with fdm=syntax is that there is no explicit ‘end of
section marker’ in my free-form, but nonetheless fairly ‘standard’ files
and as often with Vim, it looks like folding was mostly designed to work
with stuff like C code in mind.. Here, unfortunagely, the end of the
current section is also the start of the next one.

I tried playing with the rs=/re= feature (:h syn-pattern) to no avail.

But I think I have already spent a lot more time with this than
I intended without getting anywhere.. and so a simple fde that only
handles top-level folds would be absolutely fine.

Now, as to the fold expression you suggest:

. I'm not sure I understand why I need a getline(), since ‘:h fde’
  states that the expression ‘is evaluated for each line to obtain its
  fold level’. I thought this meant that Vim would take care of the
  matching against the entire file?

. Just for the record, the ‘section’ literal was only meant for
  clarification (?) but I shouldn't have any problem changing that bit
  to match just the leading digit(s) followed by a dot - ‘^\s\+\.’, e.g.
  and hopefully, it won't match elsewhere in the files.

I won't have the time to take the regex apart  test it until later
tonight and find out why it's not matching anything against my sample
file, even when I use it as a search pattern from the command line,
magic or nomagic.. Could the double backslashes have something to do
with it..?

Thanks,

CJ

-- 
WHAT YOU SAY??

-- 
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: gvim auto copy selected text to clipboard

2012-04-22 Thread Chris Jones
On Sun, Apr 22, 2012 at 02:11:47PM EDT, Gary Johnson wrote:

[..

  If you add both of them (i.e. unnamed and unnamedplus)  you will get
  what you want as I already pointed.

 I thought I also tried that when you first posted it.  

 I thought I set both, yanked text from one vim instance with 'Y', then
 tried [..]

Hello Gary,

That's a lot of ‘thinking’, don't you think..: no offense meant.. :-)

The ‘:registers’ command is the healthier methodology when monitoring
cut's, copy's  paste's.

Whatever I do, mouse or nomouse, keyboard, joystick... -) .. the ‘:reg’
command lets me see exactly what is going on.. And if I'm not sure I get
to :reg a second time, even a third time for free.. 

I used to have problems with the different copypaste scenarios, but now
that I use ‘:reg’ on a regular basis, I always seem to end up with the
copied stuff available somewhere or other.

Seeing is believing.

CJ

-- 
WHAT YOU SAY??

-- 
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: foldmethod=syntax

2012-04-23 Thread Chris Jones
On Sun, Apr 22, 2012 at 12:44:56PM EDT, Benjamin R. Haskell wrote:
 On Sun, 22 Apr 2012, Chris Jones wrote:

[..]

 The difficulty with fdm=syntax is that there is no explicit ‘end of
 section marker’ in my free-form, but nonetheless fairly ‘standard’
 files and as often with Vim, it looks like folding was mostly
 designed to work with stuff like C code in mind.. Here,
 unfortunagely, the end of the current section is also the start of
 the next one.

 
 I'm not positive, but this might be a case for keepend.
 
 See: :help :syn-keepend

I've read that bit (again).. and still not sure what it means. Seems to
be more about nesting folds/blocks with different start/end markers.

[..]

 . I'm not sure I understand why I need a getline(), since ‘:h fde’
 states that the expression ‘is evaluated for each line to obtain
 its fold level’. I thought this meant that Vim would take care of
 the matching against the entire file?
 
 'fde' is only set up with the v:lnum variable (which tells the
 function what line it's being evaluated for).  getline() gets the
 content of the line.

And there are examples under ‘:h fold-expr’ to illustrate.. no excuse.

 The doubled backslashes are a side-effect of the way ':set' is
 evaluated.  For anything where the quoting gets messy, I always tend
 to use ':let-' instead.  Or, better yet, a function.

Same.. 

 So, in this case, Christian's example might become:
 
 fun! FoldSimpleText()
   return getline(v:lnum) =~ '^\d\+.*section$' ? '1' : '='
 endf
 setl fdm=expr fde=FoldSimpleText()
 
 If you have subsections, this can be improved to:
 
 fun! FoldSimpleText()
extract the section header
   let section_match = matchlist(getline(v:lnum), '^\s*\(\%(\d\+\.\)\+\)')
   if !len(section_match)
 return '='
   end
start a fold with the count of the '.'s in the section header
   return ''.len(filter(split(section_match[1], '\zs'), 'v:val == .'))
 endf
 setl fdm=expr fde=FoldSimpleText()

Writing code was what I was trying to avoid... but considering my lack
of knowledge of what Vim does behind the scenes when processing syntax
files, it looks like the only sensible approach.

Thanks,

CJ

-- 
WE GET SIGNAL

-- 
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: gvim auto copy selected text to clipboard

2012-04-23 Thread Chris Jones
On Mon, Apr 23, 2012 at 02:57:58AM EDT, Gary Johnson wrote:
 On 2012-04-22, Chris Jones wrote:
  On Sun, Apr 22, 2012 at 02:11:47PM EDT, Gary Johnson wrote:

[..]

 What are you, my English teacher?  It's probably a defensive habit to
 give myself wiggle room.  (Note the careful use of probably instead
 of think.)  You want to be my shrink, too?  No offense taken.  And
 none intended, honestly.

:-)

Forgive me... was in a ‘funny’ mood last night.. pixilated, perhaps..

  The ‘:registers’ command is the healthier methodology when
  monitoring cut's, copy's  paste's.

 Good idea.  With that, I did some experimentation.

That was supposed to be the useful part.

The idea being that part of the problem is often in the mind, rather
than actual facts. I'm not claiming that once I started using the :reg
command to check the contents of Vim's registers on a regular basis all
the problems just went away, but at least those problems that remained
were genuine, not something I was making up.

 Case 1:
 clipboard=unnamedplus,unnamed,autoselect,exclude:cons\|linux
 
 Copy text from a GNOME Terminal by dragging the mouse over it
 with the left button held down.
 
 :registers shows selected text in the * register.  The
 contents of the + and  registers are unchanged from before the
 copy operation.
 
 :put pastes the contents of the + register, not what I wanted.
 
 Case 2:
 clipboard=unnamed,unnamedplus,autoselect,exclude:cons\|linux
 
 Copy text from a GNOME Terminal as before.  :registers shows
 the same results as before, as expected.
 
 :put again pastes the contents of the + register.
 
 Case 3:
 clipboard=unnamed,autoselect,exclude:cons\|linux
 
 Copy text from a GNOME Terminal as before.  :registers shows
 the same results as before, as expected.
 
 :put now pastes the contents of the * register.

I'm still running Vim 7.2, so I have not had the opportunity to use
unnamedplus as yet. My experience is limited to Case 3.

 So it appears that the only way to paste from the * register without
 explicitly naming it is to exclude unnamedplus from the 'clipboard',
 and that means that unnamed yanks from Vim go only to the * register
 and not the + register, which then means that Ctrl-V in Firefox won't
 paste that yanked text.  That's really fine with me since I paste into
 X applications other than Vim with the middle mouse button, not
 Ctrl-V, but it's not what the OP wanted.

That's also what I am seeing (Case 3). But I run Vim under GNU/screen
which I have customized to write to what Vim sees as the + register,
X11's PRIMARY selection, IIRC.

From a more general perspective, the OP could use the ‘autocutsel’
program that keeps X11's clipboard  primary selection in sync'.

 By naming registers, you can copy and paste any way you like in Vim,
 but I don't see a way to copy from Vim to another X application, or
 from another X application to Vim, without having to know about both
 the + and * registers.  It would be nice if there was some way to
 avoid all that thinking.

Another approach would be to figure out if there's any way GTK apps can
be made to always use either the clipboard (*) or X11's PRIMARY (+)
rather than a mix of both depending on what copy/paste mechanisme you
are using.

Best,

CJ

-- 
SOMEBODY SET UP US THE BOMB

-- 
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: foldmethod=syntax

2012-04-24 Thread Chris Jones
On Mon, Apr 23, 2012 at 05:12:22PM EDT, Christian Brabandt wrote:
 Hi Chris!
 
 On So, 22 Apr 2012, Chris Jones wrote:
 
  On Sun, Apr 22, 2012 at 07:47:19AM EDT, Christian Brabandt wrote:
  
   Hi Chris!
  
  Hallo Christian, wie geht's..?
 
 Ich bin beeindruckt ;)

Don't.. that's about all the German I can remember ;-)

Since all your posts start with ‘Hi+name+!’ I was beginning to wonder if
you had set up a bot to handle your mail.

[..]

  The difficulty with fdm=syntax is that there is no explicit ‘end of
  section marker’ in my free-form, but nonetheless fairly ‘standard’
  files and as often with Vim, it looks like folding was mostly
  designed to work with stuff like C code in mind.. Here,
  unfortunagely, the end of the current section is also the start of
  the next one.

 The advantage of making an syntax script is, that you get syntax 
 coloring for free, although, this method is probably the most complex 
 one. If you could outline your file structure more explicitly, we can 
 probably design a syntax script for you.

Hmm... I find it much easier writing a script/function even with my
extremely superficial knowledge of Vim's scripting language.

The downside is that when you start scripting everything you'd like to
customize, you quickly end up with heaps of little bits and pieces of
executable code, some of which you don't even remember are there (and
often did not fully understand when you wrote them).. and it becomes
harder and harder to stay on top of things.

These days I tend to always prefer looking first into what I'd call
static customization (I guess you could also call it native) such as
provided in this instance by syntax folding.

The trouble is that syntax folding requires a very good understanding of
the way Vim processes syntax statements. And unfortunately what with the
highlighting  folding being bundled together, I found the doc didn't
help much. And there doesn't seem to be any introductory material in the
form of vimtips  wiki articles available anywhere.

[..]

  Now, as to the fold expression you suggest:
  
  . I'm not sure I understand why I need a getline(), since ‘:h fde’
states that the expression ‘is evaluated for each line to obtain its
fold level’. I thought this meant that Vim would take care of the
matching against the entire file?

 The expression is evaluated for each line. That doesn't mean the
 content of each line is compared with regard to the fold-expression.

Indeed there was nothing wrong with your foldexpr..

[..]

  I won't have the time to take the regex apart  test it until later
  tonight and find out why it's not matching anything against my
  sample file, even when I use it as a search pattern from the command
  line, magic or nomagic.. Could the double backslashes have something
  to do with it..?

 Yes, it's a side effect of using set. This means, the expression is 
 parsed twice and so the backslashes need to be doubled. In general, it 
 is usually better and more readable to use :let-expressions (:h :let-), 
 but this was just a small one-liner. If such an expression get's more 
 complicated, it is also better to make an extra function out of it.

My problem had nothing to with the foldexpre per se... I eventually
found that for some reason, it didn't stick: at some point after
checking everything  I couldn't understand why it didn't work, I did
a ‘:set fde?’ immediately after manually setting it.. and the result was
‘foldexpr=’.. not even ‘foldexpr=0’, which is the usual default when it
isn't set.

Likely caused by remnants of my experiments with fdm=syntax getting in
the way, because everything worked as it should after starting over with
a clean testing environment.

I'm grateful for the help - actually I believe it was you among others
who provided me with an expression that folds Vim's help files
automatically.. a couple years back, IIRC.. so I could have used that as
a starting point if I had chosen to go down the fold expression path.. 

But I'd be a lot more interested in coining a ‘syn region.. fold’
statement that does the same thing, if only to learn something about
syntax folding.

Unfortunately, there are not many syntax files that implement folding
and I can't think of a language (apart from html, maybe) where the end
of a region is implicit - one region ends where another region at the
same foldlevel starts.

Thanks,

CJ

-- 
Hi! My name is bobby...

-- 
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: gvim auto copy selected text to clipboard

2012-04-24 Thread Chris Jones
On Mon, Apr 23, 2012 at 06:07:24PM EDT, Gary Johnson wrote:
 On 2012-04-23, Chris Jones wrote:

[..]

  From a more general perspective, the OP could use the ‘autocutsel’
  program that keeps X11's clipboard  primary selection in sync'.
 
 Inspired by this discussion, I decided to install autocutsel and see
 how that works out.

Did the same but haven't looked into setting it up. Provided the tool
works as I think it does, namely that from the user's perspective it
makes the X clipboard and the PRIMARY selection behave as one, the
question is, do I really want that..? IOW, what are the implications?

It looks as if all the OP wants is X11 to work like Microsoft Windows
with just one single mechanism  clipboard..?

I rather dread revisiting these issues and fiddling with my environment
at this point.. I have about ten pages of notes on the subject that
would likely need to be updated.. I think I'll wait till I upgrade to
7.3 so I'm able to see for myself whether the new clipboard=unnamedplus
option makes any difference.

X was designed by computer scientists.. maybe that's the problem.

CJ

-- 
Hi! My name is bobby...

-- 
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: good 256 color theme for C

2012-04-30 Thread Chris Jones
On Mon, Apr 30, 2012 at 07:18:31AM EDT, Christian Brabandt wrote:
 On Mo, 30 Apr 2012, sinbad wrote:

  Ok, My terminal supports 256 colors, How can i use all the 256 colors
  in VIM in a non gui terminal.
 
 http://vim.wikia.com/wiki/256_colors_in_vim

Provided the OP does NOT read the tip and reads Steven Black's comment
at the bottom of the page instead :-)

CJ

-- 
ALL YOUR BASE ARE BELONG TO US!

-- 
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: good 256 color theme for C

2012-05-02 Thread Chris Jones
On Mon, Apr 30, 2012 at 08:45:51PM EDT, John Beckett wrote:
 Chris Jones wrote:

  Ok, My terminal supports 256 colors, How can i use all the 256
  colors in VIM in a non gui terminal.
 
  http://vim.wikia.com/wiki/256_colors_in_vim
 
  Provided the OP does NOT read the tip and reads Steven
  Black's comment at the bottom of the page instead :-)
 
 Any chance of someone fixing the tip?
 
 If the advice in the body of the tip is not helpful, please just
 delete it and move what you think is good into the tip body.
 Don't worry about crediting anyone because all the history is
 retained and people can see what happened.
 
 I can clean up formatting and English, but I'm not much help
 with some topics, like that tip.
 
 People can edit as an IP address, or it's easy to register an
 account (enter a bogus birthdate indicating you are more than
 13 years old; Google COPPA if want to know why that's needed).

Maybe it's best to keep the tip as it is  hang one of this big red
warning signs somewhere near the top, informing users that the tip is
100% wrong.. under review.. etc. and recommend they page dow  read the
comments.

CJ

-- 
Hi! My name is bobby...

-- 
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: Perform Google searches from inside Vim or on the command line, in plain text, with `goog`

2012-05-07 Thread Chris Jones
On Mon, May 07, 2012 at 01:45:18PM EDT, Daniel Choi wrote:

 I'm happy to announce my latest open source mini-project, `goog`.
 
 goog is a command line tool that lets you perform Google searches from
 the command line. Along with your query, you can specify the number of
 pages of results you want and the time range you are interested in.
 You can output the result in simple, colored plain text in the shell,
 or you can browse the results in Vim, where you are supplied with Vim
 key bindings to quickly open any URL in the results in a web browser.
 
 goog can also install itself as a Vim plugin, giving you the power
 to :Goog Google inside Vim.
 
 Link to github project and installation instructions:
 https://github.com/danchoi/goog

I noticed the following:

1. no man page (something cmdline folks expect) or even a --help flag to
   provide basic usage info about the program. The help2man tool might
   help.

2. Maybe dependencies should be clearly stated in the install guide..
   README.. web page:

   . nokogiri
   . tidy
   . Ruby 1.9

I was unable to test further since debian stable does not provide Ruby
1.9 by default and even after installling it, I would have had to make
manual symlink adjustments.

Lastly, to cover google's search engine capabilities, perhaps a language
flag (any, english, german.. etc.) might be of interest to some users..?

HTH

CJ

-- 
Hi! My name is bobby...

-- 
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: Perform Google searches from inside Vim or on the command line, in plain text, with `goog`

2012-05-08 Thread Chris Jones
On Tue, May 08, 2012 at 07:59:00AM EDT, Daniel Choi wrote:

 OK it should work now on Ruby 1.8.7

Great, I'll give it a shot.

 I don't have a man page yet, but I'll work on that, and a language
 flag

I don't know if help2man plays well with ruby, but I've used it in
python and it's a real time saver. Also, it guarantees that the man page
is in sync' with the output of the --help flag. I could email you
a sample (off-list) if you're interested.

As to the language flag, I don't know what standard (if any) google uses
or what languages they choose to (or not to) support. Seems they support
Catalan but they don't support Basque for instance. They support Thai,
but I didn't see Khmer in the list.. So maybe the query syntax supports
some exotic languages that are not listed in google's advanced search
language pull-down..? Should be easy to verify that..

I hope it doesn't add too much bloat.

CJ

-- 
WHAT YOU SAY??

-- 
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: Problem with :only remaping

2012-05-10 Thread Chris Jones
On Wed, May 09, 2012 at 06:32:50PM EDT, Krzysztof wrote:
 
 I will try to clarify.
 
 First the problem:

 noremap C-WO :echo You dont want thisCR etc. this is to block
 :only

 What I mean by that is keyboards shortcuts for :only which is
 C-WC-O,C-Wo

 The problem is, this don't work as I expected.

 When I am in normal mode, I work with many splits(horizontal and
 vertical) .

 Sometimes when I try to switch between the splits instead of

 C-Wk
 or
 C-Wl
 i type
 C-Wo

 Then all my splits are gone, and I have to setup them again.

Now I understand.. I must have missed an episode..

I just gave it a try and it _looks_ as if when you remap C-Wo, Vim
waits for the duration of ‘timeoutlen’ after you type C-W. 

If you type the ‘o’ before the timer expires, your custom mapping is
executed.

If you don't, Vim falls back to the builtin: the ‘:only’ behavior.

I just tested this after setting ‘timeoutlen=5000’ and as long as
I waited less than five seconds between the key strokes, the message was
echoed to the terminal.

I proceeded to test and slowly counted to one... two.. three.. four..
five.. and sure enough all my windows but one were gone..

Note that I also have ‘ttimeoutlen’ set (rather than the default of -1).

The help is not very clear: it states that ‘The timeout only happens
when the 'timeout' and 'ttimeout' options tell so.’ I think that this
needs to be clarified.

Anyway, you could try setting timeoutlen to a few seconds and see if it
helps.

Another (non-exclusive) possibility is to install the Zoomwin plugin so
that C-Wo becomes a toggle that closes all windows and later brings
them back to life. 

But mind you.. from what I'm.. guessing, you would still need to set
timeoutlen  (possibly) ttimeoutlen to adequate values.

HTH

CJ

-- 
Oh My God!!! Larry is back!

-- 
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: Problem with :only remaping

2012-05-12 Thread Chris Jones
On Fri, May 11, 2012 at 02:47:45AM EDT, Krzysztof wrote:

[..]

 Again Thanks. I was wondering if the problem was because my plugin
 setup etc. Unfortunately the response is not what I expected :) I was
 hopping to easily remove :only mapping. I try the longer timeoutlen
 and see if I can work with that.

Well, I would imagine that your C-WO mappings and the Zoomwin plugin
are not going to play well together. ;-)

 I am using the Zoomwin plugin, I just disabled the mapping for :only
 but that helps a little too. I am still hoping for better solution,
 because the behavior is somewhat strange to me. Timeout is reached but
 still the vim internal commands gets called. ( not my maped command)
 Maybe this is expected behavior, but just doesn't gets to me.

This is not easy to test comprehensively, since there are two flags
(timeout  ttimeout) and the two corresponding time definitions of
timeoutlen  ttimeoutlen. Depending on the values you choose for the
latter, this quickly adds up to lots of scenarios.

The truth table at :h timeout seems to imply that as long as ttimout is
set to off, the setting of ttimeout does not make any difference. IOW,
this suggests that timing out on mappings but not on keycodes is as
setting that does not make sense (?)

One way to make sure your C-WO mappings will always be executed no
matter how long you wait between keystrokes is to set both timeout and
ttimeout to off. Not sure what it will break (if anything) in your
setup.. apart from not being able to use the Zoomwin plugin, naturally.

Will there be cases where Vim will wait forever for the remainder of
a keycode..??

You may be able to find suitable settings by going back to the defaults
(first removing Zoomwin and your mappings) and working from there, with
timeout on and in(de)creasing the value of timeoutlen - while leaving
ttimeout and ttimeoutlen alone (since these do not concern mappings)
until you find something that suits you. And when things seem to work
for you, re-enable the Zoomwin plugin..?

 Anyway I observed similar thing with window movements and splits
 creation. After you start by C-W you have undefined time (not the
 timeoutlen) to perform hjkl or sv what I mean by that is 'hjkl' stands
 for movement and 'sv' are splits. I am not sure if that is a bug or
 this should work like that.

This is indeed what I observed. Vim appears to process builtin keyboard
actions and user-defined mappings differently.

Maybe something like a ‘history of layouts’ could be implemented in Vim
code.. Vim would automatically keep track of a (user-configurable)
number of past window splits and their geometry for each tabpage.. you
could list them via a ‘layout’ command that would print the buffers
comprised in each layout, and naturally the same ‘layout’ command could
be used to restore a previous layout manually.. Something like the
:buffers command on steroids..

CJ

-- 
Alex Perez is aliv!!!

-- 
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: Lost file using Vim (first time ever in 15 years)

2012-05-15 Thread Chris Jones
On Tue, May 15, 2012 at 11:23:57AM EDT, Ben Fritz wrote:

 Since the error only occurs if 'backup' and 'writebackup' are both
 off, maybe we could only do the dry run conversion in this
 situation? I.e., if either 'backup' or 'writebackup' are set, do what
 Vim has always done; but if neither are set, do the extra check first.
 We could even put a nice notice in :help 'writebackup' saying if this
 option is off, writing the file will take longer due to extra safety
 checks to discourage turning it off in the first place.

So you would penalize those of us who turned off this backup/writebackup
bloat..? 

Or would you force us to reinstate it so as not to be penalized..?

Aha... you turned off backup and writebackup.. you wicked little
so-and-so.. You seriously thought you were going get away with it..?

I made the decision to turn off this stuff years ago because when I'm
bleary-eyed not wide-awake or fully in control getting back to what
I was doing the night before, the very last thing I want to see when
I fire up Vim is a confusing message about some .swp file and do I want
to recover (r).. etc. The _only_ time I came close to losing _anything_
in Vim was when I almost gave the wrong answer. 

I don't believe in a text editor backing up the the data that it
manipulates anyway. I prefer relying on important data being backed up
by a program whose job it is to back up data. Not perfect I grant you,
but it does have the merit of doing its stuff while I sleep and let me
do my editing unmolested. 

Now suppose for a minute Christians's (or s/o else's..) patch causes
another data loss issue down the road.. Or any other problem.? Is the
next guy in line going to add another defensive patch on top of it..?
and another.. and another..? Where does it stop..?

No big deal anyway.. What does bother me is what on earth was in that
precious file that the OP (obnoxious poster) lost..? 

AFAICT, World War III hasn't broken out yet but I'm holding my breath.

CJ

-- 
Focus follow mouse users will burn in hell!!!

-- 
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: Folding on markdown headers

2012-05-19 Thread Chris Jones
On Sat, May 19, 2012 at 12:25:26PM EDT, Eric Weir wrote:

 When I create a file with markdown headers and save it, folding on the
 headers does not work.
 
 When I create a file with markdown headers, save it, close the window,
 and open the file in a new window, folding on the headers works.
 
 Why in the one case and not in the other?

On a different line, now that you have found a workaround...

What folding method are you using..?

Reason I'm asking is that I don't use ‘markdown’ (which I understand is
a lightweight markup language?) but I ran a quick test and both with
fdm=marker and fdm=suntax, I see folds being created instantly w/o
having to save or reload the buffer or any other action on my part.

Maybe s/o more knowledgeable than myself re: Vim's innards will chime in
 will be able to figure out what's going on and recommend some
autocommand trick or other that would force Vim to handle your folds
automatically and save you the trouble of reloading the file..?

CJ

-- 
SOMEBODY SET UP US THE BOMB

-- 
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: vim: how to yank only displayed texts in folding

2012-05-20 Thread Chris Jones
On Sun, May 20, 2012 at 05:28:10AM EDT, ping wrote:

 I'm using fold a lot and wondering if there is a way to yank ONLY the
 displayed texts?
 that is , say I have following folding:
 
 30 hostname WASHDC core
 31 +-- 34 lines: aaa new-model
 65 +--  2 lines: !
 67 service password-encryption
 68 baseline show-delta-counts
 69 !
 70 +--  3 lines: controller sonet 12/0
 73 !
 74 +--  3 lines: controller sonet 13/0
 77 !
 78 +-- 23 lines: controller sonet 4/0
101 +-- 31 lines: !
 
 normally when you yank a folded line, it actually yank the whole
 texts that line folded, not only the displayed title.
 but I want to also have the option to do the other way -- just yank
 the texts that is getting displayed.
 
 this is kind of another good usage of folding -- generate an overview
 that can be passed to other places.

I guess you write a function that uses the following Vim functions to
extract your text and append it to a register:

:h getline()
:h line()
:h foldclose()
:h foldtextexpr()
:h setreg()

And then have mapping such as:

:nmap ,y :g/\n/call MyYank()CR

.. to scan the entire buffer so that when you return from MyYank() your
outline would be available in one of the A-Z registers.

I believe you'd need to keep track of whether the current line is the
top line of the fold, or you'd end up with the entire fold appended to
the register.. not what you want obviously.

There are probably less kludgy ways to do that, but that's what comes to
mind..

CJ

-- 
Alex Perez is aliv!!!

-- 
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: vim: how to yank only displayed texts in folding

2012-05-20 Thread Chris Jones
On Sun, May 20, 2012 at 07:34:36AM EDT, Christian Brabandt wrote:

 Hi ping!
 
 On So, 20 Mai 2012, ping wrote:
 
  [retry]
  sorry if I posted answered questions since I haven't found a way out
  yet for my issues...
 
 What was wrong with the answer you received last time?
 http://groups.google.com/group/vim_use/msg/dd1baac3622107c0

Maybe that I hadn't joined in.. ;-)

Funny that I don't remember seeing that thread and yet came up with the
premises of pretty much the same solution..

CJ

-- 
Oh My God!!! Larry is back!

-- 
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: Substitution of metacharacters

2012-05-25 Thread Chris Jones
On Thu, May 24, 2012 at 10:53:27AM EDT, Tim Chase wrote:
 On 05/24/12 08:34, Bob von Knobloch wrote:

  Hi, I've searched all over but can't find an answer. How can one
  perform commands like ':%s/\n/\r\r/g' (replacing newlines or tabs
  etc.) in the gui's 'find and replace' dialogue?

 Playing around with :promptrepl (the underlying command), it looks
 like the *search* portion of it is happy to take various regexps.
 However the replacement part only seems to accept literals.  Thus in
 your example, it puts in a literal \r\r instead of two newlines.

Search/replace behavior in the GUI is not only different than in the
console version but appears to lead to inconsistencies: try a search
‘.*’ for instance and compare with ‘\s\s’.

 So I guess my short answer based on testing is:  when using the gui
 find-and-replace, there's no way to replace with anything but literals.
 
 I'd be glad if someone could prove me wrong (it seems a peculiar
 development choice to lose the parity with :substitute)

+1 .. (fwiw, since I don't use the GUI).

Would that be worth a feature/enhancement request?

In the ELinks text-mode browser, e.g. the popup dialog has the following
checkboxes:

( ) Normal search ( ) Regexp search (X) Extended regexp search

There are probably other examples of this feature that are more relevant
to the GUI world but perhaps Vim could have a ‘Regex’ checkbox: checking
it would activate regex mode both for search  replace..?

CJ

-- 
WHAT YOU SAY??

-- 
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: Period in global command

2012-05-25 Thread Chris Jones
On Fri, May 25, 2012 at 05:40:59AM EDT, John Degen wrote:

 I'm having trouble understanding why there is a period before w in
 the following command:
 
 :'a,'b g/^Error/ .w  errors.txt
 
 Does it indicate the current directory? It's difficult searching the
 help for just a .;)

'.' is the line under the cursor 

:h range

CJ

-- 
Oh My God!!! Larry is back!

-- 
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: Substitution of metacharacters

2012-05-25 Thread Chris Jones
On Fri, May 25, 2012 at 05:47:35AM EDT, Christian Brabandt wrote:
 On Fri, May 25, 2012 11:32, Chris Jones wrote:

  Search/replace behavior in the GUI is not only different than in the
  console version but appears to lead to inconsistencies: try a search
  ‘.*’ for instance and compare with ‘\s\s’.

 I think the search/replace dialog uses the \V atom to make the
 search very nomagic, so you need to use \.\*

Yes, I didn't mention it in my post but I did check the GUI's setting by
a ‘:set magic?’ and noticed that it was (recommended for portability's
sake by the manual..) that it is also set to ‘magic’ in the GUI.. same
as the console version.

Do you mean that the code overrides this setting for the GUI search..?

Anyway, I don't use the GUI so it doesn't affect me but I was thinking
that there may be real world cases where possible inconsistencies (if
there are any) might lead to false positives/negatives.. making the
search functionality unreliable for the user even when he's trying to
search on a regex.. If so, and depending on the context this might not
be a good thing.. (?)

CJ

-- 
Focus follow mouse users will burn in hell!!!

-- 
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: Substitution of metacharacters

2012-05-25 Thread Chris Jones
On Fri, May 25, 2012 at 06:00:46AM EDT, Chris Jones wrote:

 Anyway, I don't use the GUI so it doesn't affect me but I was thinking
 that there may be real world cases where possible inconsistencies (if
 there are any) might lead to false positives/negatives.. making the
 search functionality unreliable for the user even when he's trying to
 search on a regex.. If so, and depending on the context this might not
 be a good thing.. (?)

oops.. s/when he's trying/when he's *not* trying/

CJ

-- 
Alex Perez is aliv!!!

-- 
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: Folding on markdown headers

2012-05-25 Thread Chris Jones
On Tue, May 22, 2012 at 09:14:03AM EDT, Eric Weir wrote:

 On May 20, 2012, at 12:20 AM, Chris Jones wrote:

  On Sat, May 19, 2012 at 12:25:26PM EDT, Eric Weir wrote:

  When I create a file with markdown headers and save it, folding on
  the headers does not work.
  
  When I create a file with markdown headers, save it, close the
  window, and open the file in a new window, folding on the headers
  works.
  
  Why in the one case and not in the other?
  
  On a different line, now that you have found a workaround...
  
  What folding method are you using..?

 At first I didn't know how to answer. I didn't find anything related
 to fold method in my .vimrc. Fortunately, I keep copies of emails
 pertaining to problems I've encountered and solved with the help of
 people here and at vim_mac. Thank God! 
 
 Turns out I'm using Vlad Irnov's markdown folding script.
 https://gist.github.com/1035030 I'd completely forgotten about it, but
 it is what takes care of it for me.

I meant the value of the ‘foldmethod’ Vim option. What does ‘:set fdm?’
tell you?

| :h fdm
| :h folding

The script sets the fdm option to ‘expr’ for the current buffer/window,
which amounts to running user-written code for each line in the buffer.

In this particular case, the user-written code is a function named
‘Foldexpr_markdown()’. By the look of it, this function should create
a fold automatically wherever it sees a line that starts with an equal
sign in column one, followed by either an equal sign or white space.
A valid markdown header would be something such as  ‘= a header’.. or
‘=== another header’... etc. 

So that if you if you add a line of the form: ‘= this is a header’ and
hit Enter, the script should run automatically and create a fold
immediately. At least that's the way I understand it.

 Maybe this is something Vlad overlooked? Whatever, the workaround is
 pretty simple, so thanks again for that.

I use a one-line expression to fold Vim help files that is quite similar
to the script you referred me to and it updates the folding immediately
when for instance I duplicate the first couple of lines of an existing
fold by copying and pasting it - I never have to reload the file.

At a glance I cannot see any particular reason why the above-mentioned
script shouldn't work the same.

What exactly do you mean by ‘when I create a file’..? How does it ‘not
work’?

CJ

-- 
Mooo Canada

-- 
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: Substitution of metacharacters

2012-05-25 Thread Chris Jones
On Fri, May 25, 2012 at 10:10:49AM EDT, Ben Fritz wrote:
 On Friday, May 25, 2012 5:00:46 AM UTC-5, Chris Jones wrote:

[..]

  Do you mean that the code overrides this setting for the GUI
  search..?

 Yes...kind of. The code for the GUI automatically inserts \V in the
 search pattern, which is a flag for very nomagic, which is not even
 settable via an option. The \V flag will override any 'magic' option
 setting.

So it appears to be..

Maybe the doc should mention that ‘very nomagic’ that is the default
option when you do a search via the GUI dialog. I'd always wondered what
that particular option was meant for. 

CJ

-- 
Oh My God!!! Larry is back!

-- 
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: Folding on markdown headers

2012-05-25 Thread Chris Jones
On Fri, May 25, 2012 at 07:17:57PM EDT, Gary Johnson wrote:
 On 2012-05-25, sc wrote:

[..]

  when you start with an empty window, you have done nothing to tell
  vim what type of file you are going to create -- when you add text
  it still doesn't know -- if you write the file with a markdown
  extent, it COULD know if you would ask it to check (writing doesn't
  trigger filetype detection) -- so to ask it you might try something
  like
  
  :syntax enable
  
  perhaps that will help?

Not sure it's necessary.

 That depends on how the markdown filetype is being detected, by
 filename extension or by file content.

Eric's previous post says he writes it as a markdown file - i.e. with
a markdown extent. So I assume that the file type is detected via the
filename extension.

 If the markdown filetype is being detected by file content,
 executing
 
 :filetype detect
 
 after you've written a number of lines of recognizable markdown
 should work.
 
 If the markdown filetype is being detected by filename extension,
 you'll have to give your buffer a name, e.g.,
 
 :f myfile
 
 before executing
 
 :filetype detect
 
 The simplest may be to execute
 
 :set ft=markdown
 
 or whatever the markdown filetype is actually called, as soon as you
 open a new, empty window.

There are things I find a little unclear regarding autocommands but
assuming the file extension is something like ‘*.mkdwn’ shouldn't it be
possible to achieve this automatically when creating the file by placing
something like this in a file named ~/.vim/ftdetect/markdown.vim:

| autocmd BufNewFile,BufRead *.mkdwn set filetype=markdown

Wouldn't this cause ‘:w myfile.mkdwn’ to automatically enable the
markdown foldexpr and create the folds in one pass?

CJ

-- 
ALL YOUR BASE ARE BELONG TO US!

-- 
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: Folding on markdown headers

2012-05-25 Thread Chris Jones
On Fri, May 25, 2012 at 06:35:28PM EDT, Eric Weir wrote:
 
 On May 25, 2012, at 3:08 PM, Chris Jones wrote:

[..]

 Thanks, Chris. It depends on the filetype. If it's markdown the result
 is foldmethod=expr. Otherwise foldmethod=manual.

So it looks like the markdown script gets loaded when dealing with
a markdown file. I should have asked you to issue a ‘:verbose set fdm’.  

  The script sets the fdm option to ‘expr’ for the current buffer/window,
  which amounts to running user-written code for each line in the buffer.
  
  In this particular case, the user-written code is a function named
  ‘Foldexpr_markdown()’. By the look of it, this function should create
  a fold automatically wherever it sees a line that starts with an equal
  sign in column one, followed by either an equal sign or white space.
  A valid markdown header would be something such as  ‘= a header’.. or
  ‘=== another header’... etc. 
  
  So that if you if you add a line of the form: ‘= this is a header’ and
  hit Enter, the script should run automatically and create a fold
  immediately. At least that's the way I understand it.

 There are two types of markdown headers, Setext and atx. Setext uses
 equal sign or single underline underlining. atx uses hashmarks, #, ##,
 etc. I use the latter and the script folds on them fine. 

OK. I wrongly assumed the hash marks introduced comments. Doesn't make
any difference, though. I have a feeling that the problem is that the
folding script is not executed when you create markdown files, only when
you read them.
 
  Maybe this is something Vlad overlooked? Whatever, the workaround
  is pretty simple, so thanks again for that.

Looks more like something is missing. I don't see markdown in the global
file type detection file (filetype.vim) but I'm running Vim 7.2. Now the
script only does folding. Did you download a syntax highlighting file
from somewhere else? Do you have any other ‘markdown.vim’ files on your
system? Seems there are 2-3 different syntax files lying around in
different repos (vim.org, github..).

[..]

  What exactly do you mean by ‘when I create a file’..? How does it ‘not
  work’?

 I start with an empty window, i.e., no file loaded. I type in a #
 and some text, do a CR and some more text, another CR and some
 more text, then write/save the file as a markdown file, i.e., with
 markdown extent. At that point the header is not highlighted and
 folding does not work. If I close the file and reopen it, highlighting
 and folding work. 

I _believe_ this is usually done via autocommands. See my other post.

CJ

-- 
WE GET SIGNAL

-- 
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: Folding on markdown headers

2012-05-26 Thread Chris Jones
On Sat, May 26, 2012 at 06:47:59AM EDT, Eric Weir wrote:
 On May 25, 2012, at 10:12 PM, Chris Jones wrote:

[..] 

 I don't know when it became effective, but my understanding is that
 markdown support is built into Vim. 

I ran a quick test on a freshly-installed Vim 7.3 and highlighting
worked out of the box with a 20-line markdown sample I grabbed online.

With Vim 7.3, $VIMRUNTIME/filetype.vim has the following lines:

|  Markdown
| au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md  setf markdown

As soon as I issued a ‘:w /tmp/sample.mdown’ to write the [No Name]
buffer to disk , the markdown was highlighted.

In other words, the standard setup should take care of turning on
highlighting immediately after you write the file when you use one
of the above file extensions (*.markdown, *.mdown, *.mkd, etc.) 

I would avoid ‘*.mmd’  ‘*.md’ (not in the above list). Worse, per
filetype.vim, ‘*.md’ is something else: a modula2 file extension.

I proceeded to copy the folding script to ~/.vim/after/ftplugin/ under
‘markdown.vim’ and ran the same test. Sure enough, immediately after
I wrote the buffer to disk (:w /tmp/sample2.mdown) my 20 lines became
one single big fold.

 I thought I was getting folding and highlighting on regular markdown
 files, i.e., md, but when I checked just now it appears that I am
 not. So I put the auto command you suggested in your previous response
 in my .vimrc. Then I get folding and highlighting, but only when
 opening a previously saved file. 

Please remove... The ‘au...’ command above does the same thing. But the
fact that in your case, highlighting does not work on file creation is
interesting. As if Vim was never notified of the BufNewFile event.. 

  Did you download a syntax highlighting file from somewhere else? Do
  you have any other ‘markdown.vim’ files on your system? Seems there
  are 2-3 different syntax files lying around in different repos
  (vim.org, github..).

 Again, I was under the impression that markdown support is now built
 in to Vim. Perhaps I am mistaken about that. I'll have to look into
 what syntax files are on my system. I don't believe I've added any to
 my Vim installation. Some [all?] of my plugins may have their own
 syntax files. I'm pretty sure one---VimWiki---does and it sets a fold
 method ['expr], but only for VimWiki files. I'll check for others.

Immediately after you create the file you could check that the folding
script is loaded : run ‘:scriptnames’ and look for a line that says
~/.vim/after/ftplugin/markdown.vim (or the MacVim equivalent). 

You need to do this on a dedicated Vim session.. start Vim on an empty
buffer, enter some markdown, save the file, and run :scriptnames.. If
the folding script isn't even loaded, folding is not going to work. 

Then run ’:verbose set ft’ and ‘:verbose set syntax’ to see if they are
set to ‘markdown’ and then ‘:verbose set fdm’.. should say ‘expr’.

Pretty much stumped at this point.. Maybe s/o with access to MacVim
could run a quick test  let us know whether it works on their system?

CJ

-- 
Alex Perez is aliv!!!


-- 
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: Folding on markdown headers

2012-05-26 Thread Chris Jones
On Sat, May 26, 2012 at 03:50:24PM EDT, Gary Johnson wrote:
 On 2012-05-25, Chris Jones wrote:
 
  There are things I find a little unclear regarding autocommands but
  assuming the file extension is something like ‘*.mkdwn’ shouldn't it be
  possible to achieve this automatically when creating the file by placing
  something like this in a file named ~/.vim/ftdetect/markdown.vim:
  
  | autocmd BufNewFile,BufRead *.mkdwn set filetype=markdown
  
  Wouldn't this cause ‘:w myfile.mkdwn’ to automatically enable the
  markdown foldexpr and create the folds in one pass?
 
 No.  BufNewFile will set the filetype to markdown when starting to
 edit a new file with a name ending in .mkdwn; 

That's also how I understood it, yet..

I tested with a markdown file and BufNewFile and BufRead were the only
two events defined to Vim. Non-customized Vim 7.3, no plugins, etc.

This is what I see in filetype.vim:

 Markdown
au BufNewFile,BufRead *.markdown,*.mdown,*.mkd,*.mkdn,README.md setf markdown

I started a Vim session by typing ‘vim’ at the prompt and I entered some
markdown in the [No Name] buffer.

At this point ‘set ft?’ said ‘filetype=’..

Now as soon as I had written the file to disk as ‘sample.mdown’ or
.mkd.. .mkdn.. etc., ft was correctly set: ‘filetype=markdown’.

so is it the BufNewFile or the BufRead event that causes the filetype to
be set? Between the two, I would tend to think it is BufNewFile, not
because the file is written to disk, but rather because the Vim buffer
now has a name.

I don't know if is meant to work this way (the doc would appear to
suggest otherwise)  but I suspect that the BufNewFile event is also
triggered when you issue a ‘:w’ command against a scratch buffer.

[Mind you, this is linux, not MacVim though I don't see why it would make
any difference since this appears to be an event that is purely internal
to Vim.]

Anyway, this is what I understood the OP was doing: creating a scratch
buffer, entering code, and saving the file via a ‘:w x.markdown’
command.

But where I do agree, is that if it is acceptable for the OP to create
his files by giving them a ‘x.markdown’ file name on the initial
‘:new’ (:vne.. :tabe.. etc.) command he will have the benefit of
immediately having the Vim ‘filetype’ option automatically set and both
syntax highlighting and automatic folding will be available as long as
there exist corresponding definitions (syntax file with or without
syntax folding, folding script.. etc.). In other words, as soon as he
starts typing, keywords, headings, etc. will be recognized and
highlighted accordingly. 

This obviously cannot happen as long as you are entering your code in
a [No Name], (ft=)  buffer. But I don't see how this is going to solve
his problem if the BufNewFile event is not triggered in the first place.

 BufRead will set it when opening an existing file whose name ends with
 .mkdwn.  To have :w myfile.mkdwn set the filetype, you would need to
 use the BufWrite autocommand event.  That's not normally done because
 one usually wants any setting dependent on the file type executed when
 starting to edit the file, not when the editing is finished.

I didn't go into into it but that was my point: it is not ‘normally’
done and yet what the OP reports as not working does work everywhere
else for similarly defined file types (if you look at filetype.vim).

 The ways I usually set the filetype on new files is to open them by
 name
 
 $ vim foo.c

What I don't like all that much about this approach is that on
a multi-user system especially, and since the file is not actually
created in the file system, a file with the same name might be created
before you actually write foo.c to disk. And then you get one of those
confusing messages...

 or
 
 :split foo.c
 
 or if I'm already in an empty buffer or the file doesn't have an
 extension (e.g., a shell script), by executing
 
 :set ft=c

I just did a quick test with ‘:tabe’ (no file name), obviously the
filetype was ''. I entered some vimscript  as soon as I wrote the file
under f.vim, syntax highlighting came on.

To _Eric W._

What happens when you do as Gary suggests: start Vim via a ‘vim
newfile.mkd’..? 

CJ

-- 
AHH! The neurotic monkeys are after me!

-- 
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: Folding on markdown headers

2012-05-26 Thread Chris Jones
On Sat, May 26, 2012 at 08:38:28PM EDT, Eric Weir wrote:
 
 On May 26, 2012, at 6:32 PM, Chris Jones wrote:

[..]

  As soon as I issued a ‘:w /tmp/sample.mdown’ to write the [No Name]
  buffer to disk , the markdown was highlighted.

 Thanks, Chris. I did same with an .mkd extent and got the same
 result. I'm embarrassed to say this, but I think all this sturm und
 drang is going to turn out to have been occasioned by the fact that
 I mistakenly believed that .md was a markdown extent.

Not to worry.. That's one area of Vim I don't understand very well..
An opportunity to learn something..

  I would avoid ‘*.mmd’  ‘*.md’ (not in the above list). Worse, per
  filetype.vim, ‘*.md’ is something else: a modula2 file extension.

 No problem with .md, but .mmd is the extent used by multimarkdown,
 an extension of markdown that adds some additional features, e.g.,
 footnotes. It is used by Scrivener to convert Scrivener documents to
 LaTeX. Without the .mmd extent multimarkdown will not compile the
 file.

Ah, for syntax highlighting and presumably folding to work, you would
need to create a custom autocommand (same as the one in filetype.vim)
for this file extension to be recognized and stick it either in your
.vimrc or possibly in your ftplugin/ or your after/ftplugin directory
(untested).

[..]

 Safe to assume the script is loaded since I'm getting folding on
 recognized markdown files?

Absolutely.

  Then run ’:verbose set ft’ and ‘:verbose set syntax’ to see if they
  are set to ‘markdown’ and then ‘:verbose set fdm’.. should say
  ‘expr’.
 
 All results are positive. 
 
 I think this solves the problem. My apologies to everyone who was
 scratching their heads on this one when all along it was a stupid
 mistaken assumption on my part.

Where I'm concerned, no need to apologize.. thanks for the workout.. ;-)

 Not that it wasn't educational, though. So also thanks for that. 

Talking of educational.. in reference to what you wrote elsewhere
regarding Vim help, I thought I might mention that there are two
distinct parts to Vim's help: the ‘user manual’ and the ‘reference
manual’.  

Maybe the following illustrates the difference between the two:

| :h cpo
| :h user-manual

The user manual provides structured overviews of pretty much every area
of Vim without going into too much detail. Studying at my own pace, one
chapter at a time helped find my bearings. Mind you, I mean studying..
not printing it and just reading through it.. splitting the screen and
practising in a scratch buffer until you really know what's there. The
good thing is there are links to the reference manual whenever you feel
like digging..

Once you've worked through that, you will be able to find what you're
looking for in the reference manual much more easily and what you find
there will make better sense.

CJ

-- 
Mooo Canada

-- 
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: how to match all Chinese chars?

2012-05-27 Thread Chris Jones
On Sun, May 27, 2012 at 09:53:55AM EDT, William Fugy wrote:

 Question: how to match all Chinese chars?
 
 ---
 fenc=utf-16le
 enc=utf-16le
 termencoding=utf-16le
 
 
 :g/[\%u4e00-\%u9fff]/
 this command doesn't work.
 
 However
 :g/\%u5728/
 could match a single char '在'..
 
 thanks in advance.

Doesn't work here either even with smaller ranges.. (Vim 7.2 and UTF-8).

Unless s/o comes up with a better idea, you could try using the
characters themselves instead of their code points but it looks like you
are going to run into another problem.. in my environment, ranges appear
to be limited to something like 256+ characters. Beyond that you get an
‘E16 Invalid range’ message.

Unless I missed something, and if you absolutely need to do this, you
could bypass the limitation by breaking up the range like so:

| :g/[一-仿伀-俿倀-儀 ... 鼀-龻]/

This corresponds to ranges:

| \u4e00-\u4eff
| \u4f00-\u4fff
| \u5000-\u50ff
| ..
| \u9f00-\u9fbb¹

Trouble is, this is going to add up to something like 80+ subranges and
may cause you to run into other limitations. I haven't tested the whole
range, only the above (it works here) but if nobody comes up with
a better idea, and you choose go down this path, I would suggest
generating the regex programatically..

CJ

¹ I think \u4e00-\u9fbb is the correct CJK range

-- 
WE GET SIGNAL

-- 
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: Folding on markdown headers

2012-05-27 Thread Chris Jones
On Sun, May 27, 2012 at 11:59:36AM EDT, Eric Weir wrote:

 Thanks, Chris. I was going to say I had no idea there was
 a user-manual---until I took a look at the pdf version. In fact, I had
 a hard copy of the book, but got rid of it because I couldn't
 understand it. I went looking for it but found that, alas, I have
 indeed gotten rid of it. May have get myself another copy. The pdf is
 too maddening to navigate around in. 

Ah, see.. you didn't even know it was there.. but not to worry, I used
Vim for 2-3 years before I ran into it.. by accident. :-)

The pdf version.. or worse a hard copy of the Vim help are IMHO useless
because the Vim help was never meant to be read as a book in the first
place.. for one thing, as you justly remarked.. you cannot navigate it.. 

I was not suggesting you sit down and read the entire user manual over
a period of 10+ hours.. I set myself a fairly loose schedule.. like week
one chapter one, etc. opened a tab and split the screen vertically with
the manual displayed on the left and a playground scratch buffer on the
right, read a couple of paragraphs.. practised what I read in the
scratch buffer as well as the Vim command line.. tried to be creative or
just curious and explored other possibilities.. followed some of the
links to the reference manual.. googgled for answers when something was
not entirely clear or I felt I could do with a second opinion.. etc.

 I take to heart what you say about studying, not just reading through.
 At this point I have a hard time imagining myself doing this with the
 entire thing, all at once. I can certainly imagine doing that with the
 chapters and sections that cover my current level of skill and
 introduce me to some new useful skills. And returning to it
 periodically to get myself onto a new level. 


Not all at once.. for me at least.. it's been a slow process.

CJ

-- 
AHH! The neurotic monkeys are after me!

-- 
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: how to match all Chinese chars?

2012-05-28 Thread Chris Jones
On Sun, May 27, 2012 at 09:25:30PM EDT, William Fugy wrote:
 On Mon, May 28, 2012 at 10:15 AM, Xell Liu xell@gmail.com wrote:

[..]

   Unless I missed something, and if you absolutely need to do this,
   you could bypass the limitation by breaking up the range like so:

 
   | :g/[一-仿伀-俿倀-儀 ... 鼀-龻]/
 
  Good one! i'll give it a try. But so many characters,.

Depends how much one needs a regex that works for all cases or if
something more relaxed can do the job at hand. I was also thinking that
depending on the particular use case it might be possible to have
a script create the regex and initialize a variable/register and use its
contents in interactive commands to simulate a [:CJK:] character class
more conveniently.

   This corresponds to ranges:
  
   | \u4e00-\u4eff
   | \u4f00-\u4fff
   | \u5000-\u50ff
   | ..
   | \u9f00-\u9fbb¹
  
   Trouble is, this is going to add up to something like 80+ subranges and
   may cause you to run into other limitations. I haven't tested the whole
   range, only the above (it works here) but if nobody comes up with
 
   a better idea, and you choose go down this path, I would suggest
   generating the regex programatically..
 
 
 thank you. Apparently it has just to be done like this way.  Now I'm
 dealing with this problem by Perl. Hope Vim could accomplish it.

I don't use Perl but I would have expected it to provide native support
for Unicode blocks. In this instance ‘\p{InCJk_Unified_Ideographs},
which corresponds precisely to U+4E00...U+9FFF.

See this:

http://www.regular-expressions.info/unicode.html

   ¹ I think \u4e00-\u9fbb is the correct CJK range
 
  Yes. it's accurate.

Sorry.. in fact, correct was the wrong word.. I really meant something
like ‘effectively assigned’.. \u9fbb-\u9fff do belong to the unicode
range but afaict no characters have been assigned. Which makes it
impossible to refer to them by character.. only by code point.

CJ

-- 
Alex Perez is aliv!!!

-- 
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: Folding on markdown headers

2012-05-28 Thread Chris Jones
On Sun, May 27, 2012 at 04:10:43PM EDT, Gary Johnson wrote:
 On 2012-05-26, Chris Jones wrote:

[..]

  so is it the BufNewFile or the BufRead event that causes the
  filetype to be set? Between the two, I would tend to think it is
  BufNewFile, not because the file is written to disk, but rather
  because the Vim buffer now has a name.
  
  I don't know if is meant to work this way (the doc would appear to
  suggest otherwise)  but I suspect that the BufNewFile event is also
  triggered when you issue a ‘:w’ command against a scratch buffer.

 I don't know what to make of this at this point.  After discovering
 that I was wrong in my understanding of what happens when you :write
 and unnamed buffer to a file, and after reading your posts, I did
 some experimenting, too.
 
 I started vim and enabled syntax highlighting and filetype detection,
 
 $ vim -N -u NONE
 :syntax enable
 
 entered a bit of markdown text into the buffer, then executed
 
 :set verbosefile=verbose.out
 :set verbose=9

[..]

 and opened the verbose.out file.  Here are the first 23 lines from
 that file.

[..]

 | Executing BufRead Auto commands for *.markdown
 | autocommand setf markdown

[..]

 It appears that filetype detection was triggered by the BufRead
 autocommand!  Why on Earth would the BufRead autocommand be triggered
 by a :write?

Surprise.. surprise.. :-)

 I searched the source code and found the following in the do_write()
 function in ex_cmds.c:
 
 |   /* If 'filetype' was empty try detecting it now. */
 |   if (*curbuf-b_p_ft == NUL)
 |   {
 |   if (au_has_group((char_u *)filetypedetect))
 |   (void)do_doautocmd((char_u *)filetypedetect BufRead,
 |   TRUE);
 |   do_modelines(0);
 |   }
 
 So not all BufRead autocommands are triggered by a :write; only
 those in the filetypedetect group.
 
 That behavior still seems strange, but now we know.

Not all that much. I suspected BufNewFile, and I guessed wrong. It looks
like the telltale bit in the name of these events is the ‘Buf’ prefix.
It's really all about Vim's internal management of buffers, more than
about the actual writing or loading of the file. And Vim does what's
more convenient... from the point of view of Vim.

In any case, thanks much for figuring this out and providing details re:
verbose/verbosefile. Made a good note of this technique for future use.

CJ

-- 
WHAT YOU SAY??

-- 
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: how to match all Chinese chars?

2012-05-29 Thread Chris Jones
On Mon, May 28, 2012 at 08:58:58AM EDT, Christian Brabandt wrote:

 Hi Chris!

[..]

 I think, you can script this. Something like this:
 
 fu! sidCollation(start, end, match) {{{
 let start = '0x'. a:start
 let end   = '0x'. a:end
 let patt  = '\%('
 if (end - start)  256
 return a:match
 endif
 while (end - start)  256
 let temp = start + 256
 let patt .= printf('[\%%u%X-\%%u%X]', start, temp)
 let start = temp + 1
 if (end - start)  0
 let patt .= '\|'
 endif
 endw
 if (end - start)  0
 let patt .= printf('[\%%u%X-\%%u%X]', start, end)
 endif
 let patt .= '\)'
 return patt
 endfu
 
 fu! sidRegCollate() {{{
 let cmd = getcmdline()
 if getcmdtype() =~# '[/?:]'  cmd =~# '\[\\%u\x\+-\\%u\x\+\]'
 let cmd = substitute(cmd,
 \ '\[\\%u\(\x\+\)-\\%u\(\x\+\)\]',
 \ '\=sidCollation(submatch(1), submatch(2), submatch(0))',
 \ 'g')
 endif
 return cmd
 endfu
 
 cnoremap f7 c-\esidRegCollate()cr
 
 And then press f7 whenever you have entered a range  256 items.

With minor adjustments, the script works as intended and splits the huge
[%\u4e00-%\u9fff] range into a very long series of [n-n+256] subranges
of code points separated by ‘\|’ alternatives.

But there is a second problem: at least in my setup, (Vim 7.2, UTF-8),
the smaller ranges no longer trigger the ‘E16 Invalid Range’ error but
they match any ASCII character.. and ironically the only thing they
don't match are the characters they are supposed to match.. here, the
ones in the %\u4e00-%\u9fff range.

That's why I initially suggested the OP use actual characters for his
ranges instead of the ‘%\u4e00’... etc. code points... 

I guess the script could be modified to translate %\u4e00' and friends
into actual characters, but after digging a bit into Vim help.. I'm not
so sure.. my impression is that you'd need an external tool to do it:
Vim's printf() for instance does not support a ‘%U’ conversion type. 

Thanks,

CJ

-- 
Have a nice day!

-- 
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: how to match all Chinese chars?

2012-05-30 Thread Chris Jones
On Mon, May 28, 2012 at 05:55:27PM EDT, Tony Mechelynck wrote:

[..]

 However, there is also a limitation in Vim, namely, a collection can
 only match (IIRC) at most 257 different individual characters at the
 same point. 4E00..9FFF alone is already much more than that.

The limit is that a range of characters (a-z, 0-9 etc...) that is part
of a collection can only match at most 256 characters.

Here's for instance a valid collection that matches 4096 characters:

| /[一-仿伀-俿倀-僿儀-凿刀-勿匀-叿吀-哿唀-嗿嘀-囿圀-埿堀-壿夀-姿娀-嫿嬀-寿尀-峿崀-帀]

Subranges are: 4e00-4eff ... 5d00-5dff - 256 characters each.

Conversely, the following triggers the ‘E16 Invalid range’ error:

| /[一-企]

Range is: 4e00-4f01

I generated a similar collection for the entire 4e00-9fff block, split
into 256-character sub-ranges, and apart from the regex causing Vim to
slow down to a crawl on larger files, it appeared to match.

All the same, there does not appear to be any simple solutions save for
this clunky workaround.

Is anything in the works regarding unicode regex support in a future
release of Vim (8.x)..?

CJ

-- 
WE GET SIGNAL

-- 
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: XIM Input Method for Motif Gvim

2012-06-02 Thread Chris Jones
On Sat, Jun 02, 2012 at 08:08:04AM EDT, Christian Brabandt wrote:

 I have recently been working on the Motif GUI and noticed, that my
 gvim always show XIM INSERT, when in insert mode. I keep reading :h
 xim and mbyte-XIM, but I seem to be missing something. So my questions
 are:

  1) Why is XIM enabled by default?
  2) How do I use it?
  3) And most importantly: How do I turn if off?

Do you have an IME set up..? Doesn't sound rational, but perhaps you
need one installed.. in order to turn it off..?

CJ

-- 
Hi! My name is bobby...

-- 
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: XIM Input Method for Motif Gvim

2012-06-02 Thread Chris Jones
On Sat, Jun 02, 2012 at 03:01:12PM EDT, Christian Brabandt wrote:
 Hi Chris!
 
 On Sa, 02 Jun 2012, Chris Jones wrote:
  On Sat, Jun 02, 2012 at 08:08:04AM EDT, Christian Brabandt wrote:

   I have recently been working on the Motif GUI and noticed, that my
   gvim always show XIM INSERT, when in insert mode. I keep reading
   :h xim and mbyte-XIM, but I seem to be missing something. So my
   questions are:

1) Why is XIM enabled by default?
2) How do I use it?
3) And most importantly: How do I turn if off?

  Do you have an IME set up..? Doesn't sound rational, but perhaps you
 
 Not that I know of. How would I set it up?

Hi Christian,

My undestanding is that you need to install an input server that covers
your particular data entry needs. I could be 100% wrong about that, but
that might explain the different web links on the help page. They point
to stuff that's not part of the Vim offering.

This was meant more as a general remark, though.. mostly to the effect
that it's much easier to figure out IME documentation when you have an
IME installed to play with.

Here's an ancient thread that may be of some interest:

| http://tech.groups.yahoo.com/group/vim-multibyte/message/351

Again, I may be sending you altogether down the wrong path.. 

Thanks,

CJ

-- 
Oh My God!!! Larry is back!

-- 
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: XIM Input Method for Motif Gvim

2012-06-02 Thread Chris Jones
On Sat, Jun 02, 2012 at 03:01:12PM EDT, Christian Brabandt wrote:

[..]

1) Why is XIM enabled by default?
2) How do I use it?
3) And most importantly: How do I turn if off?

Regarding (3) above, I forgot to mention that there is an
imdisable/noimdisable boolean option. 

But I guess you have already tried that..?

CJ

-- 
SOMEBODY SET UP US THE BOMB

-- 
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: max colors in text based terminals

2012-06-03 Thread Chris Jones
On Sun, Jun 03, 2012 at 08:38:31AM EDT, sinbad wrote:

 my question is are there any terminal implementations that support
 more than 256 colors in text consoles not in gui.

Konsole and derivatives support a 24-bit color palette, i.e. they let you
display 16,777,216 colors concurrently.

This link looks like a useful entry-point:

|◎https://github.com/robertknight/konsole/blob/master/user-doc/README.moreColors

Other terminal emulators provide a user-modifiable palette of 8, 16, 88,
or 256 colors chosen among the 16,777,216 colors typically supported by
current hardware.

CJ

-- 
Have a nice day!

-- 
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: max colors in text based terminals

2012-06-05 Thread Chris Jones
On Mon, Jun 04, 2012 at 08:35:18PM EDT, Thomas Dickey wrote:
 On Jun 4, 4:00 pm, Chris Jones cjns1...@gmail.com wrote:

  All the same, I'd be curious to know what the Konsole developers had in
  mind when they implemented 16M colors support .
 
 konsole implements the xterm 256-color controls (256 * 256 * 256).
 It's not 16M * 16M * 16M.

My impression was that xterm lets you specify 256 colors using the
#00 .. #ff syntax.. in effect letting you override the defaults
and define a custom 256-color palette chosen among the possible 16M..

I became curious about Konsole supporting true color so I booted an iso
that ships it and ran the following bash commands:

| g=0
| b=0
|
| for r in $(seq 0 255) 
|   do
| echo -e \033[48;2;${r};${g};${b}m $r $g $b 
|   done   

If saw what definitely looked like a gradient that went from pure black
to the brightest red with 256 intermediate shades of red.

I ran the same script on an xterm (debian stable v261-1) and afaict it
did not understand the above syntax: the background color remained the
original default black.

Is this something you enable at ‘./configure’ time.. or is xterm's
syntax different from Konsole's..? 

Back on Konsole, I tried a similar script that goes through all 16M
color combinations:

| for r in $(seq 0 255) 
|   do
| for g in $(seq 0 255) 
|   do
| for b in $(seq 0 255) 
|   do 
| echo -e -n \033[38;2;${r};${g};${b}33m█ 
|   done
|   done
|   done   

This seemed to work as well, but the output was so large that I can't be
sure I was really getting 16M colors. Even with the smallest font
I could find, no way I could display it all on one screen. I guess I'd
have to come up with something a little smarter.

In any case, my point was that I don't see this feature as something
very useful.. unless you want to develop for Konsole exclusively using
hard-coded escape sequences.

As expected, I didn't see a terminfo entry that had ‘colors#16777216’
and ‘pairs#281474976710656’...

That's why I was wondering what the Konsole developers were planning to
do with this feature and went to the trouble of coding it.

CJ

-- 
WE GET SIGNAL

-- 
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: max colors in text based terminals

2012-06-06 Thread Chris Jones
On Tue, Jun 05, 2012 at 05:50:45AM EDT, Thomas Dickey wrote:
 On Jun 5, 3:00 am, Chris Jones cjns1...@gmail.com wrote:

[..]

 xterm looks for 5 (38;5), that's documented and well-known. 

My understanding is that the 38;5 and the 38;2 have different goals:

From Konsole's README.moreColors:

| The konsole adopted some ESC codes allowing to use extended
| color spaces.
| 
| There is a predefined 256 color space compatible with his
| xterm sister, and, even beyond that, a 3-byte RGB color space.
| 
| The ESC codes are as follows:
| 
|ESC[ ... 38;2;r;g;b ... m Select RGB foreground color
|ESC[ ... 48;2;r;g;b ... m Select RGB background color
| 
|ESC[ ... 38;5;i ... m Select indexed foreground color
|ESC[ ... 48;5;i ... m Select indexed background color

 Is konsole's format documented anywhere except for a comment in the
 code? 

| 
https://github.com/robertknight/konsole/blob/disable-wordwrap/user-doc/README.moreColors

Robert Knight appears to have been the Konsole's main dev' -- c. 2008.

 What you're describing is a built-in algorithm for the color palette.
 Reading the code, I see its behavior for 256-colors is also hardcoded,
 which means that it cannot set any of the palette entries.  So konsole
 implements no more than half of the xterm feature.

I eventually downloaded Kubuntu 12.04 and ran the following commands:

| for i in $(seq 0 255); do echo -e -n \033[38;2;${i};0;0m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;0;${i};0m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;0;0;${i}m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;${i};128;128m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;128;${i};128m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;128;128;${i}m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;${i};192;192m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;192;${i};192m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;192;192;${i}m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;${i};224;224m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;224;${i};224m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;224;224;${i}m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;${i};64;64m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;64;${i};64m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;64;64;${i}m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;${i};32;32m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;32;${i};32m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;32;32;${i}m█; done; echo
| for i in $(seq 0 255); do echo -e -n \033[38;2;255;255;${i}m█; done; echo

Since many people don't have Konsole installed on their system, I took
the liberty of attaching a (small) screenshot of the output.

There are clearly more than 256 colors concurrently displayed.

Not included in the screenshot, I ran the equivalent of 256color2.pl in
between each of the above commands, just to make sure that Konsole's
default 256-color palette was unaffected.

CJ

-- 
ALL YOUR BASE ARE BELONG TO US!

-- 
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
attachment: 16Mcolors.png

Re: What does the second example for map() mean?

2012-06-26 Thread Chris Jones
On Tue, Jun 26, 2012 at 09:56:48PM EDT, Benjamin R. Haskell wrote:

 There's an example in the help for map() that reads:
 
 :let tlist = map(copy(mylist), '  . \t')
 
 What is that ampersand doing there?  Is the example incomplete?
 Obsolete?  Should it be v:val instead?

Yes. Looks like someone was making quick changes to the doc and used ‘’
to recall the last match and somehow, a literal ampersand ended up in
there instead... 

Now.. How's that for guesswork? :-)

CJ

-- 
Alex Perez is aliv!!!

-- 
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: How to write a text line as binary/Hex with a filename by means of Vim command line(s)?

2012-07-04 Thread Chris Jones
On Wed, Jul 04, 2012 at 12:18:48AM EDT, William Fugh wrote:

 -Vim 7.3 + Vista(SP2)
 If there are 8 chars in one line like this:
 52494646
 Question: using Vim command line(s), how to write a binary file, and make
 it 'RIFF' (4 char, not '52494646') in a viewer of TXT?

Just to illustrate:

let l1 = [52, 49, 46, 46]
let l2 = map(l1, 'nr2char(v:val)')
let s1 = join(l2, '')
echo s1
41..
echo len(s1)
4

The s1 variable contains four hex values:

byte 0 is 0x34  .. ascii value of ‘4’
byte 1 is 0x31  .. ascii value of ‘1’
byte 2 is 0xe2  .. ascii value of ‘.’
byte 3 is 0xe2  .. ascii value of ‘.’

One problem is that if you copy the contents of the s1 variable to a Vim
buffer, Vim will add an eol (x0A) character to the string when you write
the buffer to a file.

$ od -x /tmp/myriff.txt

000 3134 2e2e 000a
005

Unless s/o else can figure it out from the above description, you may
want to explain your use case and why you need to use Vim to do this in
the first place.

There may be tools more suited to the job.

CJ

-- 
WE GET SIGNAL

-- 
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: How to remove empty lines except of one

2012-07-04 Thread Chris Jones
On Wed, Jul 04, 2012 at 10:52:47PM EDT, Tim Chase wrote:

 For some reason (legacy?), Vim uses \n on the left side and \r on the
 right side,

Ah.. good one.. baffled me for ages and always had something more urgent
to do.. never got a chance or remembered to look into it.. and kicked
myself later when I ran into it again..

Thanks for sharing..!

 so you want something like

   :%s/\n\{2,}/\r

 optionally tweaking the 2 and the number of \rs for your
 particular use-case

With the eol that terminates non-empty lines, shouldn't it be¹:

| :%s-\n\{3,\}-\r\r-g

?

CJ

¹ And possibly also adding ‘\s\{1,\}’ or ‘\s*’ for white space..

-- 
HOW ARE YOU GENTLEMEN?

-- 
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: How to remove empty lines except of one

2012-07-09 Thread Chris Jones
On Thu, Jul 05, 2012 at 06:54:44AM EDT, Tim Chase wrote:

Hello Tim, not replying to anybody in particular..

 It might be slightly more efficient, as replacing the 2 case with
 \r\r is a NOOP.
 
 As for blank-ish lines (containing just whitespace), it might become
 something like
 
  %s/^\(\s*\n\)\+/\r

I had a bit more time to look into this over the weekend and there's
something I don't understand regarding the way Vim handles the end of
buffer condition.

Here's one particular regex I came up with:

--
/\(\%^\|\S\n\)\@=\(\_^\s*\n\)\{2,\}\(\%$\|\S\)\@=
--

This appears to do what I have in mind when used in a _search_ command,
note the initial ‘/’.

What this is supposed to match:

- a zero-length alternative: either start of buffer or any non
  white-space character followed by a new line

- two or more empty lines, each optionally containing white space

- another zero-length alternative: either end of buffer or a non
  white-space character.

What I'm trying to do is to match each group of more than two empty
lines once and once only - if you have a block of ten empty lines it
will match once.. When you hit ‘n’ the cursor jumps to the first line of
the next block.

Naturally, the regex is not meant to be efficient, smart, abstemious,
etc.. just a literal translation of my pseudo-code. 

Anyway, I tested it on the following file/buffer:

--- start of file 
1  |
2  |
3  |  
4  |   
5  |
6  |
7  |
8  |
9  |
10 |
11 |
12 |
13 |
14 |
15 |asdfasdf
16 |
17 |
18 |
19 |asdf  asdf  
20 |  asdf
21 |
22 |asfd
23 |
24 |
25 |
 end of file -

line 1-2   : ‘^$’  (empty lines)
line 3 : ‘\n’  (four a's + eol)
line 4 : ‘  /n’(two spaces + eol)
line 5 : ‘\n’  (four c's + eol)
line 6-7   : ‘^$’  (empty lines)
line 8 : ‘\n’  (four d's + eol)
line 9-10  : ‘^$’  (empty lines)
line 11: ‘\t   \n’ (one tab, three spaces + eol)
line 12-14 : ‘^$’  (empty lines)
line 15: ‘asdfasf\n’   (asdfasdf + eol)
line 16-18 : ‘^$’  (empty lines)
line 19: ‘asdf  asdf  \n’  (asdf, 2 spaces, asdf, 2 spaces + eol)
line 20: ‘  asdf\n’(2 spaces, asdf, + eol)
line 22: ‘asfd\n’  (asfd + eol)
line 23-25 : ‘^$’  (empty lines)

If I set hlsearch and search for text matching the above regex, five
blocks are (correctly) highlighted: 1-2, 6-7, 9-14, 16-18, and 23-25.

If I repeatedly hit the ‘n’ key, the cursor jumps to line 1, line 6,
line 9, line 16, line 23... and wraps around back to line 1, line 6,
line 9.. etc.

But when I proceed to _substitute_ all the matched blocks by a single
empty line:

:%s//\r

.. everything works as planned, preserving trailing white space, except
for the last three lines: they are replaced by two empty lines instead
of one. As if the last line in the file/buffer was somehow excluded from
the match.

So, is my regex not doing what I think it does¹, or is there something
‘special’ about the last line in a Vim buffer²?

No big deal... but if someone can figure out what's happening, I'd be
curious of their explanations.

Thanks,

CJ

¹ Plausible, but if I get rid of my two zero-length matches and I use
  the simpler ‘/(\_^\s*\n\)\{2,\} .. I also get my matches via the ‘/’
  command but the substitute ‘:%s’ command still leaves me with two
  empty lines at the end of the file. 

² I saw other oddities, for instance when I add a line containing white
  space at the end of the sample file, the regex no longer matches. As
  a result, a block of empty lines at end of file is left untouched.
  I also noticed that Ben Fritz's suggestion earlier in this thread
  (‘%s/^\_s\+\n/\r’) has exactly the same ‘limitation’.


-- 
AHH! The neurotic monkeys are after me!

-- 
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: vim: session of sessions

2012-07-11 Thread Chris Jones
On Wed, Jul 11, 2012 at 03:25:58PM EDT, ping wrote:

Maybe OT, but anyway..

[..]

 * switching beyond 9 windows is painful in screen, if you ever use it.

Not sure what you mean by painful, but GNU/screen lets you define
extra shortcuts to access windows directly via the ‘bind’ command:

bind ')' select 10
bind '!' select 11

etc.

So you would use ‘CTRL-A Shift+0’ to switch to window 10.. ‘CTRL-A 1’ to
switch to window 11.. etc.

Never tried it but you could also define more such shortcuts if you need
more.. you could probably define 40-50 more shortcuts without stepping
on the ones that GNU/screen assigns by defaut to other functionalities.

If you run (e.g.) twenty vim instances under GNU/screen, each with 20
tabs open, each with four windows.. that already adds up to 400 files,
even without splitting the screen and not to mention hidden buffers.

Another convenient way to switch betwee GNU/screen windows is to display
the window list via ‘CTRL-A ’ (double quote) and use vim movement keys
‘j’ and ‘k’ to navigate and hit Enter to switch to the target window.

This has the merit of letting you visualize whatever names you gave to
each of your vim instances.. could come in handy in case you forget..

Don't know of any application that lets you do this faster and with less
overhead than GNU/screen. Considerably less so than handling more than
c. 10-12 tabs in a web browser, for my money.

Won't stop me from thinking that running more than one instance of Vim
is not a good idea in the first place.. 

HTH

CJ

-- 
WHAT YOU SAY??

-- 
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


<    1   2   3   >