Re: how do I get debug output from vim script?

2011-12-07 Thread Marc Weber
https://github.com/c9s/vim-dev-plugin 
=> README "How to debug VimL ?"

are the most useful debugging features I found.

Marc Weber

-- 
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 window size narrower than normal

2011-12-07 Thread alick
于 2011年12月07日 17:44, John Little 写道:
> On Dec 6, 6:27 pm, alick  wrote:
>>
>> When I am in gnome-terminal(80x24) and type gvim to start GVim(GTK),
>> the window lines is less than normal(24 lines). 
> 
> Just a few ideas:
> 
> - Maybe there's an X resource affecting gvim.  You might check the
> output of xrdb -query, maybe grep -i for vim.
> - GTK is a murky world, maybe there's a gtkrc file somewhere
> - gvim honours a -geometry argument.  I use a bash alias
> 
> alias v='gvim -geometry 80x60'
> 
> You could use this as a workaround.
> 

Thank you John. But I still don't get it right (in Gnome Shell).
Here's some additional info:

* xrdb -query gives no info about vim
* 'gvim -geom 80x24' works just like 'gvim', randomly incorrect size.

However, I found no problem while using Fvwm (no gnome-session) as WM.
gvim behaves always right (at least, so far).

-- 
alick
Fedora 16 (Verne) user
https://fedoraproject.org/wiki/User:Alick

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


how do I get debug output from vim script?

2011-12-07 Thread variable local
Hi guys,

I am new on vim script coding. Today I read usr_43.txt, and tried to make a
script to detect the source code with suffix sql3. I did like this,

vim ~/.vim/ftplugin/sqlte3.vim

if exists("b:did_ftplugin")
echo "yes : did_ftpplugin"
finish
elseif
echo "no : did_ftplugin"
endif

let b:did_ftplugin = 1

if did_filetype()
echo "yes : did_filetype"
finish
elseif
echo "no : do file type"
endif

And then I edit ~/.vim/ftdetect/sql3.vim, the content is the following,

au BufRead,BufNewFile *.sql3 set filetype=sql3

Now I wanna test it work or not. I vim test.sql3, but I get nothing output
from vim status bar.
I would like to know how do I know my function is working?

-- 
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: Scrolling Long Lines Revisited. Again.

2011-12-07 Thread Gary Johnson
On 2011-11-30, John Beckett wrote:
> James Cole wrote:
> >> This seems like a perennial topic[1], that regularly gets
> >> dismissed --
> >> vertically scrolling by "screen lines" vs. "real lines".
> >
> > I feel the same way.
> 
> So do I, as I have recently done some editing of text where a
> paragraph is a long line (possibly thousands of characters).
> 
> Particularly annoying is doing diffs with such files:
> Vim does everything well, but when a change is near the end of a
> long paragraph, it is impossible to see it due to scrolling.

I used to think that this change was needed only by users who
created really long lines of text and I figured if it hurts when you
do that, then don't do that.

I just spent the last week poring over log files and searching for
clues to a series of system crashes.  Some of those log files have
hugely long lines (e.g., 71,160 characters).  The way that Vim
currently handles such long lines made it difficult to scroll
through those log files without missing information at the ends of
those lines.

I haven't thought through all the implications of making such a
change, but being able to scroll through long lines as easily as gj
and gk move the cursor through them would sure make my life easier.

Regards,
Gary

-- 
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: LaTeX-ize vim

2011-12-07 Thread Marc Weber
> :inoremap  "dwi\begin{w}
> 0\end{w}

And what should this do?
get snipmate and snipmate-snippets or any of the other snippet engines.
Don't reinvent the wheel, please.

Right now I don't understand what " should do. Doesn't make
much sense to me.

If you're wondering how to install those plugins read :h plugin and put
the files into ~/.vim or use any of the existing plugin managers such as
vim-addon-manager, pathogen, vundle. I personally recommend the first
cause I'm the author of it and because it handles dependencies in a poor
way - but it does.

