Editing files over ssh in vim

archlinux-logo-dark-200dpi.b42bd35d5916

Need a quick file edit on remote server. With vim it’s easy, use:

vim scp://username@host:port//path/to/file

…or within vim:

:e scp://username@host:port//path/to/file

…or if you are not sure about name of the file, browse remote directory with:

:e vim scp://username@host:port//path/to/directory/

Directory path must end with /.Remote home directory is invoked with:

:e scp://username@host:port/~/

Use rcp instead of scp for ftp access.
Happy hacking….

Advertisements

My new, old laptop

When my old laptop’s display crashed, it became desktop, connected to external display via working VGA output and I suddenly lost mobility. I ‘need’ mobility, because I like working outside if the weather allows it. I don’t need some powerful laptop, because mostly I use it as text editor (vim) and music player (moc) while I work and that’s it. So all I need is terminal emulator, in my case tmux, vim, moc and of course some extended functionality with vifm as file manager, mutt as mail client, elinks as web browser, newsbeuter as RSS reader and oysttyer as Twitter client (official fork of well known TTYtter) as base. I must not forget ‘upgraded’ working enviroment using X server with i3 window manager, qutebrowser as web browser (I really like that browser – keyboard-driven, vim-like browser based on PyQt5 and QtWebKit) and mpv for playing video and this is about the whole list of what I have installed on my old laptop (now desktop).
toshiba.console

Toshiba running tmux with oysttyer in open window.

When I mentioned to a friend that I need new laptop, he offered me his old Toshiba Satelite Pro 4600 to ‘recycle’ it. That was love an first sight and I was determined to make it operational with new Linux. It is in very good condition, well preserved, keyboard as new and only one dead pixel on display. Last installed operating system was Windows® 2000 from the year 2000, originally it came with Windows® 98 installed.

This is output from inxi, for a little technical background:

System:    Host: boris-t Kernel: 4.3.3-3-ARCH i686 (32 bit) Console: tty 4 Distro: Arch Linux
Machine:   System: TOSHIBA product: Satellite Pro 4600 v: PS460U-06USV8E
           Mobo: TOSHIBA model: Portable PC v: Version A0 Bios: TOSHIBA v: Version 2.50 date: 06/18/2001
CPU:       Single core Pentium III (Coppermine) (-UP-) cache: 256 KB speed: 897 MHz (max)
Graphics:  Card: Trident Microsystems CyberBlade/XP
           Display Server: N/A drivers: trident (unloaded: vesa) tty size: 128x47 Advanced Data: N/A out of X
Audio:     Card Intel 82801BA/BAM AC'97 Audio Controller driver: snd_intel8x0 Sound: ALSA v: k4.3.3-3-ARCH
Network:   Card: Intel 82801BA/BAM/CA/CAM Ethernet Controller driver: e100
           IF: enp2s8 state: up speed: 100 Mbps duplex:
Drives:    HDD Total Size: 52.0GB (23.0% used) ID-1: /dev/sda model: IBM size: 20.0GB
           ID-2: USB /dev/sdb model: STORE_N_GO size: 32.0GB
Partition: ID-1: / size: 19G used: 8.7G (51%) fs: ext4 dev: /dev/sda1
Sensors:   System Temperatures: cpu: 68.0C mobo: N/A
           Fan Speeds (in rpm): cpu: N/A
Info:      Processes: 86 Uptime: 34 min Memory: 83.9/244.5MB Init: systemd Client: Shell (bash) inxi: 2.2.32

and link to Toshiba Satelite Pro 4600 (I only find this and not the version with 900MHz clock speed, 256MB ram and 20GB hard disk as is mine, but everything else is correct) web site.

First thing I did was format and check disk for errors using SystemRescueCD. The CD Rom and floppy disk (and yes I still have floppy disks, found 10 pieces in unopened package) both in excellent condition, the Trident graphic card working without a glitch and integrated ethernet card (last series had also integrated wifi card) had no problem with internet connection. The battery is as new, still with design capacity 4000 mAh and last full capacity 3844 mAh = 96% (stated by acpi, with command acpi -i).

As big ArchLinux fan, there was no doubt what to install. It took me about half an hour to install and configure (backup configuration files were installed with yadm ‘Yet Another Dotfiles Manager’, great backup utility, using git as backup destination) all command line and X apps.

