public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* un-indenting doesn't work with vim
@ 2008-07-11 12:54 Robert Latest
  2008-07-11 13:01 ` Corinna Vinschen
  0 siblings, 1 reply; 20+ messages in thread
From: Robert Latest @ 2008-07-11 12:54 UTC (permalink / raw)
  To: cygwin

Hello list,

When writing stuff in "vim", I can't unindent without first havin to
leave the Insert mode. In other words, I type a line, hit "enter",
then "tab", and do the next line. When I hit enter again, the cursor
goes onto the first position of the indented line, which is what I
want. But if at some point I wish to un-indent by pressing backspace
at the beginning of a new line, nothing happens. I first have to exit
Insert mode, then use "x" to delete one tab, and then go back into
insert mode.

This is very annoying. On my Linux box at home, vim behaves as expected.

The behavior occcurs both in the Cygwin DOS window and in an xterm.

Thanks,
robert

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-11 12:54 un-indenting doesn't work with vim Robert Latest
@ 2008-07-11 13:01 ` Corinna Vinschen
  2008-07-11 15:13   ` Matt Wozniski
  2008-07-16  9:50   ` Robert Latest
  0 siblings, 2 replies; 20+ messages in thread
From: Corinna Vinschen @ 2008-07-11 13:01 UTC (permalink / raw)
  To: cygwin

On Jul 11 14:53, Robert Latest wrote:
> Hello list,
> 
> When writing stuff in "vim", I can't unindent without first havin to
> leave the Insert mode. In other words, I type a line, hit "enter",
> then "tab", and do the next line. When I hit enter again, the cursor
> goes onto the first position of the indented line, which is what I
> want. But if at some point I wish to un-indent by pressing backspace
> at the beginning of a new line, nothing happens. I first have to exit
> Insert mode, then use "x" to delete one tab, and then go back into
> insert mode.
> 
> This is very annoying. On my Linux box at home, vim behaves as expected.

That's not standard behaviour in vim, rather a special setting on your
machine.  Either in your own .vimrc or in the system-wise vim config files.

The standard way to unindent is to type Ctrl-D.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-11 13:01 ` Corinna Vinschen
@ 2008-07-11 15:13   ` Matt Wozniski
  2008-07-16  9:50   ` Robert Latest
  1 sibling, 0 replies; 20+ messages in thread
From: Matt Wozniski @ 2008-07-11 15:13 UTC (permalink / raw)
  To: cygwin

On Fri, Jul 11, 2008 at 9:01 AM, Corinna Vinschen wrote:
> On Jul 11 14:53, Robert Latest wrote:
>> Hello list,
>>
>> When writing stuff in "vim", I can't unindent without first havin to
>> leave the Insert mode. In other words, I type a line, hit "enter",
>> then "tab", and do the next line. When I hit enter again, the cursor
>> goes onto the first position of the indented line, which is what I
>> want. But if at some point I wish to un-indent by pressing backspace
>> at the beginning of a new line, nothing happens. I first have to exit
>> Insert mode, then use "x" to delete one tab, and then go back into
>> insert mode.
>>
>> This is very annoying. On my Linux box at home, vim behaves as expected.
>
> That's not standard behaviour in vim, rather a special setting on your
> machine.  Either in your own .vimrc or in the system-wise vim config files.
>
> The standard way to unindent is to type Ctrl-D.
>
>
> Corinna

Exactly so.  The vim setting the OP is looking for is ":set
backspace=indent,eol,start" to allow backspacing, respectively, over
automatically added indenting, the beginning of a line (deleting the
EOL of the previous line), and the place where you started insert
mode.  Throw that in your .vimrc and things should work the way you
want.

~Matt

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-11 13:01 ` Corinna Vinschen
  2008-07-11 15:13   ` Matt Wozniski
@ 2008-07-16  9:50   ` Robert Latest
  2008-07-16 10:19     ` Corinna Vinschen
                       ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Robert Latest @ 2008-07-16  9:50 UTC (permalink / raw)
  To: cygwin

Thanks folks, I didn't know about Ctrl-D. Of course that's all I'm
gonna use now, because it is so Vim. One thing that I don't understand
is that <Tab> indents eight spaces whereas Ctrl-D un-indents only
four. I'll check on that. Actually I've got ":set sw=4" in my vimrc,
maybe that has  to do with it.

robert

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-16  9:50   ` Robert Latest
@ 2008-07-16 10:19     ` Corinna Vinschen
  2008-07-16 15:51     ` Andrew DeFaria
  2008-07-16 17:50     ` Sam Hanes
  2 siblings, 0 replies; 20+ messages in thread
From: Corinna Vinschen @ 2008-07-16 10:19 UTC (permalink / raw)
  To: cygwin

On Jul 16 11:49, Robert Latest wrote:
> Thanks folks, I didn't know about Ctrl-D. Of course that's all I'm
> gonna use now, because it is so Vim. One thing that I don't understand
> is that <Tab> indents eight spaces whereas Ctrl-D un-indents only
> four. I'll check on that. Actually I've got ":set sw=4" in my vimrc,
> maybe that has  to do with it.

Exactly.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-16  9:50   ` Robert Latest
  2008-07-16 10:19     ` Corinna Vinschen
@ 2008-07-16 15:51     ` Andrew DeFaria
  2008-07-16 15:56       ` Corinna Vinschen
  2008-07-16 17:50     ` Sam Hanes
  2 siblings, 1 reply; 20+ messages in thread
