Re: Tip #80: Restore cursor to file position in previous editing session does not work on Ubuntu

2007-05-16 Thread François Ingelrest

Hi,

You should try to have a look at this bug and see if it's the same problem:

https://bugs.launchpad.net/ubuntu/+bug/58002

On 5/16/07, Tushar Desai <[EMAIL PROTECTED]> wrote:

This tip (which restores cursor to the last position in previous
editing session) is the lifeline of any developer and it works great
for me at work (on Fedora Core 6).
I've Ubuntu 7.04 @home and I just compiled and installed vim7.1 and
this doesn't work for me. It didn't work with vim7.0 either.

Actually, even on Ubuntu it works if I don't quit from vim. On FC6,
irrespective of the quit. I suppose on ubuntu this is some how not
being "remembered". So, how do I get my cursor back across session
quits?

Regards,
-tushar.

PS: Pardon me for some lame questions, while I try to improve my vim skills.



Re: what "feature" is required to return to last editing position?

2007-05-09 Thread François Ingelrest

Hello,

I'm also using vim with an Ubuntu Feisty. Here is what I have in my .vimrc:

" Try to restore cursor position when reading a buffer
au BufReadPost * if line("'\"") | exe "normal '\"" | endif

It works quite well.

On 5/9/07, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:

[EMAIL PROTECTED] wrote:
>
> When opening a file in vim, the cursor will move to the last position when
> the file was saved.
>
> The "feature" is enabled by some autocommands in vimrc_example.vim, I
> copied the code into my .vimrc and use it in all platform.
>
> It really does work in my WindowsXP gvim, cygwin vim, MacOSX vim, and
> Ubuntu Dapper vim.
>
> Recently I installed Ubuntu Feisty and the "feature" seems to have gone (I
> installed vim-gnome version 7.0.135). Since I use the same .vimrc in all
> platform, it is unlikely to be the fault of my .vimrc script, the problem
> is I do not know how to debug vim script, and I don't know why that
> autocommand does not work.
>
> Any idea where is the problem, or any hint on how to find where the problem
> is?
>
> --
> Sincerely, Pan, Shi Zhu. ext: 2606
>

IIUC, it requires both +autocmd and +viminfo -- IOW, at least a "Normal"
version. "Tiny" or "small" (including the version of vim installed under the
name "vi" by the RedHat package "vim-minimal") won't have it. (Sorry, I don't
know the Ubuntu package names.)


Best regards,
Tony.
--
"APL is a write-only language.  I can write programs in APL, but I
can't read any of them."
-- Roy Keir



Re: Auto-bracket/Auto-brace for Vim (automatic insertion/formatting of curly braces)

2007-05-01 Thread François Ingelrest

Hi,

Please see this thread:
http://tech.groups.yahoo.com/group/vim/message/79080

On 4/30/07, madiyaan <[EMAIL PROTECTED]> wrote:


Hello all,

I want to know if there is a way for me to configure Vim such that when
editing *.cc *.c *.cpp *.h files, when I type in:

