Edit files directly on the server

I have recently taken more interest into Ubuntu. Though Docker appears to be really useful, I thought that some on server editing would come in useful at some point. Therefore, I did some quick research and afterwards, made some decisions.

The options

If you have suggestions or are happy about a different option (there are many, yes!), please let me know. 🙂

The winner

After some research, the Award went to Vim with plugins. A few of the reasons:

  • none of the open source browser editors provide the functionality Vim does;
  • a browser editor implies some security risks;
  • file permissions in a server environment might turn out to be tricky;
  • vim is a mature product with many years of history behind;

Setting it up

Vim is usually already installed in most Ubuntu systems. But to have it more friendly, you could customise it a bit.

  • curl -sL https://raw.githubusercontent.com/egalpin/apt-vim/master/install.sh | sh
  • apt-vim install -y https://github.com/scrooloose/nerdtree.git

Updating the configuration file:

  • cd ~
  • nano .vimrc
let g:NERDTreeDirArrows=0
set encoding=utf-8

The quick way in

An easy to install editor with a treeview is Micro Editor with a special plugin

Setting it up

  • cd ~
  • curl https://getmic.ro | bash
  • ./micro
  • Ctrl+e
  • plugin install filemanager
  • Ctrl+e
  • quit
  • ./micro
  • Ctrl+e
  • tree

It is as easy as that!

Micro editor has default support for Syntax Highlighting and also great mouse support.

Quick commands

  • Ctrl+w
    Switch between windows
  • Ctrl+q
    Quit
  • Tab
    Open the selected file in the tree view

Sources