I was realy lucky, that I get my hands on wifi PCMCIA card so I didn’t need to use USB wifi card, and both USB(1) ports are free (I’m using one port for 32GB USB key as second disk for music files, because internal HDD is only 20GB) and I’m mobile again. I must admit that I expected problems during installation.

The only ‘problem’ that I have now is the lack of ram, so boot into X  is slow and opening take some time. I didn’t even try to install Calibre, Firefox or Chromium. So my ebook reader is ncurses fb2 reader fbless and I use Calibre on ‘desktop’ for converting ebooks to fb2 format.

toshiba-i3

Toshiba running running xorg-server, i3 window manager and qutebrowser.

I’m really happy that I succeed and made Toshiba Satelite Pro 4600 functional again, all I need now is to get another HDD as reserve and maybe another 256M ram to upgrade to 512M. Everything else is fine as it is now. This post is also written on this laptop in console with vim.

tfman – a different file manager

tfman tfman_vim

There are a plead different file managers out there, with or without GUI, with variable amount of panels, keyboard or mouse driven and so on, but this one is a little bit different. It is still in an early stage of development so it is not yet 100% ready, but it is already show potential to be useful terminal driven file manager.

It is named tfman  – “text file manager” and it performs file operations through textual representation of file system which is in the form of plain text, editable with any text editor and may contain multiple operations of every kind. Tfman can be used from command-line or from within Vim as multi-window file manager.

A quick start guide is here, tutorial here and manual page here.

For now it is only available as package at Arch AUR, for other Linux flavours you must compile and install tfman manually.

Happy hacking….

playshell – a different media player

playshell

 

What are you expect from media player? GUI, ncurses or any other interface, you won’t get that with playshell. Playshell is rather different, because it feels almost like command line control and is in fact bash-based front end for various (video and audio) players (mplayer, sox, vlc, ffplay, gst123, amp, aplay, madplay, mpg123, mpg321 and splay at the moment) and manages playlists with use of text editor (it’s vim for me).

There is no need for installation if you just want to try it, just run:

$ bash start.sh

in the extracted folder, or compile it with:

$ bash compile.sh

and run:

$ bash playshell

If you want to install it, run:

$ bash install.sh

as root or with sudo.

The simple interface support basic commands like play, stop, pause and other functions, if they are supported by player.  It also support shuffling, repeating, looping and queing.

Function keys:

   h           shows this help info

   space       select a number
   enter       play an existing entry or a new one

   x           play current number
   X           play latest
   v           stop
   c           pause
   b           next play
   z           previous play
   Z           previous play (history based)
   .           play random

   right       forward play
   left        rewind play

   home        select first entry
   end         select last entry
   page-up     go back by 4 steps
   page-down   go forward by 4 steps

   n           set in advance the next numbers that will play
   N           same as above but override and not append to
               anything that's already set

   a           add entries
   A           add entries and play them
   i | insert  insert entries after current play
   I           insert entries after current play and play them
   R           add a random entry from the library
   d | delete  delete current number
   D           delete entries based from input
   s           search
   S           search (no scrolling)
   l           show playlist
   L           show playlist with full path names
   e           edit playlist
   f           reload data from the playlist file
   $           sort playlist
   %           sort playlist based from filenames

   W           save playlist to a file
   |           load playlist from a file

   y           show files in library
   E           edit library's paths list
   F           refreshes the library from the paths list

   [           disable current number
   {           disable entries based from input

   ]           enable current number
   }           enable entries based from input

   t           flags current number to stop after play
   T           flags current number to quit after play
   H           flags current number to halt system after play

   r           toggle repeating
   u           toggle shuffling
   o           toggle looping of play (repeat-track)
   @           toggle manual play mode
   ^           toggle video

   + | up      volume up
   - | down    volume down
   0           mute or set volume to lowest

   m           shows mixer
   M           runs alsamixer -D equal

   !           open a shell
   /           evaluate a shell command

   `           switch logging mode
   ~           switch logging mode (reverse)

   p           print status

   k           clears the screen

   w           save session immediately

   q           quit
   Q           quit (also, but do not stop active play)

…and that’s about it. Simple and very effective.

Configuration of the players is done by editing /etc/playshell/tables/players.table file, wher you can also change play options and preferences or change preffered order of players, all other data is in ~/.playshell folder.

Just give it a try, you wont regret it. Enjoy!