You eventually also want to learn about
- tags (so that you can jump to sections) or plugins such as TToC
- folding

Marc Weber

-- 
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 using :g/pattern/command

2011-12-07 Thread Gary Johnson
On 2011-12-06, Tim Chase wrote:
> On 12/06/11 17:13, Gary Johnson wrote:
> > :%s/^.*[[:backspace:]]//
> >
> >but I'm looking for a more general solution that also fixes lines
> >where the user has backspaced over a
> 
> You might try:
> 
> :%s/\(\_[^[:backspace:]]\+\)\([[:backspace:]]\+\)/\=strlen(submatch(1))==strlen(submatch(2))?'':(submatch(1)[:(strlen(submatch(1))-(strlen(submatch(2))+1))])/ge
> 
> It's a bit ugly, but seems to work pretty quickly against all the
> tests I threw at it.

Thanks.  It seems to work fine when applied to the whole file (even
though the message, "275 substitutions on 1 line", was odd), but
when applied to just one line or to a range of lines, it also
partially modifies the next line below the range.  I can't attach
the actual file, but here's a sanitized region with actual
backspaces replaced by the two-character sequence "^H".  The large
gaps between sequences of backspaces each contain 28 spaces.  Those
two longest lines may not come through e-mail correctly.


Line of stuff one
Line of stuff two
[more 19%] 
(q,g,space,enter)^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H   
 
^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HLine of stuff three
Line of stuff four
Line of stuff five
[more 28%] 
(q,g,space,enter)^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H   
 
^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HLine of stuff six
Line of stuff seven
Line of stuff eight


Applying your substitute command to only the "Line of stuff three" line results 
in the following (with actual backspaces again replaced by "^H").


Line of stuff one
Line of stuff two
Line of stuff three
Line of stuff four
Line of stuff five

^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^HLine of stuff six
Line of stuff seven
Line of stuff eight


The "Line of stuff six" line begins with 28 spaces.

Regards,
Gary

-- 
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 Win32 on Win7 suddenly very slow to load

2011-12-07 Thread George V. Reilly
On Wed, Dec 7, 2011 at 9:16 AM, Ben Fritz  wrote:
> On Dec 6, 11:44 pm, Greg Underwood  wrote:
> > Good to know!  I have mostly stuck with the tried-and-true official
> > releases from vim.org, which I know are behind the times a bit.  Unless VIM
> > starts misbehaving, I'm cool with sticking to the official releases - my
> > editor is my dialtone - not something I tinker with unless it ain't working
> > or there's a clearly much better one available.  :D
> >
> > Knowing that there's someone out there who rolls a package with the basic
> > VIM stuff, but up to date, is worth looking into!
> >
>
> You can see what you'd be getting if you upgraded, here:
>
> ftp://ftp.vim.org/pub/vim/patches/7.3/README
>
> There are a few really nice goodies in there, plus some easy-to-get
> errors which have been fixed.
>
> Also, if you upgrade, you'd be getting an all-new set of runtime
> files, including improved syntax highlighting, better TOhtml
> conversion, bugfixes in the netrw plugin (used to "edit" directories
> on local or remote systems, or files on remote systems via FTP or
> other protocols), and much more.

If you want to dig in to the changes, far better to look at
http://code.google.com/p/vim/source/list
--
/George V. Reilly  geo...@reilly.org  Twitter: @georgevreilly
http://www.georgevreilly.com/blog  http://blogs.cozi.com/tech

-- 
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: Combining normal commands and an exe in a map

