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

  • The most obvious one is using an editor with FTP/sFTP editing capabilities
    • Notepad++ on Windows machines;
    • Atom with ftp-remote-edit.
  • Browser code editors:
    • https://github.com/RecaMedia/Backdoor
    • https://github.com/Codiad/Codiad
    • https://github.com/icecoder/ICEcoder
  • On server editors:
    • Nano
      https://www.nano-editor.org/
    • Vim
      https://www.vim.org/
    • NeoVim
      https://github.com/neovim/neovim
    • Emacs
      https://www.gnu.org/software/emacs/
    • Micro Editor
      https://micro-editor.github.io/index.html

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

  • https://www.slant.co/versus/42/62/~vim_vs_neovim
  • https://www.youtube.com/watch?v=tQtYCACsdtw
  • https://www.youtube.com/watch?v=CPu9mDpSYj0
  • https://github.com/rafi/vim-config
  • https://github.com/xmementoit/vim-ide
  • https://github.com/zyedidia/micro/blob/master/runtime/help/keybindings.md
  • https://vimawesome.com/