From: Andrew DeFaria @ 2008-07-16 15:51 UTC (permalink / raw)
  To: cygwin

Robert Latest wrote:
> Thanks folks, I didn't know about Ctrl-D. Of course that's all I'm 
> gonna use now, because it is so Vim. One thing that I don't understand 
> is that <Tab> indents eight spaces whereas Ctrl-D un-indents only 
> four. I'll check on that. Actually I've got ":set sw=4" in my vimrc, 
> maybe that has to do with it.
BTW the set backspace=indent,eol,start doesn't work for me.
-- 
Andrew DeFaria <http://defaria.com>
Excuse me for butting in, but I'm interrupt-driven.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-16 15:51     ` Andrew DeFaria
@ 2008-07-16 15:56       ` Corinna Vinschen
  2008-07-17  5:45         ` Andrew DeFaria
  0 siblings, 1 reply; 20+ messages in thread
From: Corinna Vinschen @ 2008-07-16 15:56 UTC (permalink / raw)
  To: cygwin

On Jul 16 08:50, Andrew DeFaria wrote:
> Robert Latest wrote:
>> Thanks folks, I didn't know about Ctrl-D. Of course that's all I'm gonna 
>> use now, because it is so Vim. One thing that I don't understand is that 
>> <Tab> indents eight spaces whereas Ctrl-D un-indents only four. I'll check 
>> on that. Actually I've got ":set sw=4" in my vimrc, maybe that has to do 
>> with it.
> BTW the set backspace=indent,eol,start doesn't work for me.