2011-12-07 Thread Dotan Cohen
On Wed, Dec 7, 2011 at 19:01, Ben Fritz  wrote:
> First, your mapping command is missing a left-hand-side. You need to
> tell Vim what you want to press to trigger your mapping. E.g. nmap
>  :echo 'foo' if you want to press the  key to echo the
> text "foo" on your screen.
>
> Second, since you're starting from normal mode, you need to finish off
> your ex command with a  or the equivalent .
>
> Remember mappings are telling Vim to execute each character basically
> as if you typed them in yourself. You need to press  to finish
> executing a search manually, so your mapping needs to do this as well.
>
> Two suggestions, however:
>
> 1. Use nnoremap instead of nmap to avoid accidentially triggering any
> mappings while executing your mapping.
> 2. Use an expression mapping, which would allow you to eliminate the
> exe altogether. See :help :map-.
>

Thank you Ben. Interestingly, I had to move the cursor over two
places, which is one more than I did when typing the commands by hand.
Here is the final result:
nnoremap  0f- :exe '/^.\{'.(col(".")-2).'\}-'

I learned a lot from your post, especially regarding nnoremap. Thank
you for your help!

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

-- 
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: LaTeX-ize vim

2011-12-07 Thread Juanjo Gomez Navarro
> try this mapping (it's one single line):
>
>  :nnoremap  "wciw\begin{w}  
> 0\end{w}
>
> Regards,
> Jürgen
>
> --
> Sometimes I think the surest sign that intelligent life exists elsewhere
> in the universe is that none of it has tried to contact us.     (Calvin)
>
> --
> 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

Thanks. Now I would like it also to work in insert mode (as well as
taking advance of this opportunity to learn a bit about creating maps
:D)

I have implemented this map:

:inoremap  "dwi\begin{w}
0\end{w}

which more or less work, although the indentation is wrong (not a big
deal since vim fixes it when autoindent is on). However I don't really
understand why this works. In particular I don't know how the word is
deleted in you map, and what's the meaning of the  w command,
which apparently pastes the original word.

Thank you.

-- 
Juan José Gómez Navarro

Departamento de Física
Centro de Investigacion en Óptica y Nanofísica (CIOyN)
Universidad de Murcia
Campus Espinardo
E-30100 Murcia
España

Tel : +34 868 888 552
Fax : +34 868 888 568
Email: juanjo.gomeznava...@gmail.com, jjgomeznava...@um.es

-- 
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 Win32 on Win7 suddenly very slow to load

2011-12-07 Thread Ben Fritz


On Dec 6, 11:44 pm, Greg Underwood  wrote:
> Good to know!  I have mostly stuck with the tried-and-true official
> releases from vim.org, which I know are behind the times a bit.  Unless VIM
> starts misbehaving, I'm cool with sticking to the official releases - my
> editor is my dialtone - not something I tinker with unless it ain't working
> or there's a clearly much better one available.  :D
>
> Knowing that there's someone out there who rolls a package with the basic
> VIM stuff, but up to date, is worth looking into!
>

You can see what you'd be getting if you upgraded, here:

ftp://ftp.vim.org/pub/vim/patches/7.3/README

There are a few really nice goodies in there, plus some easy-to-get
errors which have been fixed.

Also, if you upgrade, you'd be getting an all-new set of runtime
files, including improved syntax highlighting, better TOhtml
conversion, bugfixes in the netrw plugin (used to "edit" directories
on local or remote systems, or files on remote systems via FTP or
other protocols), and much more.

-- 
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: Combining normal commands and an exe in a map

2011-12-07 Thread Ben Fritz


On Dec 7, 10:41 am, Dotan Cohen  wrote:
> Dalker on StackOverflow [1] recently helped me concoct this terrific
> exe for navigating xdebug traces:
> :exe '/^.\{'.(col(".")-1).'\}-'. Before I use it, I must 0f- to ensure
> that I am on the first dash of the line. I would like to map this all
> to the ` key (I use ' for marks) but I seem to have trouble combining
> the regular commands with the exe:
> nmap 0f-:exe '/^.\{'.(col(".")-1).'\}-'
>
> Obviously I am missing something, but all my googling turns up
> nothing. What keywords should I be googling, or what part of the fine
> manual should I be reading? Thanks.
>

First, your mapping command is missing a left-hand-side. You need to
tell Vim what you want to press to trigger your mapping. E.g. nmap
 :echo 'foo' if you want to press the  key to echo the
text "foo" on your screen.

Second, since you're starting from normal mode, you need to finish off
your ex command with a  or the equivalent .

Remember mappings are telling Vim to execute each character basically
as if you typed them in yourself. You need to press  to finish
executing a search manually, so your mapping needs to do this as well.

Two suggestions, however:

1. Use nnoremap instead of nmap to avoid accidentially triggering any
mappings while executing your mapping.
2. Use an expression mapping, which would allow you to eliminate the
exe altogether. See :help :map-.

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


Combining normal commands and an exe in a map

2011-12-07 Thread Dotan Cohen
Dalker on StackOverflow [1] recently helped me concoct this terrific
exe for navigating xdebug traces:
:exe '/^.\{'.(col(".")-1).'\}-'. Before I use it, I must 0f- to ensure
that I am on the first dash of the line. I would like to map this all
to the ` key (I use ' for marks) but I seem to have trouble combining
the regular commands with the exe:
nmap 0f-:exe '/^.\{'.(col(".")-1).'\}-'

Obviously I am missing something, but all my googling turns up
nothing. What keywords should I be googling, or what part of the fine
manual should I be reading? Thanks.


[1] http://stackoverflow.com/questions/8402412/vim-navigating-xdebug-traces

-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com

-- 
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: LaTeX-ize vim

2011-12-07 Thread Juanjo Gomez Navarro
Thanks for the fast reply. All your suggestions worked perfectly.


-- 
Juan José Gómez Navarro

Departamento de Física
Centro de Investigacion en Óptica y Nanofísica (CIOyN)
Universidad de Murcia
Campus Espinardo
E-30100 Murcia
España

Tel : +34 868 888 552
Fax : +34 868 888 568
Email: juanjo.gomeznava...@gmail.com, jjgomeznava...@um.es

-- 
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: LaTeX-ize vim

2011-12-07 Thread Marc Weber
You want to create ~/.vim/ftplugin/(la)tex.vim
file and set your Vim settings there using :setlocal spell= XXX or such.
Also make sure to enable plugin support etc as show top in
https://github.com/MarcWeber/vim-addon-manager/blob/master/autoload/sample_vimrc_for_new_users.vim

For compilation you may want to consider using wrappers such as the python 
rubber
script.

There is an alternative to VIM-LaTex which is called "AutomaticTexPlugin". Use 
whatever works best for you.

Marc Weber

-- 
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: LaTeX-ize vim

2011-12-07 Thread Tim Gray

On Dec 07, 2011 at 02:05 PM +0100, Juanjo Gomez Navarro wrote:

What I would like is that when I open a latex document (this is, a
file with extension "tex"), the spelling corrector gets activated, and
the words are not cut in the middle of two lines.


This one is pretty straight forward.  Create the file 
~/.vim/after/ftplugin/tex.vim.  In it put:


setlocal lbr
setlocal spell

You could also put those commands as auto commands in your vimrc:

au FileType tex setlocal spell

--
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: LaTeX-ize vim

2011-12-07 Thread Juanjo Gomez Navarro
Thanks. The mapping works perfectly, and I'll take a look at ATP too.
It looks promising :D

Any tip about how getting different options/mappings to be switched
on/off when different files are opened?


-- 
Juan José Gómez Navarro

Departamento de Física
Centro de Investigacion en Óptica y Nanofísica (CIOyN)
Universidad de Murcia
Campus Espinardo
E-30100 Murcia
España

Tel : +34 868 888 552
Fax : +34 868 888 568
Email: juanjo.gomeznava...@gmail.com, jjgomeznava...@um.es

-- 
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: LaTeX-ize vim

2011-12-07 Thread Marcin Szamotulski
Hi,

You can check the tab completion feature in ATP:
http://atp-vim.sf.net

Note that in 10.6.2 (which is available as a snapshot) the tab completion
(using the TAB key and SHIFT-TAB key) moves to vim omni-completion
(i_CTRL-X_CTRL-O), which still doesn't work as good as the tab completion in
earlier versions.

Best,
Marcin (ATP author)

On 14:05 Wed 07 Dec , Juanjo Gomez Navarro wrote:
> Good morning, I use vim to type my LaTeX documents. I'm aware of the
> latex-vim package, but it is too sophisticated to my needs now.
> Instead, I would like just to perform very simple tweaks.
> 
> What I would like is that when I open a latex document (this is, a
> file with extension "tex"), the spelling corrector gets activated, and
> the words are not cut in the middle of two lines.
> 
> On the other hand, it would be great to have a macro which auto
> completes some tasks. For example, I would like that if I press F5 in
> a word, then it is automatically replaced by the text:
> 
> \begin{word}
>  (the cursor gets this position automatically)
> \end{word}
> 
> 
> Do some know how to get this behaviour?
> 
> Thank you very much.
> 
> 
> 
> --
> Juan José Gómez Navarro
> 
> Departamento de Física
> Centro de Investigacion en Óptica y Nanofísica (CIOyN)
> Universidad de Murcia
> Campus Espinardo
> E-30100 Murcia
> España
> 
> Tel : +34 868 888 552
> Fax : +34 868 888 568
> Email: juanjo.gomeznava...@gmail.com, jjgomeznava...@um.es
> 
> -- 
> 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

-- 
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: LaTeX-ize vim

2011-12-07 Thread Jürgen Krämer

Hi,

Juanjo Gomez Navarro wrote:
> 
> On the other hand, it would be great to have a macro which auto
> completes some tasks. For example, I would like that if I press F5 in
> a word, then it is automatically replaced by the text:
> 
> \begin{word}
>  (the cursor gets this position automatically)
> \end{word}

try this mapping (it's one single line):

  :nnoremap  "wciw\begin{w}  
0\end{w}

Regards,
Jürgen

-- 
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)

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


LaTeX-ize vim

2011-12-07 Thread Juanjo Gomez Navarro
Good morning, I use vim to type my LaTeX documents. I'm aware of the
latex-vim package, but it is too sophisticated to my needs now.
Instead, I would like just to perform very simple tweaks.

What I would like is that when I open a latex document (this is, a
file with extension "tex"), the spelling corrector gets activated, and
the words are not cut in the middle of two lines.

On the other hand, it would be great to have a macro which auto
completes some tasks. For example, I would like that if I press F5 in
a word, then it is automatically replaced by the text:

\begin{word}
 (the cursor gets this position automatically)
\end{word}


Do some know how to get this behaviour?

Thank you very much.



--
Juan José Gómez Navarro

Departamento de Física
Centro de Investigacion en Óptica y Nanofísica (CIOyN)
Universidad de Murcia
Campus Espinardo
E-30100 Murcia
España

Tel : +34 868 888 552
Fax : +34 868 888 568
Email: juanjo.gomeznava...@gmail.com, jjgomeznava...@um.es

-- 
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 window size narrower than normal

2011-12-07 Thread John Little
On Dec 6, 6:27 pm, alick  wrote:
>
> When I am in gnome-terminal(80x24) and type gvim to start GVim(GTK),
> the window lines is less than normal(24 lines). 

Just a few ideas:

- Maybe there's an X resource affecting gvim.  You might check the
output of xrdb -query, maybe grep -i for vim.
- GTK is a murky world, maybe there's a gtkrc file somewhere
- gvim honours a -geometry argument.  I use a bash alias

alias v='gvim -geometry 80x60'

You could use this as a workaround.

Regards, John
-

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