Tuesday, November 30, 2010

Re: How to find start/end of char-wise visual selection?

On Wed, December 1, 2010 4:26 am, AK wrote:
>
> Hi, this is for Vim7.3.. Looking up docs for line(), it says that
> arg='.' will give you cursor position, and 'v' will give you beginning
> of visual selection when in visual mode, and '.' will give you the end
> of it. For column, col() should be used, but there's no 'v' arg for it.

Yeah, I remember, I wondered about it too. I even thought about creating
a patch, but didn't so far, because you can easily get the column using
the getpos() function together with the marks '< for start and '> for end
of visual selection. For my plugin NrrwRgn, I use getpos("'>") for the line
and virtcol("'>") for the virtual column of the end of the visual selection
(and the same for the start of the visual selection).

> So, how can I do this? Let's say I have a char-wise selection from
> column 10 to 20, how can I get numbers 10 and 20? -ak

echo "start at line " getpos("'<")[1] " column: " virtcol("'<")
echo "end at line " getpos("'>")[1] " column: " virtcol("'>")

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

How to find start/end of char-wise visual selection?

Hi, this is for Vim7.3.. Looking up docs for line(), it says that
arg='.' will give you cursor position, and 'v' will give you beginning
of visual selection when in visual mode, and '.' will give you the end
of it. For column, col() should be used, but there's no 'v' arg for it.

So, how can I do this? Let's say I have a char-wise selection from
column 10 to 20, how can I get numbers 10 and 20? -ak

--
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: Another question: forking

On Tue, 30 Nov 2010, Gary Johnson wrote:
>>>> gvim used to fork and run in the background. 7.2 doesn't seem to do this.
>>> Well, it does for most. How are you invoking gvim? I'd suspect an
>>> alias or script getting in the way.
>> Try
>> gvim -u NONE
>> That'll be a start at tracking down the cause of your difficulty.
> Also, you may want to use the full path name to gvim (e.g.,
> /usr/bin/gvim) to avoid local scripts, functions or aliases.

When I do that, it still doesn't fork (although I can tell I am not getting
local scripts because the font that is set in my .vimrc is no longer being
used.)

I managed to "solve" my problem by downloading gvim 7.3 and using that instead
of the 7.2.284 that comes with Mandriva. When I download it myself and compile
it myself, it forks.

--
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: filter txt file based on start and ending marks

On 11/30/2010 04:01 PM, bboyjkang wrote:
> line that contains "interesting", for a total of 3 lines, or perhaps
> the entire paragraph that contains "interesting". Then, "start" is
> automatically put at the top of the paragraph/line(s), and "end" is
> put at the bottom of the paragraph/line(s).

Oh, I missed the paragraph bits...if they're blank-line separated
paragraphs, you can use the range '{,'} as in

g/interesting/sil! '{,'}s/^/XXX

You can read about those marks at

:help '{
:help '}

-tim

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

Re: filter txt file based on start and ending marks

On 11/30/2010 04:01 PM, bboyjkang wrote:
>> :g/interesting/sil! ?start?,/end/s/^/XXX/
>> :v/^XXX/d
>> :%s/^XXX
>
> Is the "start" and "end" something you have to add yourself? Is it
> possible to do this: Let's say that once I find the pattern
> "interesting", I'd like to select the line that contains
> "interesting", or maybe include the line above and the line below that
> line that contains "interesting", for a total of 3 lines, or perhaps
> the entire paragraph that contains "interesting". Then, "start" is
> automatically put at the top of the paragraph/line(s), and "end" is
> put at the bottom of the paragraph/line(s). Now, I can do pattern
> matches or substitutions only on ranges between "start" and "end" that
> surround "interesting".

(Rearranged to trimmed inline-quoting rather than top-posting, as
is preferred on the mailing-list)

Yes, you can give other relative ranges. Note that it breaks down as

:g/pattern/action_to_perform_on_matching_lines

where action happens to be

<range>s/foo/bar/

(prefixed with "sil!" as previously detailed) and where <range>
happens to be "search backwards for pattern A, through searching
forwards to pattern B". For the line above/below version, you
could just change the range from the complex searches to
".-1,.+1" or more tersely, "-,+" as searches are relative to the
current line (the line found by each :g hit) so the "." is
optional, and adding/subtracting lines defaults to 1 if omitted.

:help :range

That would make the command

:g/interesting/sil! .-1,.+1s/^/XXX
or
:g/interesting/sil! -,+s/^/XXX

To adjust the number of lines of context, just change the "-1" to
however many lines you want before, and the "+1" to however many
lines you want after.

Note that you might hit a fence-posting case if the last
"interesting" match, plus whatever forward-context you want (in
this case, one line; in the previous case, searching forward to a
pattern) puts you beyond the end-of-file. So you might want to
hand-verify the final "interesting" match in the file.

-tim

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

Re: filter txt file based on start and ending marks

Hey Tim

Is the "start" and "end" something you have to add yourself? Is it
possible to do this: Let's say that once I find the pattern
"interesting", I'd like to select the line that contains
"interesting", or maybe include the line above and the line below that
line that contains "interesting", for a total of 3 lines, or perhaps
the entire paragraph that contains "interesting". Then, "start" is
automatically put at the top of the paragraph/line(s), and "end" is
put at the bottom of the paragraph/line(s). Now, I can do pattern
matches or substitutions only on ranges between "start" and "end" that
surround "interesting".

Thanks for any info


On Nov 28, 1:56 pm, Tim Chase <v...@tim.thechases.com> wrote:
> On 11/28/2010 09:07 AM, Jeri Raye wrote:
>
> > I was wondering to search for certain patterns in the log file and
> > provide a start and end mark for the interresting stuff.
> > And then delete all that isn't in the selected sections.
> > Is that possible?
>
> While it's a little hard to determine the particulars from your
> description and pseudo-examples, the general process I use to do
> something similar looks like
>
>    :g/interesting/sil! ?start?,/end/s/^/XXX/
>    :v/^XXX/d
>    :%s/^XXX
>
> This searches for every line matching the pattern "interesting",
> then searches backwards for the pattern "start" as the beginning
> of the range, and forward to the pattern "end".  With each of
> those start...end ranges, it tacks on a unique prefix (in this
> case, "XXX")  The "sil!" is just to prevent it from reporting
> action on every matching line because it annoys me :)
>
> Now that you've found and marked the interesting stuff, you can
> delete the rest (the "v/^XXX/d").
>
> Finally, remove the "XXX" marker leaving you with just what you want.
>
> Each of those patterns can be an arbitrary regexp, so you can use
> multiple conditions:
>
>    :g/foo\|bar\|baz/sil! ...
>
> Alternatively, I'll use ">" as my command instead of "s/^/XXX" to
> indent the lines of interest (best done with 'noet' and 'sw'='ts'
> so you get one tab of indent), delete the non-indented lines, and
> then un-indent the indented lines:
>
>    :g/interesting/sil! ?start?,/end/>
>    :v/^\t/d
>    :%<
>
> Hope this gives you a general pattern you can use.
>
> -tim

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

Re: filter txt file based on start and ending marks

Hey Tim

Is the "start" and "end" something you have to add yourself? Is it
possible to do this: Let's say that once I find the pattern
"interesting", I'd like to select the line that contains
"interesting", or maybe include the line above and the line below that
line that contains "interesting", for a total of 3 lines, or perhaps
the entire paragraph that contains "interesting". Then, "start" is
automatically put at the top of the paragraph/line(s), and "end" is
put at the bottom of the paragraph/line(s). Now, I can do pattern
matches or substitutions only on ranges between "start" and "end" that
surround "interesting".

Thanks for any info