WFM, but the behaviour is not identical to Ctrl-D.  It doesn't use the
shiftwidth for one thing.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-16  9:50   ` Robert Latest
  2008-07-16 10:19     ` Corinna Vinschen
  2008-07-16 15:51     ` Andrew DeFaria
@ 2008-07-16 17:50     ` Sam Hanes
  2008-07-16 18:00       ` Mark J. Reed
  2 siblings, 1 reply; 20+ messages in thread
From: Sam Hanes @ 2008-07-16 17:50 UTC (permalink / raw)
  To: cygwin

Robert Latest wrote:
>
> Thanks folks, I didn't know about Ctrl-D. Of course that's all I'm
> gonna use now, because it is so Vim. One thing that I don't understand
> is that <Tab> indents eight spaces whereas Ctrl-D un-indents only
> four. I'll check on that. Actually I've got ":set sw=4" in my vimrc,
> maybe that has  to do with it.
>

That's because tab indents `tabstop` spaces, and ^D un-indents
`shiftwidth` spaces.

`tabstop` sets what a literal HT (ASCII 0x09 - Horizontal Tab) means
in terms of spaces. This affects what happens what happens when you
press the TAB key and how groups of spaces in files are interpreted if
you have that feature turned on.

`shiftwidth` controls how many spaces VIM considers to be one level of
indentation. This affects the auto-indentation system, ^T and ^D, etc.

If `tabstop` and `shiftwidth` are set to different values, strange
things happen if you use tab to indent.

-- Sam Hanes
elemecca AT gmail DOT com

Freedom is a heavy load, a great and strange burden for the spirit to
undertake. It is not easy. It is not a gift given, but a choice made,
and the choice may be a hard one. The road goes upward towards the
light; but the laden traveler may never reach the end of it.
- Ursula K. Le Guin; The Tombs of Atuan

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-16 17:50     ` Sam Hanes
@ 2008-07-16 18:00       ` Mark J. Reed
  0 siblings, 0 replies; 20+ messages in thread
From: Mark J. Reed @ 2008-07-16 18:00 UTC (permalink / raw)
  To: cygwin

Put it another way: in vim (in insert mode), the tab key just inserts
a tab (which it displays as the number of spaces needed to get to the
next even value of whatever tabstop is set to).  It has nothing to do
with vim's idea of indentation, automatic or otherwise.

The control-D ("outdent" or "unindent") operation is the opposite not
of tab, but of control-T ("indent").   Both use the setting of
shiftwidth, not tabstop.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-16 15:56       ` Corinna Vinschen
@ 2008-07-17  5:45         ` Andrew DeFaria
  2008-07-17  8:41           ` Matt Wozniski
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew DeFaria @ 2008-07-17  5:45 UTC (permalink / raw)
  To: cygwin

Corinna Vinschen wrote:
> On Jul 16 08:50, Andrew DeFaria wrote:
>> Robert Latest wrote:
>>> Thanks folks, I didn't know about Ctrl-D. Of course that's all I'm 
>>> gonna use now, because it is so Vim. One thing that I don't 
>>> understand is that <Tab> indents eight spaces whereas Ctrl-D 
>>> un-indents only four. I'll check on that. Actually I've got ":set 
>>> sw=4" in my vimrc, maybe that has to do with it.
>> BTW the set backspace=indent,eol,start doesn't work for me.
> WFM, but the behaviour is not identical to Ctrl-D. It doesn't use the 
> shiftwidth for one thing.
English woman! English!

Stated differently, on some versions of vim on some OSes, after hitting 
return while in insert mode with autoindent on I am indented. Now I know 
of Ctl-d. Still on some machines backspace backspaces and goes backward 
and on other machines, OSes, etc. while in vim and after hitting return 
in input mode after indenting by a tab, backspace does nothing but beep 
at me! This is yet another reason why I prefer Emacs over vi or vim.

I must say, Unix/Linux or other such OSes, I have experienced the most 
times when hitting the frigging backspace space rarely goes backward by 
one character! Solaris/Sun's OSes are the worse culprit. Most Linux'es 
and Cygwin seem to "Do the right thing" most of the times. Rarely does 
backspace not perform a backspace on Windows.

You dudes/dudettes need to get your S together WRT the frigging 
backspace key! How frigging hard is it?
-- 
Andrew DeFaria <http://defaria.com>
For my birthday I got a humidifier and a de-humidifier...I put them in 
the same room and let them fight it out...


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17  5:45         ` Andrew DeFaria
@ 2008-07-17  8:41           ` Matt Wozniski
  2008-07-17  9:59             ` Hugh Sasse
  2008-07-17 16:47             ` Andrew DeFaria
  0 siblings, 2 replies; 20+ messages in thread
From: Matt Wozniski @ 2008-07-17  8:41 UTC (permalink / raw)
  To: cygwin

On Thu, Jul 17, 2008 at 1:45 AM, Andrew DeFaria wrote:
> Corinna Vinschen wrote:
>> WFM, but the behaviour is not identical to Ctrl-D. It doesn't use the
>> shiftwidth for one thing.
>
> English woman! English!

Respectful.

> Stated differently, on some versions of vim on some OSes, after hitting
> return while in insert mode with autoindent on I am indented. Now I know of
> Ctl-d. Still on some machines backspace backspaces and goes backward and on
> other machines, OSes, etc. while in vim and after hitting return in input
> mode after indenting by a tab, backspace does nothing but beep at me! This
> is yet another reason why I prefer Emacs over vi or vim.

