AMP - Fully Featured Text Editor for Linux Terminal

Amp is a complete text editor for your terminal, which is inspired by vim's modal approach to text editing. Amp aims to keep things as simple as possible (SAP). There are already plenty of highly-configurable editors available. At its core, amp aims to minimize configuration and provide a great out-of-the-box experience.

As you already know vim editor similarly, Amp is a modal editor: keystrokes perform different functions based on the current mode. Many familiar modes (insert, normal, select, etc.) are available, as well as several new ones providing additional functionality. In this article, we show you how to install amp tool on ubuntu and arch Linux.

Essential Features

First thing we already know, Amp's primary audience is developers. So what's features are available, syntax highlighting, a fuzzy file finder, local symbol jump, and basic Git integration are available without additional configuration or external dependencies that is in the default. (e.g. plugins, ctags, external indexing binaries...etc). So these are the default tools let's talk about its features.

a. First thing we need to know is  Amp shouldn't require any initial configuration.

b. User preferences live in a single YAML (YAML is a human-readable data serialization language. It is commonly used for configuration files, but could be used in many applications where data is being stored or transmitted. )

c. There's also a built-in command to easily edit this file without having to leave the application.

d. Supports UTF-8 (and by proxy, ASCII)

Upcoming Features

a. Supporting other encoding types is not planned. Windows line endings (CRLF) are also currently unsupported but we hope amp will add them in upcoming days.

b. Unlike Vim, Amp doesn't provide split panes, and support isn't planned. It's recommended to use tmux instead, which provides this (and much more) for your shell, text editor, and any other terminal-based applications you may use. But we hope Amp will release it's all features very soon since we all know it's not planned but we hope it may be release soon.

Installation of amp

on Arch Linux

1. Install git for your Arch linux by typing

$ pacman -S git

Or Installation for git on Ubuntu by typing

$ sudo apt-get install git

2. Install amp for Arch Linux

First we have to download amp from git-hub by typing this command

$ git clone https://aur.archlinux.org/amp.git

For Ubuntu same as previous command. Make sure that you download amp in Desktop because it makes the installation easier for you.

Now goto amp directory where you download from git-hub by typing cd (change directory) command cd will work on both platform arch and ubuntu. So goto amp directory by typing  following command

$ cd /home/username/Desktop/amp/

Here, we place username on that directory for e.g my username is anonsurf so i type

$cd /home/anonsurf/Desktop/amp/

Make sure that your installation directory is in Desktop previous we discuss about it.
So Now Let's install

For Arch Linux by typing

$ makepkg

Here, we're just trying to make package file for installation. If required dependencies are missing, makepkg will issue a warning before failing. To build the package and install needed dependencies, add the flag -s/--syncdeps:

$ makepkg --syncdeps

Adding the -r/--rmdeps flag causes makepkg to remove the make dependencies later, which are no longer needed. If constantly building packages, consider using Pacman/Tips and tricks, Removing unused packages (orphans) once in a while instead.

Note:

  • These dependencies must be available in the configured repositories; see pacman, Repositories and mirror for details. Alternatively, one can manually install dependencies prior to building (pacman -S --asdeps dep1 dep2).
  • Only global values are used when installing dependencies, i.e any override done in a split package's packaging function will not be used.

Once all dependencies are satisfied and the package builds successfully, a package file (pkgname-pkgver.pkg.tar.xz) will be created in the working directory. To install, use -i/--install (same as pacman -U pkgname-pkgver.pkg.tar.xz):

So after creating package we have to install it on our system. Install the Package by Typing Following command.

$ makepkg --install

To clean up leftover files and folders, such as files extracted to the $srcdir, add the option -c/--clean. This is useful for multiple builds of the same package or updating the package version, while using the same build folder. It prevents obsolete and remnant files from carrying over to the new builds:

$ makepkg --clean

For more details about makepkg you can search on the web.

On Ubuntu 16.04

For Ubuntu you need to install libssl-dev

$ sudo apt-get install libssl-dev

Now install Cargo so for installing cargo you have to type the following command.

$ sudo apt-get install cargo

After installing cargo you have to install amp by Typing

$ cargo install --git https://github.com/jmacdonald/amp/

Now it will install the amp for your Os for more details search amp in git-hub.

Usage of amp

Exiting

Before launching Amp, it's always a good idea to know how to quit. Type Q (Shift+q) to quit when in normal mode.

Opening Files

Unless you've specified file paths when running Amp, you'll be greeted with a splash screen. You can find and edit files in open mode, by hitting Space.

Searching for Files

Amp's file finder is a little different than most. Rather than using a string fuzzing algorithm to match file paths against the query, it uses string fragments. Instead of typing full words, use fragments of the path name, separated by spaces:

mod app op → src/models/applications/modes/open.rs

Search terms must occur in the path, which in practice tends to produce fewer, more accurate results than fuzzy matching. Order of tokens doesn't matter; you can add fragments from parent directory names after file name fragments.

Selecting/Opening Files

Once the file you're searching for is shown, you can select it using the up and down arrows, followed by Enter. The file finder also has its own insert/normal modes. Hitting esc will grey out the input area and expose the following key bindings:

Keys                                           Action

Space/Enter                                  Open the selected files.

j                                                    Selects the Next Result.

k                                                   Selects the previous Results.

i                                                    Edit the Search Query.

esc                                                Leave open mode.

Movement

Scrolling up/down in normal mode uses the , and m keys, respectively.

For cursor movement, the usual h,j,k,l movement commands are there, along with w,b word equivalents. Anything more than that and you'll want to use jump mode. Press f to switch to jump mode.

Jumping to Symbols

For files with syntax support, you can jump to class, method, and function definitions using symbol mode. Hit Enter in normal mode to use the symbol finder, which works identically to open mode.

Jumping to a specific line

You can also move the cursor to a specific line using g, which will prompt for a target line.

Working With Text

Keys                                       Action

-i                                          Use i to enter insert mode. When you're done adding text, hit esc to return to normal mode.

Backspace                         Delete the character to the left of the cursor.

x                                             Delete the character to the right of the cursor.

d                                             Delete from the cursor to the end of the word.

c                                             Change the text from the cursor to the end of the word.

y                                             Copy the current line.

v                                             Start a text selection range.

/,n/N                                   Search when result found n for next and N for Previous.

z                                             In normal mode to suspend Amp and return to your shell.

fg                                          Run fg to resume it when you're ready to edit again.

 

So this is all about vim's alternative amp text editor. If you don't feel comfortable with vim you can use amp also so as a whole AMP is not bad for text editing you can use it when you are not comfortable with others text editors.

Puskar Trital 12:05 am

About Puskar Trital

Linux System Administrator, Web Designer & Penetration Tester from the homeland of Nepal. He received his Linux administration certification from cybrary. Asides being a tech enthusiast, he is interested in IoT and information security.

Author Archive Page

Have anything to say?

Your email address will not be published. Required fields are marked *

All comments are subject to moderation.

2 Comments