Ubuntu server 如何设置emacs为默认编辑器

手册/FAQ (262) 2016-04-29 09:47:56

 

方法很简单,用update-alternatives命令

  1.  update-alternatives --config editor  
  2. There are 5 choices for the alternative editor (providing /usr/bin/editor).  
  3.   
  4.   Selection    Path                Priority   Status  
  5. ------------------------------------------------------------  
  6. * 0            /bin/nano            40        auto mode  
  7.   1            /bin/ed             -100       manual mode  
  8.   2            /bin/nano            40        manual mode  
  9.   3            /usr/bin/emacs23     0         manual mode  
  10.   4            /usr/bin/vim.basic   30        manual mode  
  11.   5            /usr/bin/vim.tiny    10        manual mode  
  12.   
  13. Press enter to keep the current choice[*], or type selection number: 3  
  14. update-alternatives: using /usr/bin/emacs23 to provide /usr/bin/editor (editor) in manual mode.  

 

除此之外,在~/.bashrc文件中添加一行:

  • export EDITOR=/usr/bin/emacs  

 

THE END