Sunday 15 July 2012

keymapping - Variable Types in Vim Functions -


I want to easily remove the accidental tab when using VIM. The solution that I have exited is making an insert-mode mapping for the following VIM function:

  DeleteTab () redir => L: numSpaces "set set captures the output of the tabstop? Redir end? 'Close the non-numerical output of the set tabstop?' L: numspaces = substitute (l: numspaces, "tabstop =", "", ""), let's say: numspaces = substitute (l: numspaces, "", "", "g") "All the echim lines are for debugging Example "1" for purposes if l: numspaces> 0 echom "2" while 1: numspaces> 0 "normal i  "execute: l: numspaces = l: numspaces - 1 end at end   

What else do I want to do, the result of calling this function in my message" 1 ", but not" 2 ". This means that l: numspaces is not being interpreted as a number. In Vimscript, casting is equal to. Also, am I losing another easy way ?

Instead of using Redir bus and by using tabstop And puts it in Amperses Value.

  Let's: numspaces = & amp; tabstop   <<> <<> <<> <<> <<> < <> <<> <<> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<> Looks like this:  
  function! DeleteTab () let's: numSpaces = & amp; tabstop hm "1" if l: numSpaces> ipom "2" adf while l: nm space> gt; ; 0 "Normal I < Bs> "Execute L: numspaces = l: numspaces - 1 timeout   

In addition to this the function is quite meaningless. You want it to be achieved if you set the following set (or whatever value you want)

  set tabstop = 4 set softtabstop = 4 set shiftwidth = 4             



No comments:

Post a Comment