Stated differently, if you didn't understand what Corinna said, you
should have looked it up.

> I must say, Unix/Linux or other such OSes, I have experienced the most times
> when hitting the frigging backspace space rarely goes backward by one
> character! Solaris/Sun's OSes are the worse culprit. Most Linux'es and
> Cygwin seem to "Do the right thing" most of the times. Rarely does backspace
> not perform a backspace on Windows.
>
> You dudes/dudettes need to get your S together WRT the frigging backspace
> key! How frigging hard is it?

Not very hard if you take the time to learn a bit about terminals.
<BS> on a UNIX keyboard either sends ^? or ^H.  If you have "set
backspace=indent,eol,start" (or, equivalently, "set backspace=2") in
your ~/.vimrc, vim will correctly delete over automatically inserted
indentation when it recognizes that you've pressed the backspace key.
This option wasn't in the original vi, which can't be made to delete
over indentation.  It's not turned on by default in vim, either,
because vim aims for vi compatibility out of the box, and assumes that
if you want vim behaviors rather than vi behaviors, then you know what
those behaviors are and can take the time to figure out how to turn
them on.

OTOH, if vim isn't recognizing your piece-of-plastic backspace key as
sending the backspace code it expects, be it ^? or ^H, then your
terminfo on the server is wrong for the terminal you connect to it
with, and one needs to be reconfigured for the correct backspace info.

Either way, the problem is with your setup, not a fundamental flaw
with the way the developers have designed things.  It's no one's
problem but your own if you won't take the time to learn about things
you don't understand.

~Matt

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17  8:41           ` Matt Wozniski
@ 2008-07-17  9:59             ` Hugh Sasse
  2008-07-17 16:47             ` Andrew DeFaria
  1 sibling, 0 replies; 20+ messages in thread
From: Hugh Sasse @ 2008-07-17  9:59 UTC (permalink / raw)
  To: cygwin



On Thu, 17 Jul 2008, Matt Wozniski wrote:

>
> Not very hard if you take the time to learn a bit about terminals.
> <BS> on a UNIX keyboard either sends ^? or ^H.  If you have "set
> backspace=indent,eol,start" (or, equivalently, "set backspace=2") in
> your ~/.vimrc, vim will correctly delete over automatically inserted

And if it isn't only Vim that's bonkers, then you need to mess with
stty. Also you may find other terminal names on the terminfo
database that are similar but behave better.  People expect these
things to "just work", and it can be very frustrating when they
don't, but there is a frightening variety of terminal types
available, and lots of parameters to change.  I've yet to see a
terminfo entry that matches the PuTTY program properly and would 
be interested if anyone has, but that's way off topic. xterm-color
is close enough for now.

The other thing that may help with this kind of frustration is using
gvim instead of vim. But if you prefer emacs, then that's OK, too.
There are enough weird terminals to make ed still useful!

         Hugh

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17  8:41           ` Matt Wozniski
  2008-07-17  9:59             ` Hugh Sasse
@ 2008-07-17 16:47             ` Andrew DeFaria
  2008-07-17 17:02               ` Matt Wozniski
  2008-07-17 18:02               ` Mark J. Reed
  1 sibling, 2 replies; 20+ messages in thread
From: Andrew DeFaria @ 2008-07-17 16:47 UTC (permalink / raw)
  To: cygwin