On Nov 28, 1:56 pm, Tim Chase <v...@tim.thechases.com> wrote:
> On 11/28/2010 09:07 AM, Jeri Raye wrote:
>
> > I was wondering to search for certain patterns in the log file and
> > provide a start and end mark for the interresting stuff.
> > And then delete all that isn't in the selected sections.
> > Is that possible?
>
> While it's a little hard to determine the particulars from your
> description and pseudo-examples, the general process I use to do
> something similar looks like
>
>    :g/interesting/sil! ?start?,/end/s/^/XXX/
>    :v/^XXX/d
>    :%s/^XXX
>
> This searches for every line matching the pattern "interesting",
> then searches backwards for the pattern "start" as the beginning
> of the range, and forward to the pattern "end".  With each of
> those start...end ranges, it tacks on a unique prefix (in this
> case, "XXX")  The "sil!" is just to prevent it from reporting
> action on every matching line because it annoys me :)
>
> Now that you've found and marked the interesting stuff, you can
> delete the rest (the "v/^XXX/d").
>
> Finally, remove the "XXX" marker leaving you with just what you want.
>
> Each of those patterns can be an arbitrary regexp, so you can use
> multiple conditions:
>
>    :g/foo\|bar\|baz/sil! ...
>
> Alternatively, I'll use ">" as my command instead of "s/^/XXX" to
> indent the lines of interest (best done with 'noet' and 'sw'='ts'
> so you get one tab of indent), delete the non-indented lines, and
> then un-indent the indented lines:
>
>    :g/interesting/sil! ?start?,/end/>
>    :v/^\t/d
>    :%<
>
> Hope this gives you a general pattern you can use.
>
> -tim

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

Re: Pattern limits selection for next pattern or substitution

Thanks Tinou and Geoff.

@Geoff

That thread was just what I needed. The one that's just a tad off is
that before attaching the XXX prefix, it has to find the pattern
"start" and "end". At first, I thought that after finding a match, it
attaches a "start" to indicate the beginning of the mark, and "end" to
indicate the end. It looks as if you have to add "start" and "end"
yourself to bound the selection.

I'll try to figure out how to find the match, move up a bit to add a
start prefix, and then move down to add a postfix. I can then use
those to restrict the search.

On Nov 30, 3:57 am, lessthanideal <geoffrey.w...@thomsonreuters.com>
wrote:
> On Nov 30, 7:44 am, bboyjkang <jkan...@gmail.com> wrote:
>
>
>
> > Hi
>
> > I'm wondering if it's possible to do this in Vim:
> > You put up a command with a pattern, and the command selects the line
> > (or offsets to select a few surrounding lines in addition to the line)
> > that contains the pattern. Once all these lines that contain the
> > pattern are selected, I want to do a pattern search and pattern
> > substitution that is limited to only those lines that were selected by
> > the first pattern.
>
> > I came across this search/replace in a visual selection link:http://vim.wikia.com/wiki/Search_and_replace_in_a_visual_selection
>
> > :'<,'>s/red/green/g
>
> > I would like the :'<,'> to be instead a (does it have to be visual?)
> > selection of all those lines that contain the pattern. Then, I could
> > do a substitution, or a pattern search that might further restrict the
> > selection.
>
> > Thanks for any help
>
> Does this recent thread answer your question? [1] In the first step of
> Tim Chase's answer maybe he does what you want. Where he tacks on a
> unique prefix with s/^/XXX/ that is a standard search/replace command.
>
> If you specifically want to *select* a set of lines, i.e. use select
> or visual mode or similar, I'm not sure.
>
> regards, Geoff
>
> (Link all one line)
>
> [1]http://groups.google.com/group/vim_use/browse_thread/thread/61fef2ed8...

--
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: Another question: forking

On 2010-11-30, Charles Campbell wrote:
> John Little wrote:
> >
> >On Nov 29, 3:57 pm, arrom...@rahul.net (Ken Arromdee) wrote:
> >
> >>gvim used to fork and run in the background. 7.2 doesn't seem to do this.
> >>
> >Well, it does for most. How are you invoking gvim? I'd suspect an
> >alias or script getting in the way.
> >
>
> Try
>
> gvim -u NONE

...

> That'll be a start at tracking down the cause of your difficulty.

Also, you may want to use the full path name to gvim (e.g.,
/usr/bin/gvim) to avoid local scripts, functions or aliases.

$ which -a gvim

will show you all the gvims in your PATH (and maybe aliases and
functions, too, depending on the definition of your 'which').

HTH,
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: Licenses on scripts?

Johannes Hoff wrote:

> I just got a request from a user of my Arduino syntax file for vim
> [1]. He asks if I could put a license on it. I'm thinking the MIT
> license or perhaps creative commons (CC-BY).
>
> It's not a big deal for a syntax file of course, but is there any
> standard for this? Anything I should think of to make sure it can be
> included in vim proper at some point [2]? I've seen one case of
> reusing the vim license [3], but it doesn't really seem to fit.

You can use the Vim license. If you are not happy with that, make sure
that the lincense you pick is compatible with the Vim license, otherwise
you would need to dual-license it for distribution with Vim. Note that
this isn't so easy to verify.

--
If you had to identify, in one word, the reason why the
human race has not achieved, and never will achieve, its
full potential, that word would be "meetings."

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

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

The 'default highlighting' after loading empty (each line commented) syntax file

Hi,

I'm writing my own syntax file. From the beginning I came across some problems. Whereas some of them I'm going to solve myself, one of the problems appears to be solved at the beginning.

I created a syntax file in which I commented each line. Basically, that file looks like below:

(BOF)
" syn some text
" syn some text
" syn some text
(...)
" highlight some text
(EOF)

I named my syntax file as test01.vim and I put it into vim72\syntax folder.

Then I opened my file with my language.
Then I cleared syntax by executing :cal SetSyn(""). As a result of that I've got white text on the black background. That is fine.
Then I called my syntax file by executing :cal SetSyn("test01.vim") and as a result of doing that a surprise: instead of having expected no change (becouse I didn't define anything in my syntax file) and still having white text on black background I've got some highighting in a two colors: yellow (words as 'on' and 'check') and purple (numbers and everything in  " ").

What's happened?

What is that 'default highlighting' from?

Kamil



--
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: Emacs' Org-mode clone for Vim

On Nov 29, 9:31 pm, ZyX <zyx....@gmail.com> wrote:
> some additional notes:
> 1.
>     if !exists('g:org_agenda_dirs')
>         execute "let g:org_agenda_dirs =['".expand("%:p:h")."']"
>     endif
> execute is not required here:
>     let g:org_agenda_dirs=[expand("%:p:h")]
> works just fine and does not break if filename contains newlines.
>
> Review all executes, they are unneeded in most cases and may even cause security
> issues.

Thanks, yes, I had noticed recently that I was now doing same thing
without executes. Need to edit previous uses.
>
> 2. You still have lots of global variables that are not options (though with
> org_ prefix). Why don't you like script variables?
>

Yeah, that's on my list of things to review. Not like script
variables? No, I wouldn't say that. But when writing something up
it's often much easier to use globals, makes them easier to modify and
experiment with them from command line as you're testing. I guess I
could write wrapper function to allow editing of s:vars from command
line, same way as I now have global a OrgSID() function that allows me
to call script local functions from the command line.

Regards,

Herb

--
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: [HELP]inoremap problem

On Tue, 30 Nov 2010, Zhanglistar wrote:

> :inoremap ( ()<ESC>i
> :inoremap ) <c-r>=ClosePair(')')<CR>
> :inoremap { {}<ESC>i
> :inoremap } <c-r>=ClosePair('}')<CR>
> :inoremap [ []<ESC>i
> :inoremap ] <c-r>=ClosePair(']')<CR>
> :inoremap < <><ESC>i
> :inoremap > <c-r>=ClosePair('>')<CR>
>
> function ClosePair(char)
> if getline('.')[col('.') - 1] == a:char
> return "\<Right>"
> else
> return a:char
> endif
> endf
>
> I have added the lines above to my vimrc, but vim does't automatically
> complete bracket, What's wrong with my vim?

I assume you have trouble only with '<'? You need to change:

:inoremap < <><ESC>i

to:

:inoremap < <lt>><ESC>i

See #3 under: :help <>

With that change, all of your mappings work fine for me.

--
Best,
Ben

--
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 on GVIM windows? It keeps opening the help menu

On 11/30/2010 09:03 AM, Reckoner wrote:
> I have tried doing
>
> imap<M-h> <left>
>
> but when I do<Alt-h> in GVIM 7.2 on MS Windows, I keep activating the
> help menu.
>
> Thanks!
>

You can do this:

:set winaltkeys=no

This will disable *all* gui menu alt-keys.

Alternatively you can edit menu.vim included with vim and change
shortcuts for any menu as needed. -ak

--
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: Another question: forking

John Little wrote:
>
> On Nov 29, 3:57 pm, arrom...@rahul.net (Ken Arromdee) wrote:
>
>> gvim used to fork and run in the background. 7.2 doesn't seem to do this.
>>
> Well, it does for most. How are you invoking gvim? I'd suspect an
> alias or script getting in the way.
>

Try

gvim -u NONE

to avoid .vimrc/.gvimrc/plugin effects. Does gvim fork?

Then try

gvim -U NONE

to avoid .gvimrc effects. Does gvim fork?

Then try

gvim -u NORC

to avoid .vimrc but load plugins. Does gvim fork?

That'll be a start at tracking down the cause of your difficulty.

Regards,
Chip Campbell

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

Problem with new line anchor in new syntax file

Hi,

I'm using Vim 7.2 under XP x32

I don't know why, the new line anchor seems not working in my syntax file which I'd like to prepare for myself.

I want to highlight the 'Test' word which is at the beginning of the line. To do that I use:

syn match tsTestName /^Test/
highlight link tsTestName Special

and it didn't highlight.

Any suggestions?

Kamil

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

Calling gvim remotely doesn't bring gvim to the foreground

I recently switched to Win7 (from XP), and when gvim is called with
the --remote flag, it is behaving differently.

When in Visual Studio, I like to use gvim as my editor. To do so, I
call gvim with the following arguments:
--servername VS_NET --remote-silent "+call cursor($(CurLine),
$(CurCol))" $(ItemPath)

