Session.vim ignores formatoptions and textwidth variables

2007-02-24 Thread Jeremy Conlin

I have noticed when I open a Vim session, my formatoptions and
textwidth variables are reset to the default even though I have the
following lines in my .vimrc file:

set linebreak
set textwidth=80
set formatoptions=ncroqt

Does opening a session prevent Vim from looking at ~/.vimrc?

A secondary note, I was looking in the help files for 'sessionoptions'
and noticed something that is contradictory and therefore incorrect.
It says,

There is no option to include tab pages yet, only the current tab page
is stored in the session. |tab-page|

but just above that it gives the 'tabpages' option.  Are the above two
lines a holdover from before the tabpages option was included?

Thanks,
Jeremy


Re: Session.vim ignores formatoptions and textwidth variables

2007-02-24 Thread Jeremy Conlin

On 2/24/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Jeremy Conlin wrote:
 I have noticed when I open a Vim session, my formatoptions and
 textwidth variables are reset to the default even though I have the
 following lines in my .vimrc file:

 set linebreak
 set textwidth=80
 set formatoptions=ncroqt

 Does opening a session prevent Vim from looking at ~/.vimrc?
[...]

Opening a session _overrides_ the vimrc by setting all settings mentioned in
the session after the vimrc has been sourced: according to :help startup,
the vimrc is sourced at step 3, while (-S and) -c arguments are processed at
step 12 (the fact that -S is treated as a variant of -c is mentioned under
:help -S in the same helpfile).

I suppose you may edit your session file manually to remove the 'nolinebreak',
'textwidth' and 'fo' settings.


Isn't this why I make a session so I don't have to manually set all my
options?

I looked at my Session.vim file and for some of my files it changes
textwidth and formatoptions back to the default.  (All my files are
the same filetype, python.)   Why does mksession override whatever I
have set?  Is there someway to change this for what I want?  I am just
confused because this seems counter to the intent of a session.

Thanks again,
Jeremy


Re: Session.vim ignores formatoptions and textwidth variables

2007-02-24 Thread Jeremy Conlin

On 2/24/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:

Jeremy Conlin wrote:
 On 2/24/07, A.J.Mechelynck [EMAIL PROTECTED] wrote:
 Jeremy Conlin wrote:
  I have noticed when I open a Vim session, my formatoptions and
  textwidth variables are reset to the default even though I have the
  following lines in my .vimrc file:
 
  set linebreak
  set textwidth=80
  set formatoptions=ncroqt
 
  Does opening a session prevent Vim from looking at ~/.vimrc?
 [...]

 Opening a session _overrides_ the vimrc by setting all settings
 mentioned in
 the session after the vimrc has been sourced: according to :help
 startup,
 the vimrc is sourced at step 3, while (-S and) -c arguments are
 processed at
 step 12 (the fact that -S is treated as a variant of -c is mentioned
 under
 :help -S in the same helpfile).

 I suppose you may edit your session file manually to remove the
 'nolinebreak',
 'textwidth' and 'fo' settings.

 Isn't this why I make a session so I don't have to manually set all my
 options?

 I looked at my Session.vim file and for some of my files it changes
 textwidth and formatoptions back to the default.  (All my files are
 the same filetype, python.)   Why does mksession override whatever I
 have set?  Is there someway to change this for what I want?  I am just
 confused because this seems counter to the intent of a session.

 Thanks again,
 Jeremy


I suppose these session files were created at a time when your current
settings were different from what they are now, so the session faithfully sets
the options back to whatever they were when you used :mksession.

A session file is just a Vim script, exactly like your vimrc. You can always
(carefully) edit it manually.

You may also want to check that, when you use :mksession, the
'sessionoptions' option is set as you want it to be.

An additional possibility would be to create an ftplugin/python.vim script in
some |after-directory|, to set these three options buffer-locally whenever a
python source is read. For instance on Unix:

quote src=$HOME/.vim/after/ftplugin/python.vim
setlocal linebreak tw=80 fo=ncroqt
/quote


Best regards,
Tony.



Tony

Thanks again for all your help.  You always have a quick and helpful
response to anyone's questions.

Jeremy


Autmagically adding new lines when text gets too long

2006-09-29 Thread Jeremy Conlin

I have set textwidth=80 and would like Vim to automatically break a
line (between words) when the line gets too big.  However, this isn't
working, Vim doesn't seem to be doing anything different.  Is there
some other option I need to set?
Thanks,
Jeremy


Re: Re: Re: Autmagically adding new lines when text gets too long

