richard emberson | 25 May 00:53
Picon

Vim script optimization tips

Is there a resource concerning the writing of optimized
Vim scripts (both memory usage and performance).

For instance:
Should variable name be short?
Should spaces not be put between tokens?
     "value=" . value
     a + b
     let cnt = cnt + 1
     versus
     "value=".value
     a+b
     let cnt +=1
Since Vim does not have a switch/case statement (??)
     are a chain of if-elseifs the best one can do.
In a function is accessing a parameter
     func  Foo(p)
      let x = a:p "
     endfunc
   slower than accessing a local that has been set to the parameter
   (ignoring the cost of setting the local).
     func  Foo(p)
      let p = a:p
      let x = p " faster or slower than x = a:p
     endfunc
In many scripts I've seen, it is the short version key words,
options, etc are used, e.g,
     func rather than function

Thanks
(Continue reading)

Pablo Giménez | 24 May 19:50
Picon

Not mapping keys for SuperTab continued.

I want to use SuperTab continued with UtiSnips.
So first thing Iwant to do is to not have SuperTab mapping any key at all.
Is that possible?
There are several global variables to change mappings like:
g:SuperTabMappingForward
g:SuperTabMappingBackward
But I havent seen anything about avoid keys mappings.
I want to do this because in theory whn Ultisnips cant find any snippet to complete it will try to fallback to supertab automatically.
So I want supertab to be called from UltiSnips, and I dont want any key mapped to supertab.
Thanks!

--
Un saludo
Best Regards
Pablo Giménez

--
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
Bob von Knobloch | 24 May 15:34
Picon

Substitution of metacharacters

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?

Many thanks,

Bob
-- 
The Sun is out, the sky is blue. It's time to drive the MR2.

--

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

Eric Weir | 24 May 13:14

Can vim be made to start with selected files already open?


After starting vim I take a bit of time to load the base files I normally work with. It would be a minor convenience if vim could be made to start with these files already loaded. 

Can it be done? How?

Thanks,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA  USA

"Imagining the other is a powerful antidote to fanaticism and hatred." 

- Amos Oz

--
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
Kartik Agaram | 24 May 01:29

syntax highlighting question

Lisp symbols can usually contain ':', but I'm using a dialect where
':' is special syntax. I'd like to highlight it like parens.

A) My first attempt was the following:

  au BufReadPost *.lisp syntax match Delimiter /:/

(The autocmd is to apply this after any other settings.)

This works on the following file x.lisp:

  abc:def

The ':' is highlighted as expected.

B) However, it doesn't work inside lists:

  (abc:def)

Now the ':' isn't highlighted.

I used this awesome tip to see what was going on:
http://vim.wikia.com/wiki/Identify_the_syntax_highlighting_group_used_at_the_cursor.
Position cursor on the unhighlighted ':', hit <F10> and it shows me
that it thinks the ':' belongs to lispSymbol.

So I dug into the definition of lispSymbol and updated it to not include ':'

  au BufReadPost *.lisp syn clear lispSymbol
  au BufReadPost *.lisp syn match lispSymbol contained ![^()'`,"; \t:]\+!

C) Still no dice. <F10> now shows ':' inside lists to be of type
lispList. Turns out I need to tell vim that lispList can contain
Delimiters:
  au BufReadPost *.lisp syn cluster lispListCluster add=Delimiter

It works!

D) Now I want to make sure a leading ':' at the start of a symbol *is*
treated as part of the symbol. So we only highlight ':' in the middle
or end of a word.

  au BufReadPost *.lisp syn match Delimiter /[^ ]\zs:/

But this again doesn't work inside lists. <F10> shows the ':' is
considered part of lispList just as before I made change (C).

Anybody have any ideas on why? I've attached both the test vimrc and
test x.lisp file. I'm using vim 7.3 and have tested it with the latest
runtime files.

--

-- 
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 (test_vimrc): application/octet-stream, 475 bytes
Attachment (x.lisp): application/octet-stream, 153 bytes
sfosparky | 24 May 00:08
Picon

If in OldFile I :write NewFile, do I need to manually reload NewFile and close OldFile?

For GVIM 7.3, IF I open OldFilename, AND use :write to write its buffer as NewFileName, THEN is there a way to
not have to keep thinking about OldFileName?

That is, I want GVIM to simply begin editing NewFile, period — I don't want to have to manually use :edit to
load NewFile, use :rew to position back to OldFile, and use :bdel to close OldFile.