In Windows XP, calling gvim in this manner would bring it to the
forground, so I could start editing right away.

But in Win7, if gvim with the servername VS_NET is already open, while
it does send the file to gvim, it doesn't bring it to the foreground,
forcing me to manually switch to it.

Yeah, I know, it's a minor thing, but I really liked the previous
functionality. Does anybody know if it's possible for me to get it
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

[HELP]inoremap problem

:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>

function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf

I have added the lines above to my vimrc, but vim does't automatically complete bracket,
What's wrong with my vim?
The vimrc is as follows:
  
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/
debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
"    \| exe "normal g'\"" | endif
"endif

" Uncomment the following to have Vim load indentation rules according to the
" detected filetype. Per default Debian Vim only load filetype specific
" plugins.
"if has("autocmd")
"  filetype indent on
"endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd        " Show (partial) command in status line.
"set showmatch        " Show matching brackets.
"set ignorecase        " Do case insensitive matching
"set smartcase        " Do smart case matching
"set incsearch        " Incremental search
"set autowrite        " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a        " Enable mouse usage (all modes) in terminals

" Source a global configuration file if available
" XXX Deprecated, please move your changes here in /etc/vim/vimrc
filetype plugin on
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
syntax on
set expandtab
set tabstop=4
set autoindent shiftwidth=2
set autochdir
set cindent
set shiftwidth=4
let mapleader=","
map <silent><leader>w : w<cr>
map <silent><leader>qa : qa<cr>
map <silent><leader>qq : q!<cr>
map <silent><leader>wq : wq<cr>
map <silent><leader>q : q<cr>
"Taglist
map <silent><leader>tl :TlistToggle<cr>
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
set nohlsearch
let &termencoding=&encoding
set fileencodings=cp936,ucs-bom,utf-8,gbk
set fileencoding=cp936
"set encoding=cp936
set encoding=utf-8
"colorscheme desert
"colorscheme molokai
" cscope
if has("cscope")
    set csprg=/usr/bin/cscope
    set csto=1
    set cst
    set nocsverb
    " add any database in current directory
    if filereadable("cscope.out")
        cs add cscope.out
    endif
    set csverb
endif
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" bufexploer
map <silent><leader>be :BufExplorer<cr>
map <silent><leader>bs :BufExplorerHorizontalSplit<cr>
map <silent><leader>bv :BufExplorerVerticalSplit<cr>
" quickfix
nmap <F6> :cn<cr>
nmap <F7> :cp<cr>
nmap <F5> :make<cr>
nmap <F8> :cw<cr>
" press control + s to save
"imap <C-c> <ESC> :w<cr>
"nmap <C-c> <ESC> :w<cr>
" quick jump between splits
map <C-j> <C-w>j<C-w>_
map <C-k> <C-w>k<C-w>_
map <C-l> <C-w>l<C-w>_
map <C-h> <C-w>h<C-w>_

" A.vim
map <silent><leader>a :A<cr>
" NERD_tree
map <silent><leader>t :NERDTreeToggle<cr>
" another explorer
map <silent><leader>e :Ex<cr>
" only one window
map <silent><leader>m :only<cr>
" omnicppcomplete
set completeopt=menu
let OmniCpp_SelectFirstItem = 0
map <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
set tags+=/home/listar/cppstltags
" pydiction
filetype plugin on
let g:pydiction_location = '/home/listar/.vim/tools/pydiction/complete-dict'
"php set
"au FileType php source /usr/share/vim/vim72/colors/murphy.vim
let g:phpColor = "murphy"
let g:defaultColor = "desert"
"au! FileType * exe ":colorscheme " . g:defaultColor
"au! FileType php exe ":colorscheme " . g:phpColor
" neocomplcache
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
 let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
colorscheme desertEx

THANKS!

--
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 to map on GVIM windows? It keeps opening the help menu

I have tried doing

imap <M-h> <left>

but when I do <Alt-h> in GVIM 7.2 on MS Windows, I keep activating the
help menu.

Thanks!

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

[HELP]inoremap doesn't work!

:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap { {}<ESC>i
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>

function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf

I have added the lines above to my vimrc, but vim does't automatically complete bracket,
What's wrong with my vim?
The vimrc is as follows:
  
" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.

" This line should not be removed as it ensures that various options are
" properly set to work with the Vim-related packages available in Debian.
runtime! debian.vim

" Uncomment the next line to make Vim more Vi-compatible
" NOTE: debian.vim sets 'nocompatible'.  Setting 'compatible' changes numerous
" options, so any other options should be set AFTER setting 'compatible'.
"set compatible

" Vim5 and later versions support syntax highlighting. Uncommenting the next
" line enables syntax highlighting by default.
syntax on

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

" Uncomment the following to have Vim jump to the last position when
" reopening a file
"if has("autocmd")
"  au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
"    \| exe "normal g'\"" | endif
"endif

" Uncomment the following to have Vim load indentation rules according to the
" detected filetype. Per default Debian Vim only load filetype specific
" plugins.
"if has("autocmd")
"  filetype indent on
"endif

" The following are commented out as they cause vim to behave a lot
" differently from regular Vi. They are highly recommended though.
"set showcmd        " Show (partial) command in status line.
"set showmatch        " Show matching brackets.
"set ignorecase        " Do case insensitive matching
"set smartcase        " Do smart case matching
"set incsearch        " Incremental search
"set autowrite        " Automatically save before commands like :next and :make
"set hidden             " Hide buffers when they are abandoned
"set mouse=a        " Enable mouse usage (all modes) in terminals

" Source a global configuration file if available
" XXX Deprecated, please move your changes here in /etc/vim/vimrc
filetype plugin on
if filereadable("/etc/vim/vimrc.local")
  source /etc/vim/vimrc.local
endif
syntax on
set expandtab
set tabstop=4
set autoindent shiftwidth=2
set autochdir
set cindent
set shiftwidth=4
let mapleader=","
map <silent><leader>w : w<cr>
map <silent><leader>qa : qa<cr>
map <silent><leader>qq : q!<cr>
map <silent><leader>wq : wq<cr>
map <silent><leader>q : q<cr>
"Taglist
map <silent><leader>tl :TlistToggle<cr>
let Tlist_Ctags_Cmd = '/usr/bin/ctags'
let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
set nohlsearch
let &termencoding=&encoding
set fileencodings=cp936,ucs-bom,utf-8,gbk
set fileencoding=cp936
"set encoding=cp936
set encoding=utf-8
"colorscheme desert
"colorscheme molokai
" cscope
if has("cscope")
    set csprg=/usr/bin/cscope
    set csto=1
    set cst
    set nocsverb
    " add any database in current directory
    if filereadable("cscope.out")
        cs add cscope.out
    endif
    set csverb
endif
nmap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>
" bufexploer
map <silent><leader>be :BufExplorer<cr>
map <silent><leader>bs :BufExplorerHorizontalSplit<cr>
map <silent><leader>bv :BufExplorerVerticalSplit<cr>
" quickfix
nmap <F6> :cn<cr>
nmap <F7> :cp<cr>
nmap <F5> :make<cr>
nmap <F8> :cw<cr>
" press control + s to save
"imap <C-c> <ESC> :w<cr>
"nmap <C-c> <ESC> :w<cr>
" quick jump between splits
map <C-j> <C-w>j<C-w>_
map <C-k> <C-w>k<C-w>_
map <C-l> <C-w>l<C-w>_
map <C-h> <C-w>h<C-w>_

" A.vim
map <silent><leader>a :A<cr>
" NERD_tree
map <silent><leader>t :NERDTreeToggle<cr>
" another explorer
map <silent><leader>e :Ex<cr>
" only one window
map <silent><leader>m :only<cr>
" omnicppcomplete
set completeopt=menu
let OmniCpp_SelectFirstItem = 0
map <F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
set tags+=/home/listar/cppstltags
" pydiction
filetype plugin on
let g:pydiction_location = '/home/listar/.vim/tools/pydiction/complete-dict'
"php set
"au FileType php source /usr/share/vim/vim72/colors/murphy.vim
let g:phpColor = "murphy"
let g:defaultColor = "desert"
"au! FileType * exe ":colorscheme " . g:defaultColor
"au! FileType php exe ":colorscheme " . g:phpColor
" neocomplcache
" Disable AutoComplPop.
let g:acp_enableAtStartup = 0
" Use neocomplcache.
let g:neocomplcache_enable_at_startup = 1
" Use smartcase.
 let g:neocomplcache_enable_smart_case = 1
" Use camel case completion.
let g:neocomplcache_enable_camel_case_completion = 1
" Use underbar completion.
let g:neocomplcache_enable_underbar_completion = 1
" Set minimum syntax keyword length.
let g:neocomplcache_min_syntax_length = 3
let g:neocomplcache_lock_buffer_name_pattern = '\*ku\*'
colorscheme desertEx

THANKS!

--
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: [HELP]snipMate plugin error



2010/11/30 zhang listar <listarmingstar@gmail.com>
Hi, I have just intslled snipMate plugin for vim.
But when I edit hello.c program, I get the error message as follows:
Error detected while processing function<SNR>20_SetCom..<SNR>20_SnipMapKeys:
Line 10
E227: mapping already exists for ^I  (which repates 17 times)

What's wrong with it?

Thanks in advance.


Well, I have solved this problem.
There is snipMateEmu.vim in my vim/plugin. 
After I romve it, vim works fine.

--
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: Pattern limits selection for next pattern or substitution

On Nov 30, 7:44 am, bboyjkang <jkan...@gmail.com> wrote:
> Hi
>
> I'm wondering if it's possible to do this in Vim:
> You put up a command with a pattern, and the command selects the line
> (or offsets to select a few surrounding lines in addition to the line)
> that contains the pattern. Once all these lines that contain the
> pattern are selected, I want to do a pattern search and pattern
> substitution that is limited to only those lines that were selected by
> the first pattern.
>
> I came across this search/replace in a visual selection link:http://vim.wikia.com/wiki/Search_and_replace_in_a_visual_selection
>
> :'<,'>s/red/green/g
>
> I would like the :'<,'> to be instead a (does it have to be visual?)
> selection of all those lines that contain the pattern. Then, I could
> do a substitution, or a pattern search that might further restrict the
> selection.
>
> Thanks for any help

Does this recent thread answer your question? [1] In the first step of
Tim Chase's answer maybe he does what you want. Where he tacks on a
unique prefix with s/^/XXX/ that is a standard search/replace command.

If you specifically want to *select* a set of lines, i.e. use select
or visual mode or similar, I'm not sure.

regards, Geoff

(Link all one line)

[1] http://groups.google.com/group/vim_use/browse_thread/thread/61fef2ed829022bb#

--
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: Pattern limits selection for next pattern or substitution

On Tue, Nov 30, 2010 at 08:44, bboyjkang <jkang61@gmail.com> wrote:
> :'<,'>s/red/green/g
>
> I would like the :'<,'> to be instead a (does it have to be visual?)
> selection of all those lines that contain the pattern. Then, I could
> do a substitution, or a pattern search that might further restrict the
> selection.
>
> Thanks for any help

Hello,

To replace all occurrences of "red" by "green" in the current file, you can use:

:%s/red/green/g

Another handy command is :g. With it you can replace all "red" by
"green" where "blue" is:

:g/blue/s/red/green/g

:he :s
:he current-file
:he :g


Tinou

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

folding refused, set filetype=c helps, why?

Hi,

I use syntax based folding in C code (vim 7.3.50). Sometimes when code
is changed folding is refused completely, e.g. zc does not fold
anymore. I found out that resetting the filetype helps (set
filetype=c), although a previous check (set filetype? and set
foldmethod?) shows that is was already c / syntax.

So I wonder what 'set foldtype=c' internally does to reenable folding.
Maybe this is a hint to solve this misbehaviour...

Felix

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

[HELP]snipMate plugin error

Hi, I have just intslled snipMate plugin for vim.
But when I edit hello.c program, I get the error message as follows:
Error detected while processing function<SNR>20_SetCom..<SNR>20_SnipMapKeys:
Line 10
E227: mapping already exists for ^I  (which repates 17 times)

What's wrong with it?

Thanks in advance.

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

Monday, November 29, 2010

Pattern limits selection for next pattern or substitution

Hi

I'm wondering if it's possible to do this in Vim:
You put up a command with a pattern, and the command selects the line
(or offsets to select a few surrounding lines in addition to the line)
that contains the pattern. Once all these lines that contain the
pattern are selected, I want to do a pattern search and pattern
substitution that is limited to only those lines that were selected by
the first pattern.

I came across this search/replace in a visual selection link:
http://vim.wikia.com/wiki/Search_and_replace_in_a_visual_selection

:'<,'>s/red/green/g

I would like the :'<,'> to be instead a (does it have to be visual?)
selection of all those lines that contain the pattern. Then, I could
do a substitution, or a pattern search that might further restrict the
selection.

Thanks for any help

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

check comma in text aspell

Is it possible to use aspell in vim to made suggestions where to set
the comma in a text? It would be great to use a build in function. Or
is there maybe another tool or plug-in which I can use?

Best regards,
Matthias

--
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: Emacs' Org-mode clone for Vim

+ use s:string(var) instead of "'".var."'" with the following s:string:

function s:string(str)
return substitute(string(a:str), '\n', '''."\\n".''', 'g')
endfunction

Re: Emacs' Org-mode clone for Vim

Reply to message «Re: Emacs' Org-mode clone for Vim»,
sent 04:27:32 30 November 2010, Tuesday
by hsitz:

> So thanks to everyone for your suggestions, espcially Marko and ZyX.
> I've posted new version with variable scopes, setting scopes, and
> function scopes cleaned up, and better explanation of how to integrate
> settings in sample vimrc and colorscheme into your own vimrc and
> colorschemes.
some additional notes:
1.
if !exists('g:org_agenda_dirs')
execute "let g:org_agenda_dirs =['".expand("%:p:h")."']"
endif
execute is not required here:
let g:org_agenda_dirs=[expand("%:p:h")]
works just fine and does not break if filename contains newlines.

Same for OrgTagsEdit: if you want to pass unknown number of arguments, use call:
let files=[]
let line_file_args=[]
<...>
call add(files, file)
let line_file_args+=[lineno, file]
<...>
let heading_tags=get(call('s:GetProperties', [lineno, 0]+files), 'tags', '')
<...>
call call('s:SetProp', ['tags', new_heading_tags]+line_file_args)


Same (except note for newlines) for
execute "let b:v.tagdict['" . item . "'] = 1"


silent exe 'normal! dd' -> silent d

execute "normal A ". newd " Forgot «!»

execute 'let @/ ="' . a:term .'"' -> let @/=a:term
execute 'g/' . a:term . '/normal zv' -> g//normal! zv
silent exe '%s/^*x//'
silent exe 'undojoin | %s/^*o//'
purge exe here:
silent %s/^*x//
undojoin
silent %s/^*o//
works just fine.

Review all executes, they are unneeded in most cases and may even cause security
issues.

2. You still have lots of global variables that are not options (though with
org_ prefix). Why don't you like script variables?

Re: Another question: forking

On Nov 29, 3:57 pm, arrom...@rahul.net (Ken Arromdee) wrote:
> gvim used to fork and run in the background.  7.2 doesn't seem to do this.

Well, it does for most. How are you invoking gvim? I'd suspect an
alias or script getting in the way.

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

Re: major confusion on vim folding behavior I'm seeing

On Mon, Nov 29, 2010 at 5:16 PM, Benjamin R. Haskell <vim@benizi.com> wrote:


> That plugin can apparently handle the filetypes:
> xml, docbk, xsl, html, and xhtml
<snip>
> cp xml.vim ~/.vim/ftplugin/
> echo "let b:did_indent = 1" > ~/.vim/indent/xml.vim
> for type in docbk html ; do
>    ln -s xml.vim ~/.vim/ftplugin/${type}.vim
>    ln -s xml.vim ~/.vim/indent/${type}.vim
> done
>

Thanks for your instructions Ben. Much better than the original.

I know the plugin is installed since I see html tag completion
working, yet still can't the stupid folding to work.

I put all my files up on github https://github.com/rickcr/vim if you
get bored and feel like taking a peek.

Is there maybe a 'let' command I'm supposed to call for html files to
get them to work, like I'm doing for xml? :

let g:xml_syntax_folding=1

(Ben F, I also removed the nofoldenable stuff and tried a few things
as mentioned in that link you provided.)

--
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: Emacs' Org-mode clone for Vim

On Nov 28, 1:32 am, Marko Mahnič <marko.mah...@gmail.com> wrote:
>
> I strongly agree. I've tried the dictionary approach in Vimuiex/VxLib,
> but it doesn't work to well. So if you have any settings that the user
> can configure, put them in global variables (eg. g:org_X).
> For the rest I would use either s: or global dictionaries (eg.
> g:org_private_X).
>
> Marko

I experimented with a couple different ways but for now the global
vars are merely using 'org_' prefix but I'm using separate buffer-
local dictionaries to hold settings for each .org file buffer. Not
really any benefit to the user from the buffer dicts, but as developer
it's nice to have them all in one spot, and easy enough to switch if I
end up not liking it.

So thanks to everyone for your suggestions, espcially Marko and ZyX.
I've posted new version with variable scopes, setting scopes, and
function scopes cleaned up, and better explanation of how to integrate
settings in sample vimrc and colorscheme into your own vimrc and
colorschemes.

Regards,

Herb

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

Licenses on scripts?

Hi,

I just got a request from a user of my Arduino syntax file for vim
[1]. He asks if I could put a license on it. I'm thinking the MIT
license or perhaps creative commons (CC-BY).

It's not a big deal for a syntax file of course, but is there any
standard for this? Anything I should think of to make sure it can be
included in vim proper at some point [2]? I've seen one case of
reusing the vim license [3], but it doesn't really seem to fit.

Please CC me, as I am not on the mailing list.

Thanks,
Johannes

[1] http://www.vim.org/scripts/script.php?script_id=2654
[2] which it totally should. it's freakin' awesome!
[3] http://www.vim.org/scripts/script.php?script_id=3223

--
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: major confusion on vim folding behavior I'm seeing

On Mon, 29 Nov 2010, Rick R wrote:

> On Mon, Nov 29, 2010 at 3:21 AM, Benjamin R. Haskell wrote:
>
>> But, in order to do syntax-based folding, the syntax needs to be set
>> up in the more-complicated, "region"-based way. The XML highlighting
>> is a great example of a well-written syntax that uses this method,
>> IMO.
>>
>> HTML mainly uses regions to provide the text formatting tricks that
>> it adds (underlined <a> text, bolded <b> text, etc.). My guess is
>> that the main reason it doesn't work the same way the XML syntax does
>> is that HTML, as an SGML application, doesn't require matched closing
>> tags (so writing a grammar for it in terms of syntax regions can be
>> quite complicated).
>>
>
> I'll keep trying to figure it out or maybe I'll just stick to
> KomodoEdit with the vim mode enabled. I have some large html files I
> have to deal with and having folding comes in handy.
>
> I thought about trying this
> http://www.vim.org/scripts/script.php?script_id=1397 but I didn't
> understand these instructions:
>
> "when you have filetype indent on. Then create a ~/.vim/indent directory and
> for every link (copy) you made do
> echo "let b:did_indent = 1" > ~/.vim/indent/xml.vim"

That plugin can apparently handle the filetypes:
xml, docbk, xsl, html, and xhtml

But, since the built-in filetype plugins for those filetypes each set up
their own indent-handling, you need to override it by claiming that it's
already done.

So, if you want to handle xml, docbk, and html, you need to:

( -- directions from your link -- )
1. copy that plugin's xml.vim file to your own ~/.vim/ftplugin/xml.vim

2. Link (or copy, under Windows) to ~/.vim/ftplugin/docbk.vim and html.vim

( -- then the part that you asked about above -- )
3. For everything in #2 (docbk and html in my example), override the
indent handling:

for type in docbk html ; do
echo "let b:did_indent = 1" > ~/.vim/indent/${type}.vim
done

Assuming you're on non-Windows, I'd probably actually handle both things
the same way:

cp xml.vim ~/.vim/ftplugin/
echo "let b:did_indent = 1" > ~/.vim/indent/xml.vim
for type in docbk html ; do
ln -s xml.vim ~/.vim/ftplugin/${type}.vim
ln -s xml.vim ~/.vim/indent/${type}.vim
done

--
Best,
Ben

--
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: major confusion on vim folding behavior I'm seeing


On Mon, Nov 29, 2010 at 3:21 AM, Benjamin R. Haskell <vim@benizi.com> wrote:
But, in order to do syntax-based folding, the syntax needs to be set up in the more-complicated, "region"-based way.  The XML highlighting is a great example of a well-written syntax that uses this method, IMO.

HTML mainly uses regions to provide the text formatting tricks that it adds (underlined <a> text, bolded <b> text, etc.).  My guess is that the main reason it doesn't work the same way the XML syntax does is that HTML, as an SGML application, doesn't require matched closing tags (so writing a grammar for it in terms of syntax regions can be quite complicated).
 
I'll keep trying to figure it out or maybe I'll just stick to KomodoEdit with the vim mode enabled. I have some large html files I have to deal with and having folding comes in handy.

I thought about trying this http://www.vim.org/scripts/script.php?script_id=1397 but I didn't understand these instructions:

"when you have filetype indent on. Then create a ~/.vim/indent directory and for every link (copy) you made do
      echo "let b:did_indent = 1" > ~/.vim/indent/xml.vim"

 

--
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: E163 when restoring a session set up with --remote-silent-tab

Ben Fritz wrote:
> I've installed Vim, probably with the "Vim without Cream"
> installer for Windows (since that is normally what I use), on
> a laptop where I have no admin rights. It worked fine, I just
> needed to install to a directory to which I had access
> (C:\Vim actually, which struck me as odd; I would expect not
> to have access to the root directory without admin rights,
> I'm not sure how normal this is or where I got that impression).

I don't know about more recent versions of Windows, but it is
standard on XP for the Users group to have the "Create Folders"
special permission on the root directory, and Creator Owner has
"Full Control" (so any user can create a subdirectory, and then
has full control of it). Users cannot create files in the root
directory.

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

How can I make a directory the new top directory in netrw tree view?

vim 7.2
netrw v136

From the documentation it seems like c is the closest thing but it doesn't change the tree view.

--
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: major confusion on vim folding behavior I'm seeing

On Nov 27, 3:28 pm, Rick R <ric...@gmail.com> wrote:
>
> set foldmethod=indent
> set nofoldenable        "dont fold by default
> set foldlevel=0
>

nofoldenable is not the right way to avoid folding by default. With
nofoldenable, all folds are open, as if they did not exist at all. You
cannot interact with them. But, as soon as you try interacting with
them (by pressing zc for example) you automatically set foldenable,
which will apply all the folds that exist in the window. Since your
foldlevel is zero, this means ALL folds will be closed (because they
were already closed, they just weren't being used because of
nofoldenable).

To get what you want, you probably need to use foldlevelstart or some
other methods, as discussed here:

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

--
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: JavaScript - Incorrect Indentation when writing objects.

Two plugins have been mentioned, I have added them to this page:

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

The page itself is for an improvement on yet another plugin. Check it
out if you're interested. I would think one of these plugins should
probably replace the "official" one, there's apparently an obvious
need for improvement.

--
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: E163 when restoring a session set up with --remote-silent-tab

On Nov 25, 3:26 am, 7tommm <7to...@gmail.com> wrote:
>
> Unfortunately, I do not have admin privileges on the PC at work. So I
> wonder if it is possible to install vim 7.3 on win XP without admin
> privileges properly?
>

I've installed Vim, probably with the "Vim without Cream" installer
for Windows (since that is normally what I use), on a laptop where I
have no admin rights. It worked fine, I just needed to install to a
directory to which I had access (C:\Vim actually, which struck me as
odd; I would expect not to have access to the root directory without
admin rights, I'm not sure how normal this is or where I got that
impression).

--
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: syntax folding: unfolds all when { is inserted

Thanks a lot for the details.

As you mention that the workaround is not yet completely satisfying
let me add my imperfect workaround:

I mapped a key to insert { and } at once. This does not first open and
then close all (at least it seems so). Then I start editing in
between.

Of course, this is not work when moving lines around or deleting them
line by line, possibly catching just one of the fold markers.

Hm...

Felix

--
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: major confusion on vim folding behavior I'm seeing

On Mon, 29 Nov 2010, Rick R wrote:

> On Sun, Nov 28, 2010 at 11:38 PM, Benjamin R. Haskell wrote:
>
>>
>>
>>> Question: Ultimatley I want code folding in html files (and
>>> preferebly later haml/erb) should using foldmethod=sytnax work for
>>> any file that it recognizes the syntax?
>>>
>>
>>
>> Not universally, no. In terms of handling things other than
>> highlighting, the syntax files vary a bit in quality. Similar to the
>> way Wikipedia articles vary in quality, the best syntax files are the
>> ones that either: 1) the most people care about, or 2) someone goes
>> out of their way to improve. Often the original author of the file
>> might just be unaware of folding, so it gets omitted.
>>
>> Since you mentioned it explicitly, the eruby filetype seems to lack
>> folding. I don't have any 'haml' files sitting around for testing
>> (had some old Ruby on Rails stuff for .rhtml files), but its syntax
>> file is by the same author, and also doesn't mention folding at all.
>>
>>
>>
>
> What about just regular ubiquitous html? I can't seem to get that to
> fold at all.

HTML doesn't support folding. You can usually see options for a given
filetype by doing:

:help ft-{filetype}-syntax

So:

:help ft-xml-syntax
(shows the g:xml_syntax_folding info)

:help ft-html-syntax
(doesn't mention folding)

If the documentation is out of date, or you want to be sure there aren't
hidden features, you can also check the source:
:exe "view ".globpath(&rtp,'syntax/html.vim')


> I also figured out that for some reason I needed to add this to my
> .vimrc file to get even xml folding to work correctly:
>
> let g:xml_syntax_folding=0

Huh? You should have to set the opposite:

let g:xml_syntax_folding = 1

Probably a broken check in xml.vim...


> Do I need to do something similar for html files? (on a whim tried -
> with no luck - let g:html_syntax_folding=0)

Part of the reason for varying levels of folding support between
languages is that there are two main ways to do syntax highlighting:

The first way is to just highlight a bunch of keywords/matches. This
way is "dumb" in the sense that you don't need to specify a lot of the
grammar of the language being highlighted. But, it's far easier to set
up. E.g., you can just say "if", "then", and "else" are keywords, vs
having to say "if" starts an "if-block" which ends with either an "else"
or a closing brace (or whatever).

But, in order to do syntax-based folding, the syntax needs to be set up
in the more-complicated, "region"-based way. The XML highlighting is a
great example of a well-written syntax that uses this method, IMO.

HTML mainly uses regions to provide the text formatting tricks that it
adds (underlined <a> text, bolded <b> text, etc.). My guess is that the
main reason it doesn't work the same way the XML syntax does is that
HTML, as an SGML application, doesn't require matched closing tags (so
writing a grammar for it in terms of syntax regions can be quite
complicated).

--
Best,
Ben

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

Sunday, November 28, 2010

cscope errors: E262: error reading cscope connection 0

Hi all,
I use vim as my main editor for programming and I'm enjoying it to no end. For tags, I use ctags (Exuberant Ctags 5.8) and cscope (version 15.7a).
My problem is that occassionally when I do a cscope search using "cs find" I get the cscope error: E262: error reading cscope connection 0
Resetting cscope temporary solves this until it happens again.

Further information:
I configure vim to always have 3 open cscope databases: For the Linux kernel, for glibc, and For my project.
vim is configured to have the same corresponding ctags databases for the same projects.
vim version:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Nov  8 2010 14:11:20)
Included patches: 1-50
Compiled by eran.borovik@eranb-lx
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() +gettext -hangul_input -iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec +mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm -multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation:
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -Wl,--as-needed -o vim       -lm -lncurses -lelf -lnsl  -lselinux  -lacl -lattr -lgpm     -L/usr/lib/python2.4/config -lpython2.4 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic

OS Centos 5.4:
Linux  2.6.18-164.9.1.el5 #1 SMP Tue Dec 29 11:06:53 IST 2009 x86_64 x86_64 x86_64 GNU/Linux

Any help with that will be much appreciated.
Thanks,
Eran.

--
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: major confusion on vim folding behavior I'm seeing



On Sun, Nov 28, 2010 at 11:38 PM, Benjamin R. Haskell <vim@benizi.com> wrote:
 
Question: Ultimatley I want code folding in html files (and preferebly later haml/erb) should using foldmethod=sytnax work for any file that it recognizes the syntax?


Not universally, no.  In terms of handling things other than highlighting, the syntax files vary a bit in quality.  Similar to the way Wikipedia articles vary in quality, the best syntax files are the ones that either: 1) the most people care about, or 2) someone goes out of their way to improve.  Often the original author of the file might just be unaware of folding, so it gets omitted.

Since you mentioned it explicitly, the eruby filetype seems to lack folding.  I don't have any 'haml' files sitting around for testing (had some old Ruby on Rails stuff for .rhtml files), but its syntax file is by the same author, and also doesn't mention folding at all.

 

What about just regular ubiquitous html? I can't seem to get that to fold at all. I also figured out that for some reason I needed to add this to my .vimrc file to get even xml folding to work correctly:

let g:xml_syntax_folding=0

Do I need to do something similar for html files? (on a whim tried - with no luck - let g:html_syntax_folding=0)

--
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: syntax folding: unfolds all when { is inserted

On Sun, 28 Nov 2010, fkater wrote:

> Hi,
>
> I am using syntax foldling in C files. When all is folded but then a
> somewhere in the middle a { is inserted, every fold below in the file
> gets unfolded (sometimes it returns to the previous state when the
> closing } is inserted, but sometimes not).
>
> I would like to disable this feature if possible, however, keep syntax
> based folding. In case it is related to brace matching I do not need
> that either.
>
> Is there a way?

I asked the same thing a while back[1]. In the end, Bram explained that
it's slightly complicated to get this right[2]. Personally, I use this
variant of Matt's workaround[3] in my own .vimrc:

" Don't update folds in insert mode
aug NoInsertFolding
au!
au InsertEnter * let b:oldfdm = &l:fdm | setl fdm=manual
au InsertLeave * let &l:fdm = b:oldfdm
aug END

The gist: switch to something other than foldmethod=syntax while in
insert mode, then switch back afterward. It still has the problem that
if you insert a bracket and then insert the closing bracket at two
different times (e.g. to add a level of scope to something), the folds
get messed up. But, it's better than the complete craziness of updating
the folds as you're entering them in the first place.

--
Best,
Ben

[1] http://groups.google.com/group/vim_use/browse_thread/thread/9f4c69b6693e8838/e09183be3126b98f
[2] http://groups.google.com/group/vim_use/browse_thread/thread/9f4c69b6693e8838/e09183be3126b98f#9c388b82e879e4fa
[3] http://groups.google.com/group/vim_use/browse_thread/thread/9f4c69b6693e8838/e09183be3126b98f#e09183be3126b98f

--
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: major confusion on vim folding behavior I'm seeing

On Sun, 28 Nov 2010, Rick R wrote:

> On Sun, Nov 28, 2010 at 11:05 PM, Benjamin R. Haskell wrote:
>
>>
>> You want foldmethod=syntax, not foldmethod=indent.
>>
>> 'indent' folds based on how far a given line is indented. 'syntax'
>> folds based on syntax rules specific to the filetype being edited.
>>
>> 'indent' is really only useful (IMO) when you're editing something
>> very, very simple that doesn't have a proper Vim 'syntax' set up.
>> Anything else usually has good defaults for folding via 'syntax' (or
>> is configurable to do so).
>>
>>
> Ok thanks. I had tried that but didn't have any luck. Kept saying "no
> fold found" when I swtiched to foldmethod=syntax. I'll have to go back
> and slowly build up a valid .vimrc that works.
>
> Question: Ultimatley I want code folding in html files (and preferebly
> later haml/erb) should using foldmethod=sytnax work for any file that
> it recognizes the syntax?

Not universally, no. In terms of handling things other than
highlighting, the syntax files vary a bit in quality. Similar to the
way Wikipedia articles vary in quality, the best syntax files are the
ones that either: 1) the most people care about, or 2) someone goes out
of their way to improve. Often the original author of the file might
just be unaware of folding, so it gets omitted.