Matt Wozniski wrote:
> On Thu, Jul 17, 2008 at 1:45 AM, Andrew DeFaria wrote:
>> Corinna Vinschen wrote:
>>> WFM, but the behaviour is not identical to Ctrl-D. It doesn't use 
>>> the shiftwidth for one thing.
>> English woman! English!
> Respectful.
Huh? Your response make no sense!
>> Stated differently, on some versions of vim on some OSes, after 
>> hitting return while in insert mode with autoindent on I am indented. 
>> Now I know of Ctl-d. Still on some machines backspace backspaces and 
>> goes backward and on other machines, OSes, etc. while in vim and 
>> after hitting return in input mode after indenting by a tab, 
>> backspace does nothing but beep at me! This is yet another reason why 
>> I prefer Emacs over vi or vim.
> Stated differently, if you didn't understand what Corinna said, you 
> should have looked it up.
Looked what up? I understand every word she said. What I didn't 
understand was the thought she was trying to convey.
>> I must say, Unix/Linux or other such OSes, I have experienced the 
>> most times when hitting the frigging backspace space rarely goes 
>> backward by one character! Solaris/Sun's OSes are the worse culprit. 
>> Most Linux'es and Cygwin seem to "Do the right thing" most of the 
>> times. Rarely does backspace not perform a backspace on Windows.
>>
>> You dudes/dudettes need to get your S together WRT the frigging 
>> backspace key! How frigging hard is it?
> Not very hard if you take the time to learn a bit about terminals. 
> <BS> on a UNIX keyboard either sends ^? or ^H. 
You apparently ain't getting it! It is only in Unix that often the 
backspace key does not perform the function of moving backward a space 
and deleting the previously character. I have never, I repeat never had 
backspace not do a back space except under Unix - have you?
> If you have "set backspace=indent,eol,start" (or, equivalently, "set 
> backspace=2") in your ~/.vimrc, vim will correctly delete over 
> automatically inserted indentation when it recognizes that you've 
> pressed the backspace key.
Yes, except I put that in my ~/.vimrc and hitting backspace doesn't do that.
> This option wasn't in the original vi, which can't be made to delete 
> over indentation. It's not turned on by default in vim, either, 
> because vim aims for vi compatibility out of the box, and assumes that 
> if you want vim behaviors rather than vi behaviors, then you know what 
> those behaviors are and can take the time to figure out how to turn 
> them on.
Great. What exactly turns them on? Because putting set 
backspace=indent,eol,start didn't do it.
> OTOH, if vim isn't recognizing your piece-of-plastic backspace key as 
> sending the backspace code it expects, be it ^? or ^H, then your 
> terminfo on the server is wrong for the terminal you connect to it 
> with, and one needs to be reconfigured for the correct backspace info.
Backspace backspaces on the bash command line, it just doesn't function 
to backspace past an autoindent.
> Either way, the problem is with your setup, not a fundamental flaw 
> with the way the developers have designed things. 
The mere fact that vim has things like fixdel points to the fundamental 
flaw that I was alluding to and that is that it often doesn't work in 
Unix thus requiring kludges like fixdel. In fact it was spoke about here 
on this very list http://www.cygwin.com/ml/cygwin/2000-04/msg00482.html
> It's no one's problem but your own if you won't take the time to learn 
> about things you don't understand.
I've done more research, learning and understanding in my life than you 
can imagine. I'm not the only one who is confused and fighting this 
problem. Do a little bit of research on your own and you'll quickly 
realize that many, many people struggle with how inconsistently and 
confusingly the backspace key is handled. Indeed having two definitions 
for one key is fundamentally flawed. Having backspace work at the 
command line but not in the editor is fundamentally flawed. Having it 
work at the command line but screwing up when you do a search in more(1) 
is bad. Having it not work when you're typing in a password is bad. This 
treating of backspace differently by various programs and not having it 
do what the word on the keycap states is broken - period!

Seems like my problem was I had a set t_kb=^? in my .vimrc as well as 
the aforementioned fixdel. Indeed the mere fact that I included such 
things in my .vimrc indicate that I was having problems with backspace 
not doing a backspace. I assume that the ^? isn't the two characters ^ 
and ? and I forget how to generate that anymore. In any event I found 
http://www.stripey.com/vim/terminals.html which says to do "execute 'set 
t_kb=' . nr2char(8)". This seems to be working now.
-- 
Andrew DeFaria <http://defaria.com>
COFFEE.EXE Missing - Insert Cup and Press Any Key


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17 16:47             ` Andrew DeFaria
@ 2008-07-17 17:02               ` Matt Wozniski
  2008-07-18  5:50                 ` Andrew DeFaria
  2008-07-17 18:02               ` Mark J. Reed
  1 sibling, 1 reply; 20+ messages in thread
From: Matt Wozniski @ 2008-07-17 17:02 UTC (permalink / raw)
  To: cygwin

On Thu, Jul 17, 2008 at 12:46 PM, Andrew DeFaria wrote:
> Seems like my problem was I had a set t_kb=^? in my .vimrc as well as the
> aforementioned fixdel. Indeed the mere fact that I included such things in
> my .vimrc indicate that I was having problems with backspace not doing a
> backspace. I assume that the ^? isn't the two characters ^ and ? and I
> forget how to generate that anymore. In any event I found
> http://www.stripey.com/vim/terminals.html which says to do "execute 'set
> t_kb=' . nr2char(8)". This seems to be working now.

Well, there's your problem.  You told vim that the backspace key sends
0x7F, when in fact it sends 0x08 in your terminal emulator.  Vim would
have done the correct thing, if it ever saw a backspace, but it never
saw 0x7F, only 0x08.  :fixdel is archaic, and never necessary on
modern systems; moreover you should always understand what a command
does before trying to use it.

~Matt

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17 16:47             ` Andrew DeFaria
  2008-07-17 17:02               ` Matt Wozniski
@ 2008-07-17 18:02               ` Mark J. Reed
  2008-07-18  6:01                 ` Andrew DeFaria
  1 sibling, 1 reply; 20+ messages in thread
From: Mark J. Reed @ 2008-07-17 18:02 UTC (permalink / raw)
  To: cygwin

> It is only in Unix that often the backspace key does not perform the function > of moving backward a space and deleting the previously character. I have
> never, I repeat never had backspace not do a back space except under
> Unix - have you?

I've had such issues on many systems. VMS.  MVS.  NOS and NOS/VE.  Not
to mention several BBSes...

You're forgetting that UNIX predates PC's.  When not in a GUI, or when
focus is in a terminal window, pressing the backspace key doesn't
"perform" any "function" except to transmit a character to the input
stream, just as if you were using a serial terminal.

ASCII control characters were developed for printing teletypes, on
which ASCII BS (chr(8)) would back the carriage up a character
position (without deleting anything) while ASCII DEL (chr(127) a.k.a.
RUBOUT) would delete (white out or X out) the character under the
cursor without moving the carriage.

Just as with CR/LF, CRT terminal behavior didn't match either of the
definitions exactly, and different terminal manufacturers chose
different ways of indicating to the host system that the terminal user
had pressed the "undo that last keystroke" key.  Most sent either BS
or DEL, but some sent multibyte sequences ("escape sequences", even if
they didn't involve the ASCII ESC code) or other values (the Commodore
PET character set used CTRL-T for this; the Atari used a high-bit
value [155, IIRC]).

So UNIX software grew up in an environment of variable terminals.  It
is designed to be flexible about such things for that reason, and
doesn't assume (the way other PC software does) that you're on the
console of a PC with a local keyboard.  Which means it is entirely
possible to set things up so that it doesn't work as you expect.
This is not UNIX's fault.

The default configuration on Cygwin works as expected; you seem to
have blindly imported a configuration file from some other UNIX
environment, and poof, things broke.  That's the price of using stuff
without understanding it.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17 17:02               ` Matt Wozniski
@ 2008-07-18  5:50                 ` Andrew DeFaria
  0 siblings, 0 replies; 20+ messages in thread
From: Andrew DeFaria @ 2008-07-18  5:50 UTC (permalink / raw)
  To: cygwin

Matt Wozniski wrote:
> Well, there's your problem. You told vim that the backspace key sends 
> 0x7F, when in fact it sends 0x08 in your terminal emulator. Vim would 
> have done the correct thing, if it ever saw a backspace, but it never
> saw 0x7F, only 0x08. :fixdel is archaic, and never necessary on modern 
> systems; moreover you should always understand what a command does 
> before trying to use it.
I can as easily say that backspace should always - I repeat always - do 
a backspace.

BTW It would be exceedingly helpful if the documentation said exactly 
what a command does instead of cryptically saying only:

        t_kb    <BS>            backspace key                   *t_kb* 
*'t_kb'*
-- 
Andrew DeFaria <http://defaria.com>
I don't have a solution but I admire the problem.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-17 18:02               ` Mark J. Reed
@ 2008-07-18  6:01                 ` Andrew DeFaria
  2008-07-18 13:09                   ` Mark J. Reed
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew DeFaria @ 2008-07-18  6:01 UTC (permalink / raw)
  To: cygwin

Mark J. Reed wrote:
>> It is only in Unix that often the backspace key does not perform the 
>> function > of moving backward a space and deleting the previously 
>> character. I have never, I repeat never had backspace not do a back 
>> space except under Unix - have you?
> I've had such issues on many systems. VMS. MVS. NOS and NOS/VE. Not to 
> mention several BBSes...
So then you agree with me...
> You're forgetting that UNIX predates PC's. 
No I'm saying it doesn't matter! If the key is labeled "backspace" it 
should perform a backspace function (or whatever program is receiving 
the signal that this key was pressed it should do the backspace 
function). Otherwise label the damn key something else!
> When not in a GUI,
Who said GUI?  Not I!
> or when focus is in a terminal window, pressing the backspace key 
> doesn't "perform" any "function" except to transmit a character to the 
> input stream, just as if you were using a serial terminal.
Yeah right. And the "a" key doesn't perform the "a" function but 
strangely enough when pretty the "a" key an "a" appears!
> ASCII control characters were developed for printing teletypes, on 
> which ASCII BS (chr(8)) would back the carriage up a character 
> position (without deleting anything) while ASCII DEL (chr(127) a.k.a.
> RUBOUT) would delete (white out or X out) the character under the 
> cursor without moving the carriage.
Who cares what it did in the "old days"! We aren't in the "old days"! 
We're 8 years into the 21st century for crying out loud! Who the hells 
uses a teletype anymore?!?
> Just as with CR/LF, CRT terminal behavior didn't match either of the 
> definitions exactly, and different terminal manufacturers chose 
> different ways of indicating to the host system that the terminal user 
> had pressed the "undo that last keystroke" key. Most sent either BS or 
> DEL, but some sent multibyte sequences ("escape sequences", even if 
> they didn't involve the ASCII ESC code) or other values (the Commodore 
> PET character set used CTRL-T for this; the Atari used a high-bit 
> value [155, IIRC]).
This is a driver issue. After 30 some odd years of existence surely Unix 
can get it right finally and do the right thing! Other OSes do!
> So UNIX software grew up in an environment of variable terminals. It 
> is designed to be flexible about such things for that reason, and 
> doesn't assume (the way other PC software does) that you're on the
> console of a PC with a local keyboard. Which means it is entirely 
> possible to set things up so that it doesn't work as you expect. This 
> is not UNIX's fault.
Sure it is! I submit to you that the backspace key should perform the 
backspace function much like the "a" key performs the "produce the 
character 'a'" function 99.999% of the time. The above is all excuses. 
I'm saying it should do the labeled function most of the time and only 
in very rare situations should backspace map to something else. Yet 
there are many, many areas where it just breaks down and you even 
admitted that you've experienced that phenomena too!
> The default configuration on Cygwin works as expected; you seem to 
> have blindly imported a configuration file from some other UNIX 
> environment, and poof, things broke. That's the price of using stuff 
> without understanding it.
That's the price of using stuff that's not well documented. And that's 
the price of using stuff that's been broken for years and has all kinds 
of workarounds over the years. It's a sign that it's broken - otherwise 
there wouldn't be so many fixes. Only Unix suffers this affliction yet 
even you will not admit it's a flaw - which is exactly why it remains...
-- 
Andrew DeFaria <http://defaria.com>
Very funny Scotty - now beam down my clothes.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-18  6:01                 ` Andrew DeFaria
@ 2008-07-18 13:09                   ` Mark J. Reed
  2008-07-18 15:50                     ` Andrew DeFaria
  0 siblings, 1 reply; 20+ messages in thread
From: Mark J. Reed @ 2008-07-18 13:09 UTC (permalink / raw)
  To: cygwin

I think you're missing the point.

Out of the box, on a Linux system, the backspace key works as
intended.  Period. You had bogus configuration stuff in your .vimrc,
which is not Linux's fault.

So it sounds like you're complaining about the fact that it's possible
to screw up something so fundamental as the backspace key in the first
place.  But since people do still log into Linux systems on serial
consoles, the ability to deal with backspace keys that aren't
necessarily the one on the attached USB keyboard is still valuable.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-18 13:09                   ` Mark J. Reed
@ 2008-07-18 15:50                     ` Andrew DeFaria
  2008-07-18 18:04                       ` Christopher Faylor
  0 siblings, 1 reply; 20+ messages in thread
From: Andrew DeFaria @ 2008-07-18 15:50 UTC (permalink / raw)
  To: cygwin

Mark J. Reed wrote:
> I think you're missing the point.
>
> Out of the box, on a Linux system, the backspace key works as 
> intended. Period. You had bogus configuration stuff in your .vimrc, 
> which is not Linux's fault.
No you're missing the larger point. This is Cygwin - not Linux, though I 
know that Cygwin is closer to Linux than other Unix's. Linux generally 
has backspace pretty well configured out of the box as you say. But many 
other Unix's don't. IMHO Solaris is the worse offender in my experience. 
In general however it's only Unix who has particular problems with the 
backspace key. No other key demonstrates as much trouble. Rarely, if 
ever, does "a" not generate an "a" character. Nor "b" generate "b" and 
so on. It's only the backspace key and only on Unix's. Try as you may 
that statement, that simple fact says something to anybody who is open 
minded and who's not immediately defensive and throwing out excuses.
> So it sounds like you're complaining about the fact that it's possible 
> to screw up something so fundamental as the backspace key in the first 
> place. 
Yes I said that... and more. Again, other keys do what their key caps 
say - just not backspace. Why is that?
> But since people do still log into Linux systems on serial consoles, 
> the ability to deal with backspace keys that aren't necessarily the 
> one on the attached USB keyboard is still valuable.
The type of keyboard is irrelevant really. If it says backspace it 
should go backward a space. It should act like backspace does for 99% of 
the other OSes out there. There should be no surprise as to what the 
key's function is and the key should function properly and normally as 
it it labeled. If anybody should be inconvenienced here it should be 
much more the few using antiquated equipment than the masses using the 
equipment of th e day - don't you agree?
-- 
Andrew DeFaria <http://defaria.com>
If debugging is the process of removing bugs, then programming must be 
the process of putting them in.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: un-indenting doesn't work with vim
  2008-07-18 15:50                     ` Andrew DeFaria
@ 2008-07-18 18:04                       ` Christopher Faylor
  0 siblings, 0 replies; 20+ messages in thread
From: Christopher Faylor @ 2008-07-18 18:04 UTC (permalink / raw)
  To: cygwin

On Fri, Jul 18, 2008 at 08:49:20AM -0700, Andrew DeFaria wrote:
>If anybody should be inconvenienced here it should be much more the few
>using antiquated equipment than the masses using the equipment of th e
>day - don't you agree?

Last warning: please take your discussion some place other than the
cygwin list.


cgf

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2008-07-18 18:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-11 12:54 un-indenting doesn't work with vim Robert Latest
2008-07-11 13:01 ` Corinna Vinschen
2008-07-11 15:13   ` Matt Wozniski
2008-07-16  9:50   ` Robert Latest
2008-07-16 10:19     ` Corinna Vinschen
2008-07-16 15:51     ` Andrew DeFaria
2008-07-16 15:56       ` Corinna Vinschen
2008-07-17  5:45         ` Andrew DeFaria
2008-07-17  8:41           ` Matt Wozniski
2008-07-17  9:59             ` Hugh Sasse
2008-07-17 16:47             ` Andrew DeFaria
2008-07-17 17:02               ` Matt Wozniski
2008-07-18  5:50                 ` Andrew DeFaria
2008-07-17 18:02               ` Mark J. Reed
2008-07-18  6:01                 ` Andrew DeFaria
2008-07-18 13:09                   ` Mark J. Reed
2008-07-18 15:50                     ` Andrew DeFaria
2008-07-18 18:04                       ` Christopher Faylor
2008-07-16 17:50     ` Sam Hanes
2008-07-16 18:00       ` Mark J. Reed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).