How to make the vim call function in .bashrc?

后端 未结 5 2039
春和景丽
春和景丽 2021-01-04 05:57

Environment: debian9+vim7.4.

   cat .bashrc
   add(){
        echo $(expr $1 + $2)
    }

Now edit a file in vim

add 1 5         


        
5条回答
  •  抹茶落季
    2021-01-04 06:25

    The problem is your function is limited to an interactive shell to execute it you have to do like this

    :!bash -ic "add 1 2"
    

提交回复
热议问题