Since you mentioned it explicitly, the eruby filetype seems to lack
folding. I don't have any 'haml' files sitting around for testing (had
some old Ruby on Rails stuff for .rhtml files), but its syntax file is
by the same author, and also doesn't mention folding at all.

--
Best,
Ben

--
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: major confusion on vim folding behavior I'm seeing

On Sun, Nov 28, 2010 at 11:21 PM, Rick R <rickcr@gmail.com> wrote:


On Sun, Nov 28, 2010 at 11:05 PM, Benjamin R. Haskell <vim@benizi.com> wrote:
 
You want foldmethod=syntax, not foldmethod=indent.

'indent' folds based on how far a given line is indented.  'syntax' folds based on syntax rules specific to the filetype being edited.

'indent' is really only useful (IMO) when you're editing something very, very simple that doesn't have a proper Vim 'syntax' set up.  Anything else usually has good defaults for folding via 'syntax' (or is configurable to do so).


Ok thanks. I had tried that but didn't have any luck. Kept saying "no fold found" when I swtiched to foldmethod=syntax. I'll have to go back and slowly build up a valid .vimrc that works.

Question: Ultimatley I want code folding in html files (and preferebly later haml/erb) should using foldmethod=sytnax work for any file that it recognizes the syntax?
 

Ok, using synax foldmethod definitely works nicely for xml (thanks Ben,) but for html files it still says "no fold found." Off to the google cave, but if anyone has tips in the meantime.. thanks. 

--
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: major confusion on vim folding behavior I'm seeing



On Sun, Nov 28, 2010 at 11:05 PM, Benjamin R. Haskell <vim@benizi.com> wrote:
 
You want foldmethod=syntax, not foldmethod=indent.

'indent' folds based on how far a given line is indented.  'syntax' folds based on syntax rules specific to the filetype being edited.

'indent' is really only useful (IMO) when you're editing something very, very simple that doesn't have a proper Vim 'syntax' set up.  Anything else usually has good defaults for folding via 'syntax' (or is configurable to do so).


Ok thanks. I had tried that but didn't have any luck. Kept saying "no fold found" when I swtiched to foldmethod=syntax. I'll have to go back and slowly build up a valid .vimrc that works.

Question: Ultimatley I want code folding in html files (and preferebly later haml/erb) should using foldmethod=sytnax work for any file that it recognizes the syntax?

Thanks again 

--
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: major confusion on vim folding behavior I'm seeing

On Sat, 27 Nov 2010, Rick R wrote:

> I'm trying to get vim folding to behave as I'd expect. I changed it to
> 'indent' (since it wasn't picking up html files for some reason with
> 'syntax' as the folding type.)
> Here is a valid xml file indented properly (just a snippet shown):
>
> http://img.skitch.com/20101127-qe6x55rbfrp1xg14dhhqi3h12d.jpg
>
> Now if I put my cursor in the node "distributionManagement" I'd expect
> it to collapse that node (using zc),  Instead it collapses a bunch of
> junk and looks like:
>
> http://img.skitch.com/20101127-qk79fh5k73ash2xpmdeiry2421.jpg
>
> I really have no idea what's going on. It seems to just do very random
> stuff when I mess around with collapsing and expanding nodes. I read
> the help file and I thought I grasped the concepts, but apparently not
> or else I have something set up wrong.
>
> my .vimrc has:
>
> set foldmethod=indent
> set nofoldenable        "dont fold by default
> set foldlevel=0

You want foldmethod=syntax, not foldmethod=indent.

'indent' folds based on how far a given line is indented. 'syntax'
folds based on syntax rules specific to the filetype being edited.

'indent' is really only useful (IMO) when you're editing something very,
very simple that doesn't have a proper Vim 'syntax' set up. Anything
else usually has good defaults for folding via 'syntax' (or is
configurable to do so).

--
Best,
Ben

--
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: Another question: forking

On 11/28/2010 09:57 PM, Ken Arromdee wrote:
> gvim used to fork and run in the background. 7.2 doesn't seem to do this.
>
> The only reference online I could find was on a mailing list which isn't
> very vim related, but suggested there could be a bug:
> http://www.mail-archive.com/fink-beginners@lists.sourceforge.net/msg22075.html
>
> Is this just a bug and has it been fixed in a newer version? Is there
> anyone who is running vim 7.2 and can get it to fork? (Yes, I checked
> guioptions; -f is not set.)
>

Both 7.2 and 7.3 fork for me always. -ak

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

Another question: forking

gvim used to fork and run in the background. 7.2 doesn't seem to do this.

The only reference online I could find was on a mailing list which isn't
very vim related, but suggested there could be a bug:
http://www.mail-archive.com/fink-beginners@lists.sourceforge.net/msg22075.html

Is this just a bug and has it been fixed in a newer version? Is there
anyone who is running vim 7.2 and can get it to fork? (Yes, I checked
guioptions; -f is not set.)

--
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: fvwm vim problem

On Mon, 29 Nov 2010, bill lam wrote:
> It seemd line continuation did not work. May be related to compatibe mode.
> Try checking the cp and cpo. (untested)

Thanks, unsetting compatible did fix it, though I have no idea which of the
many compatible settings it was.

--
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: fvwm vim problem