if (bla == bla1) { 

it types in:

if (bla == bla1)
{
   
}

I don't know if I explained this well, but if you look at this webpage:

http://www.aivosto.com/codesmart/net.html

Search for "autobrackets" you will see the behavior as a screenshot.

Similar (but not the same as I describe) behavior can be seen here:

http://www.wholetomato.com/

Can anyone tell me if I can have my Vim configured as this? I recently
switched to Vim from Visual Studio and only thing I miss is these
autobrackets and auto-completion (that cute Intellisense pop-up that pops up
when you press . or -> I know Vim has omni-complete, but somehow it's not as
smart as Intellisense (i.e. lists non-member variables for class structures
as well as other junk alphabets that were previously typed)).

Regards,
--
View this message in context: 
http://www.nabble.com/Auto-bracket-Auto-brace-for-Vim-%28automatic-insertion-formatting-of-curly-braces%29-tf3672124.html#a10260958
Sent from the Vim - General mailing list archive at Nabble.com.




Re: How to remove 2 or more empty lines when closing the the file?

2007-03-30 Thread François Ingelrest

On 3/30/07, Jean-Rene David <[EMAIL PROTECTED]> wrote:

Note that this implementation will give you a
warning if the pattern is not found.


I'm using this to remove trailing spaces:

" Remove trailing spaces when saving text files
" See :help restore-position
function! RemoveTrailingSpaces()
   exe "normal msHmtgg"
   %s/\s\+$//ge
   exe "normal 'tzt`s"
endfunction

au BufWrite * if ! &bin | call RemoveTrailingSpaces() | endif

The function restores cursor position and does not give any warning
because of the 'e' flag. You can do the same things for empty lines.


Re: Removing tilde characters in front of non-existing lines?

2007-03-15 Thread François Ingelrest

Though it was obvious, I did not think about playing with the colors.
Thank you everyone!

On 3/15/07, Michael Brailsford <[EMAIL PROTECTED]> wrote:

Or the more general solution which will work for any bg/fg combination:

:hi nontext ctermfg=bg guifg=bg cterm=NONE gui=NONE

- Original Message 
From: Richard van der Leeden <[EMAIL PROTECTED]>
To: vim@vim.org
Sent: Thursday, March 15, 2007 12:27:41 PM
Subject: Re: Removing tilde characters in front of non-existing lines?



François Ingelrest-2 wrote:
>
> Hello all,
>
> I'm displaying the line number in front of each line, so the tilde
> characters in front of non-existing lines are useless for me. Is there
> a way to not display them?
>
>

You can change the colour of 'nontext' items (see :help nontext) to be the
same as the background colour - e.g if your background is black do:

:hi NonText cterm=NONE ctermbg=black ctermfg=black gui=NONE guibg=black
guifg=black

--
View this message in context: 
http://www.nabble.com/Removing-tilde-characters-in-front-of-non-existing-lines--tf3409626.html#a9499387
Sent from the Vim - General mailing list archive at Nabble.com.


Removing tilde characters in front of non-existing lines?

2007-03-15 Thread François Ingelrest

Hello all,

I'm displaying the line number in front of each line, so the tilde
characters in front of non-existing lines are useless for me. Is there
a way to not display them?


Re: Search and replace

2007-03-14 Thread François Ingelrest

I'm not an expert with this, but this should work with your example:

%s/!(\(.*\)=\(.*\))!(\(.*\))/(\1)!(\3=\2)!

On 3/15/07, Tien Pham <[EMAIL PROTECTED]> wrote:

Hi all

I have a pattern for "search and replace" but I couldn't figure out how to
do it correctly. I suppose my problem is so simple for many people, but
it's not to me. Thus, help is very much appreciated.


Existing pattern:
!(All,r,ROW=gas)!(All,c,COL)
!(All,r,ROW=water)!(All,c,COL)
!(All,r,ROW=building)!(All,c,COL)


What I need now is:
(All,r,ROW)!(All,c,COL=gas)!
(All,r,ROW)!(All,c,COL=water)!
(All,r,ROW)!(All,c,COL=building)!

Again, your help is greatly appreciated.
tien


Re: Maximize gvim at startup

2007-03-13 Thread François Ingelrest

On 3/13/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote:
Why it's there a command to simply maximize the window?


Because it's managed by the window manager, not by the app itself. You
may be able to set the size to what your screen is able to display,
but I don't think you'll be able to "really" maximize the window.


Re: Removing trailing spaces on BufWrite

2007-03-11 Thread François Ingelrest

Thanks  to both of you! I now use this command and it's working perfectly:

au BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif

On 3/11/07, Thilo Six <[EMAIL PROTECTED]> wrote:

François Ingelrest wrote the following on 11.03.2007 15:39:
> Hi,
>
> As the title says, I want to automatically remove trailing spaces when
> I save a file. This is what I put in my vimrc:
>
> au BufWrite * %s/\s\+$//ge
>
> This works correctly only when at least one match is found, an error
> is issued if I want to save a file without trailing spaces. However,
> using the 'e' flag for the substitute command should discard any such
> error (at least it's working when I use this command interactively).
> Did I miss something?

I had the same issue with that (error message on not finding matches)
this is what i use now:

" automatically delete trailing Dos-returns,whitespace
autocmd BufRead,BufWritePre,FileWritePre * silent! %s/[\r \t]\+$//
   ^^


Removing trailing spaces on BufWrite

2007-03-11 Thread François Ingelrest

Hi,

As the title says, I want to automatically remove trailing spaces when
I save a file. This is what I put in my vimrc:

au BufWrite * %s/\s\+$//ge

This works correctly only when at least one match is found, an error
is issued if I want to save a file without trailing spaces. However,
using the 'e' flag for the substitute command should discard any such
error (at least it's working when I use this command interactively).
Did I miss something?


Re: Auto indent lost when opening a new file?

2007-03-01 Thread François Ingelrest

Thank you very much for your answer. I have these lines in my .vimrc:

if has("autocmd")
   au BufRead,BufNewFile *.cls set filetype=tex
   au BufRead,BufNewFile sconstruct set filetype=python

   " Nes C syntax (used by TinyOS)
   au BufRead,BufNewFile *.nc set filetype=nesc
   au! Syntax nesc source ~/.vim/nesc.vim
endif

I use them to force a filetype for some files. Shouldn't I do that?
I added your line among mine:

au BufRead * set  autoindent cindent smartindent

And now it's working correctly. As I understand it, these options are
disabled because I didn't add them to my other lines? But in this
case, why other options aren't also disabled?


Auto indent lost when opening a new file?

2007-03-01 Thread François Ingelrest

Hello all,

This is something that annoys me a lot, and I don't know how to get
rid of it: as soon as I open a new file, auto indentation is lost.
Suppose I am editing a Python file:

def func():

If I hit enter after this line, the cursor will be placed on the next
line with correct indentation. Now suppose I open a new Python file by
using :E. If I try to do the same thing, the cursor is no longer
correctly indented when I create new lines, i.e., it is always placed
at the beginning of the new line. Syntax highlight is still ok, only
auto indentation is lost.

Is it possible to correct that behavior?