Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixing Backspace in Vim

Tags:

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?

like image 768
le-a Avatar asked Jun 06 '26 18:06

le-a


1 Answers

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.)

like image 167
Ben Klein Avatar answered Jun 10 '26 17:06

Ben Klein



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!