STEPS:

1. In GVIM, edit OldFile.

2. Type :files  GVIM displays:
   1 %a "OldFile"   line nn

3. Type :write NewFile.txt.  GVIM displays:
   "NewFile" [unix] 10l 100c written

4. Type :files  GVIM displays:
   1 %a "OldFile"   line nn

RESULT: After using :write to write the file under a new name, GVIM creates NewFile in the target directory,
but continues to edit only OldFile.

5. Type :edit Newfile  GVIM displays:
   "NewFile" [unix] 10l 100c

I'd really rather not have to perform step 5, above, to start editing NewFile.

6. Type :files  GVIM displays two lines:
  1 #   "OldFile"   line 10
  2 %a  "NewFile"   line 1

GVIM now has two buffers: (1) An alternate buffer (#, OldFile). and (2) an active/current buffer (%a, NewFile).

7. Use :rew to make OldFile the active buffer, then use :bdel (buffer delete) to close it.

I'd really rather not have to perform the :rew and :bdel steps.  Having saved a file as NewFile, I don't want to
have GVIM holding on to OldFile.

Are all these steps really necessary?  Can some please tell me some more straightforward way to simply write
a file under a new name and begin editing it without all the additional :edit / :rew / :bdel / steps?

Cheers & thanks for your help,
Ric
SFO

--

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

Yichao Zhou | 23 May 16:57
Picon

A problem about record

Hi, everyone.
  Recently I want to change the foldmarker in tex file to <<<,>>>
since there will be less conflict.  So I record a macro
    :%s/{{{/<<</g^M:%s/}}}/>>>/g^M:setlocal fmr=<<<,>>>^M:w^M
  (You need to replace ^M to real ^M)
  However, vim will auto enter insert mode after all is finish, which
I think is a vim's bug.  This can not be reproduced every time.

  The attach file is an example tex file.  Can anyone reproduces this problem?

Regards,
Yichao Zhou

--

-- 
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 (hw10.tex): application/x-tex, 15 KiB
t0d0r | 23 May 16:07
Picon
Gravatar

Multitasking in vim - is that exists?

I use vim a lot and now I'm starting to love using tabs
(:tabnew, :tabfirst...),but  I found that execution of the external
command in one tab blocks the whole vim process.

For example when I execute :make in one tab, I need to wait until this
make finish. Will be very nice if someone provide me a solution how I
can use other tabs in vim when I'm waiting something to finish in
another opened tab. I still need the :copen output of :make command to
be displayed in execution tab. I have same problem with :grep
or :Ack(from :Ack module)...

Regards,
t0d0r

--

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

Manifolds | 23 May 05:01
Picon

Howto print the file containing CJK characters?

I find the MacVim can't print the CJK character correctly after
pressing cmd+P.  I don't know which file should be modified to work
correctly.
Can MacVim  print the line number and change the font size ?

My OS is lion 10.7.4

--

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

Christian Brabandt | 22 May 19:54

Re: vim: how to yank only displayed texts in folding

Hi ping!

On Di, 22 Mai 2012, ping wrote:

> can you let me know how to use this function in practice?
> I tried visual mark then :call func..
> it doesn't work.

Please be exact. What did you do? What happened instead? Did you get an 
error message?

> 
> http://groups.google.com/group/vim_use/msg/dd1baac3622107c0
> 
Take the function CopyNonFoldedI() from here:
http://groups.google.com/group/vim_use/msg/571f070987ee35ce
and copy it into a file which you save below ~/.vim/plugin/CopyFolds.vim

Restart Vim and now you can simply call :call CopyNonFolded() and it 
will create a new split buffer which contains only the fold data.

regards,
Christian

--

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

AndyHancock | 22 May 18:03
Picon

Inserted text missing from blank lines after ctrl-V, vertical highlight, ctrl-I

I am working on a source code file with many blank lines (lines
containing zero characters, not even white space).  The cursor is on
(say) column 5 and I press ctrl-V before highlighting a column of
text.  I then press ctrl-I to insert a comment character in the
highlighted text column.  The comment character does *not* appear at
all in the lines that are blank.

I could be mis-remembering, but I don't seem to recall this behaviour
in the past.  I thought I had vim in a mode where ctrl-V would put in
the required white space to achieve the visual effect, regardless of
whether or not the whitespace was there before.  Is this a recent
change in the behaviour of vim, or is there a specific setting which I
might have muddled up in my romps through vimrc?

--

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


Gmane