le-a
le-a

Reputation: 95

Fixing Backspace in Vim

I'm having issues with my backspace in Vim, it is inserting ^? instead of deleting characters. I found this wonder bit of Vim documentation that will hopefully fix this problem.

        If the backspace key terminal code is wrong you can
        use this:
            :if &term == "termname"
            :  set t_kb=^V<BS>
            :  fixdel
            :endif
        Where "^V" is CTRL-V and "<BS>" is the backspace key
        (don't type four characters!).  Replace "termname"
        with your terminal name.

I am trying to add this bit of code to my .vimrc as the site suggests, but how do I know what my "terminal name" is?

Upvotes: 3

Views: 351

Answers (1)

Ben Klein
Ben Klein

Reputation: 1949

When you see &something in Vimscript, the something stands for one of Vim’s options (as are set with :set); &something refers to the current value or setting of something. You can use echo (or echom) to get the current setting of a given option. So in this case, you can get the terminal name — what is referred to in that code as &term — by starting Vim and running

:echom &term

and you can then replace termname in the code with the result.

(You can also use :set for this, as it turns out, by appending a ? to the option; running

:set term?

would print out the current setting of term, as e.g. term=xterm-color.)

Upvotes: 4

Related Questions