2006-09-29 Thread Jeremy Conlin

On 9/29/06, Georg Dahn [EMAIL PROTECTED] wrote:

Hi!

--- Jeremy Conlin [EMAIL PROTECTED] wrote:
 No, linebreak just *displays* a broken line, I want a *real* broken
 line.  I want Vim to insert EOLs for me.  I thought that is what
 textwidth would do.

Of course, you still have to set 'textwidth', too.

:set textwidth=80
:set linebreak

will do, what you want. The option 'linebreak' does not do any wrapping, but
just determines where Vim will wrap long lines. These breaks can be soft (if
the option 'wrap' is set) or hard (if 'textwidth' or 'wrapmargin' is set).

Just read

:h linebreak
:h textwidth
:h wrapmargin
:h wrap
:h breakat

Best wishes,
Georg


You were right (of course).  I discovered the reason this was not
working for me was because I didn't have the t option in
formatoptions.  Now that I have included that, it works!
Thanks for your patience.
Jeremy


Re: Re: [2] Appending printoptions

2006-09-28 Thread Jeremy Conlin

On 9/27/06, A.J.Mechelynck [EMAIL PROTECTED] wrote:

A.J.Mechelynck wrote:
 Jeremy Conlin wrote:
 I have the following as my printoptions

 paper:letter

 However, I periodically would like it to include

 number:y

 (or some other option(s)).  I was wondering how I could just append
 this option to the existing printoptions instead of typing the entire
 thing out again.  Any ideas?
 Thanks,
 Jeremy


 see
 :help :set+=
 :help :set^=
 :help :set-=

 and for more advanced handling

 :help :let-option
 :help expr-option


 Best regards,
 Tony.


Oh, and I forgot: with

:set popt=Tab

you can edit the value on the command-line, see

:help cmdline-completion


Best regards,
Tony.


Perfect.  Exactly what I was looking for, I just couldn't find it in
the help system.
Thanks a bunch!
Jeremy


Appending printoptions

2006-09-27 Thread Jeremy Conlin

I have the following as my printoptions

paper:letter

However, I periodically would like it to include

number:y

(or some other option(s)).  I was wondering how I could just append
this option to the existing printoptions instead of typing the entire
thing out again.  Any ideas?
Thanks,
Jeremy


Re: Re: How can I substitute on several files?

2006-07-11 Thread Jeremy Conlin

On 7/11/06, Tim Chase [EMAIL PROTECTED] wrote:

 Hello all.  I have several files where I want to make the same
 substitution.  I can make the substitute command work on a single
 file, but I want to make it work on all the files.  I have the files
 loaded in buffers in vim.  Any suggestions?

Sounds like you're looking for bufdo (and perhaps later down the
line, its cousins argdo and windo, and the newly minted tabdo)

You either need to write the file after each change before
leaving the buffer, or you have to set the 'hidden' setting so
you can proceed to other buffers:

Method 1)

:bufdo %s/foo/bar/g | update

Method 2)

:set hidden
:bufdo %s/foo/bar/g
(review your work here)
:wall
(to write all the changes)

You can learn more at

:help bufdo
:help argdo
:help windo
:help 'hidden'

-tim



Wow!  Three responses almost immediately, that's incredible.  Thanks
for the help, I knew there would be a way to do it, I just wasn't sure
how to find it.
Thanks,
Jeremy


How can I map with the arrow keys?

2006-06-05 Thread Jeremy Conlin

I am trying to make a mapping to more easily switch tabs.  I wanted to
use CTRL-RightArrow to move to the next tab and CTRL-LeftArrow to
move to the previous tab.  However, I can't find in the help files
how to map the arrow keys.  Can someone help me?
Thanks,
Jeremy


How to keep tabs and buffers between Vim session

2006-05-31 Thread Jeremy Conlin

I have been working on many files in gvim spread over many tabs and
windows.  I like this setup and would like to return to it after I
close gvim.  Is there any way to keep the gvim state for the next
time?  I thought this was called persistence, but couldn't find
anything about it.
Thanks,
Jeremy


Moderator for Vim Tips

2006-04-19 Thread Jeremy Conlin
A few weeks (months?) ago a suggestion was made that the submissions
to Vim tips be moderated.  This is due to the address being used by
spammers.  Apparently nobody volunteered to do this because there are
still inappropriate tips being submitted.  I am willing to do this,
but I don't have the expertise required to test all the tips.  I can
screen them to make sure they are appropriate.  Would that agree with
anyone?
Jeremy Conlin