Can't delete past starting point in line

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't delete past starting point in line

Jeremy Conlin
I am using vim 7 and really like it.  However there are a few things that  
bother me.  I don't know if this is a bug or if there are simply some  
flags I need to set to get a different behavior.

I have the following in my .vimrc file
        set shiftwidth=4
        set autoindent
        set smartindent
        set smarttab
When I create a new line (either by pressing enter while in insert mode or  
by pressing 'o' or 'O') the new line is created with the same indenting as  
the previous line.  This is expected and desired.  However, sometimes I  
need to remove that indentation.  I can't simply press delete, vim beeps  
at me.  I have to exit insert mode and then move the line over.  This is  
really annoying. Also, if I enter insert mode at a particular point in the  
file, I have the same issue; I can't delete past the point where I began  
insert mode.  I would like to be able to delete as much as I want.

Does this make sense?  Can someone help me solve this problem?
Thanks,
Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Can't delete past starting point in line

Tim Chase-2
> When I create a new line (either by pressing enter while in
> insert mode or  by pressing 'o' or 'O') the new line is
> created with the same indenting as  the previous line.  This
> is expected and desired. However, sometimes I  need to remove
> that indentation.  I can't simply press delete, vim beeps  at
> me.  I have to exit insert mode and then move the line over.
> This is  really annoying. Also, if I enter insert mode at a
> particular point in the  file, I have the same issue; I can't
>  delete past the point where I began  insert mode.  I would
> like to be able to delete as much as I want.

Sounds like you're looking for the 'backspace' option.  The
results of

        :set backspace?

should let you know your current settings.  From the help (":help
'backspace'"), it sounds like you prob. want to have all three
flags set in the 'backspace' option:

        set backspace=indent,eol,start

Hope this helps,

-tim





Reply | Threaded
Open this post in threaded view
|

Re: Can't delete past starting point in line

Dominic Evans
In reply to this post by Jeremy Conlin
I assume you mean backspace when you say delete. They are different keys :)

Anyhow :help 'backspace' is your guide

You want ":set backspace=indent,eol,start" probably.

Cheers,
Dom

On 11/10/05, Jeremy <[hidden email]> wrote:

> I am using vim 7 and really like it.  However there are a few things that
> bother me.  I don't know if this is a bug or if there are simply some
> flags I need to set to get a different behavior.
>
> I have the following in my .vimrc file
>         set shiftwidth=4
>         set autoindent
>         set smartindent
>         set smarttab
> When I create a new line (either by pressing enter while in insert mode or
> by pressing 'o' or 'O') the new line is created with the same indenting as
> the previous line.  This is expected and desired.  However, sometimes I
> need to remove that indentation.  I can't simply press delete, vim beeps
> at me.  I have to exit insert mode and then move the line over.  This is
> really annoying. Also, if I enter insert mode at a particular point in the
> file, I have the same issue; I can't delete past the point where I began
> insert mode.  I would like to be able to delete as much as I want.
>
> Does this make sense?  Can someone help me solve this problem?
> Thanks,
> Jeremy
>
Reply | Threaded
Open this post in threaded view
|

Re: Can't delete past starting point in line

Gary Johnson
In reply to this post by Jeremy Conlin
On 2005-10-11, Jeremy <[hidden email]> wrote:

> I have the following in my .vimrc file
> set shiftwidth=4
> set autoindent
> set smartindent
> set smarttab
> When I create a new line (either by pressing enter while in insert mode or  
> by pressing 'o' or 'O') the new line is created with the same indenting as  
> the previous line.  This is expected and desired.  However, sometimes I  
> need to remove that indentation.  I can't simply press delete, vim beeps  
> at me.  I have to exit insert mode and then move the line over.  This is  
> really annoying. Also, if I enter insert mode at a particular point in the  
> file, I have the same issue; I can't delete past the point where I began  
> insert mode.  I would like to be able to delete as much as I want.

In addition to setting the 'backspace' option as already suggested,
you can also remove a level of indentation while in Insert mode by
typing Ctrl-D.  See

    :help i_CTRL-D

HTH,
Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Wireless Division
                             | Spokane, Washington, USA
Reply | Threaded
Open this post in threaded view
|

Re: Can't delete past starting point in line

Jeremy Conlin
In reply to this post by Tim Chase-2
>
> Sounds like you're looking for the 'backspace' option.  The results of
The backspace option is exactly what I was looking for. Thanks!  I looked
the help for backspace, but it wasn't, um, helpful.  When I did:

:help backspace

I got:

<BS>            backspace               CTRL-H    8     *backspace*
<Tab>           tab                     CTRL-I    9     *tab* *Tab*
...

This obviously doesn't help in this situaion.  How can I get to the
appropriate location in the help files for the backspace option?
Thanks,
Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Can't delete past starting point in line

Gary Johnson
On 2005-10-11, Jeremy <[hidden email]> wrote:

> >
> > Sounds like you're looking for the 'backspace' option.  The results of
> The backspace option is exactly what I was looking for. Thanks!  I looked
> the help for backspace, but it wasn't, um, helpful.  When I did:
>
> :help backspace
>
> I got:
>
> <BS>            backspace               CTRL-H    8     *backspace*
> <Tab>           tab                     CTRL-I    9     *tab* *Tab*
> ...
>
> This obviously doesn't help in this situaion.  How can I get to the
> appropriate location in the help files for the backspace option?

Options are denoted in the help files by enclosing their names in
apostrophes, so

    :help 'backspace'

will get you the help you want.  Actually, an apostrophe at either
end is sufficient.

Gary

--
Gary Johnson                 | Agilent Technologies
[hidden email]     | Wireless Division
                             | Spokane, Washington, USA
Reply | Threaded
Open this post in threaded view
|

Re: Can't delete past starting point in line

Gareth Oakes-2
Furthermore, you can scroll a list of all matching help items.  Eg, type:

:help backs<TAB>

Where <TAB> is you hitting the tab key.  It will complete the word with
the nearest match in the help tags.  You can keep hitting <TAB> to see
more items that match "backs".

You can spice that up even more by putting this in your .vimrc:

set wildmenu wildmode=full

Which gives you a purdy scrollable menu of your options when you hit
<TAB>, including the match 'backspace' ;)

HTH,
-Gareth

Gary Johnson wrote:

> On 2005-10-11, Jeremy <[hidden email]> wrote:
>
>>>Sounds like you're looking for the 'backspace' option.  The results of
>>
>>The backspace option is exactly what I was looking for. Thanks!  I looked
>>the help for backspace, but it wasn't, um, helpful.  When I did:
>>
>>:help backspace
>>
>>I got:
>>
>><BS>            backspace               CTRL-H    8     *backspace*
>><Tab>           tab                     CTRL-I    9     *tab* *Tab*
>>...
>>
>>This obviously doesn't help in this situaion.  How can I get to the
>>appropriate location in the help files for the backspace option?
>
>
> Options are denoted in the help files by enclosing their names in
> apostrophes, so
>
>     :help 'backspace'
>
> will get you the help you want.  Actually, an apostrophe at either
> end is sufficient.
>
> Gary
>