Вск, 28 Ноя 2010, Ken Arromdee писал(а):
> On Sun, 28 Nov 2010, Thomas Adam wrote:
> >>I am running vim 7.2.  When I try to edit a .fvwm2rc, I get syntax errors in
> >>fvwm.vim.  It seems that this is not updated for vim 7.2.
> >>
> >>I found a message by Googling which referred to an updated file for vim
> >>7, at http://www.mail-archive.com/fvwm@lists.math.uh.edu/msg16116.html --
> >That's old.
> >
> >I've not got any problems here using the file fvwm.vim at all --
> >what's your filetype set to? ISTR if it's not "fvwm", then you might
> >run into problems, but until I can see what errors you're getting, I
> >wouldn't want to speculate.
>
> I'm running a newly installed Mandriva Linux 2010.1. It has a vim that
> claims to be version 7.2.284.
>
> The file is ".fvwm2rc", which according to the vim documentation is already
> recognized--you only need to set the filetype for files other than .fvwmrc
> and .fvwm2rc.
>
> These are the errors I get:
>
> Error detected while processing /usr/share/vim/syntax/fvwm.vim:
> line 29:
> E399: Not enough arguments: syntax region fvwmModArg^I^Icontained contains=fvwmS
> tring,fvwmRGBValue
> line 32:
> E399: Not enough arguments: syntax region fvwmString^I^Icontains=fvwmBackslash s
> tart='"'
> line 33:
> E10: \ should be followed by /, ? or &
> line 34:
> E399: Not enough arguments: syntax region fvwmString^I^Icontains=fvwmBackslash s
> tart='`'
> line 35:
> E10: \ should be followed by /, ? or &
> line 36:
> E399: Not enough arguments: syntax region fvwmString^I^Icontains=fvwmBackslash s
> tart="'"
> line 37:
> E10: \ should be followed by /, ? or &
> line 46:
> E399: Not enough arguments: syntax region fvwmComment^I^Icontains=@Spell
> line 47:
> E10: \ should be followed by /, ? or &
> line 51:
> E10: \ should be followed by /, ? or &
> line 69:
> E10: \ should be followed by /, ? or &
>
> Followed by a whole lot more repeats of the same error with different line
> numbers.
>
> The fvwm.vim file contains this at line 29:
>
> syn region fvwmModArg contained contains=fvwmString,fvwmRGBValue
> \ start='.' skip='\\$' end='$'
>
> syn region fvwmString contains=fvwmBackslash start='"'
> \ matchgroup=fvwmBackslash skip='\v\\"' end='"'
> syn region fvwmString contains=fvwmBackslash start='`'
> \ matchgroup=fvwmBackslash skip='\v\\`' end='`'
> syn region fvwmString contains=fvwmBackslash start="'"
> \ matchgroup=fvwmBackslash skip="\v\\'" end="'"
> syn match fvwmBackslash contained '\\[^"'`]'
>
> --
> 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

It seemd line continuation did not work. May be related to compatibe mode.
Try checking the cp and cpo. (untested)

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3

--
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: syntax folding: unfolds all when { is inserted

On Sun, Nov 28, 2010 at 12:37:04PM -0800, fkater@googlemail.com wrote:
>I am using syntax foldling in C files. When all is folded but then a
>somewhere in the middle a { is inserted, every fold below in the file
>gets unfolded (sometimes it returns to the previous state when the
>closing } is inserted, but sometimes not).

I see this behaviour with foldmethod=marker, too. When I start inputting a new fold that is above other collapsed folds, all the folds below it expand. I finish entering my new fold, then collapse everything with zM. It would indeed be nice if they didn't autoexpand.

--

.

--
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 text search by autocompletion

On Tue, Nov 23, 2010 at 11:51:17AM -0800, Brett Stahlman wrote:
>Instead of beginning the search with `/', try `q/', then use CTRL-P
>and/or CTRL-N instead of <TAB>.

Hmm, I interpreted Aman's question to mean how to autocomplete on words in the buffer, not on previously entered search terms. So, for example, if I had this message open and I type /auto then <tab> (or ctrl-p/n, etc.) it should put /autocomplete on the search line, without me having searched for 'autocomplete' previously. Is that even possible?

--

.

--
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: filter txt file based on start and ending marks

On 11/28/2010 09:07 AM, Jeri Raye wrote:
> I was wondering to search for certain patterns in the log file and
> provide a start and end mark for the interresting stuff.
> And then delete all that isn't in the selected sections.
> Is that possible?

While it's a little hard to determine the particulars from your
description and pseudo-examples, the general process I use to do
something similar looks like

:g/interesting/sil! ?start?,/end/s/^/XXX/
:v/^XXX/d
:%s/^XXX

This searches for every line matching the pattern "interesting",
then searches backwards for the pattern "start" as the beginning
of the range, and forward to the pattern "end". With each of
those start...end ranges, it tacks on a unique prefix (in this
case, "XXX") The "sil!" is just to prevent it from reporting
action on every matching line because it annoys me :)

Now that you've found and marked the interesting stuff, you can
delete the rest (the "v/^XXX/d").

Finally, remove the "XXX" marker leaving you with just what you want.

Each of those patterns can be an arbitrary regexp, so you can use
multiple conditions:

:g/foo\|bar\|baz/sil! ...

Alternatively, I'll use ">" as my command instead of "s/^/XXX" to
indent the lines of interest (best done with 'noet' and 'sw'='ts'
so you get one tab of indent), delete the non-indented lines, and
then un-indent the indented lines:

:g/interesting/sil! ?start?,/end/>
:v/^\t/d
:%<

Hope this gives you a general pattern you can use.

-tim


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

syntax folding: unfolds all when { is inserted

Hi,

I am using syntax foldling in C files. When all is folded but then a
somewhere in the middle a { is inserted, every fold below in the file
gets unfolded (sometimes it returns to the previous state when the
closing } is inserted, but sometimes not).

I would like to disable this feature if possible, however, keep syntax
based folding. In case it is related to brace matching I do not need
that either.

Is there a way?

Felix

--
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: major confusion on vim folding behavior I'm seeing

To simplify it even more, I backed up my ~/.vim dir and put barely anything in my .vimrc. Then I created this xml:

<test>
        <level-one>
                <name>Foo</name>
                <name>Boo</name>
                <level-two>
                        <something>A</something>
                        <something>B</something>
                </level-two>
        </level-one>
        <level-one>
                <name>C</name>
                <name>D</name>
        </level-one>
</test>

Now if my cursor is in the first <level-one> tag, and I do zc or even za, I'd expect JUST that fist level-one node to collapse, instead EVERYTHING collapses so that it looks like:

<test>
+-- 12 lines: <level-one>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
</test>
 
If I then go to expand the node above it's as if it had collapsed all level-one nodes:

<test>
        <level-one>
+---  6 lines: <name>Foo</name>-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        </level-one>
        <level-one>
+---  2 lines: <name>C</name>---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
        </level-one>
</test>

Why is this? How do I get the typical folding that I'm used to in other editors/ides? I want the behavior where you can just collapse single nodes.

Thanks for any help in getting to the bottom of this.


On Sat, Nov 27, 2010 at 4:28 PM, Rick R <rickcr@gmail.com> wrote:
I'm trying to get vim folding to behave as I'd expect. I changed it to 'indent' (since it wasn't picking up html files for some reason with 'syntax' as the folding type.) Here is a valid xml file indented properly (just a snippet shown):

http://img.skitch.com/20101127-qe6x55rbfrp1xg14dhhqi3h12d.jpg

Now if I put my cursor in the node "distributionManagement" I'd expect it to collapse that node (using zc),  Instead it collapses a bunch of junk and looks like:

http://img.skitch.com/20101127-qk79fh5k73ash2xpmdeiry2421.jpg

I really have no idea what's going on. It seems to just do very random stuff when I mess around with collapsing and expanding nodes. I read the help file and I thought I grasped the concepts, but apparently not or else I have something set up wrong.

my .vimrc has:

set foldmethod=indent
set nofoldenable        "dont fold by default
set foldlevel=0

I tried set foldlevel=1 also

 



--
Rick R

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