How Vim Can Make a Hacker’s Life Easier with Macros and Registers

2025-03-09 5 min read Hacking Tools

How Vim Can Make a Hacker’s Life Easier with Macros and Registers

Why Every Hacker Should Master Vim Macros and Registers

If you’re deep into hacking, pentesting, or security research, you know that automation is key. Repetitive tasks like manipulating payloads, encoding/decoding strings, or tweaking shell scripts can become tedious. Enter Vim macros and registers! These powerful features let you record and replay keystrokes, making your workflow insanely efficient.

No that I dont use IDE’s the likes of Visual Studio code (sometimes I do). However they can never match the raw power of vi/vim/nvim or any of the vim family of editors. To reap the maximum benefit, you have to learn the basics of using the editor in normal mode ( which is by the not the editing mode).

Continue reading

ncurses based eFTE editor – programmers lightweight editor

2014-11-17 1 min read Fedora Learning

nefte is a lightweight programmers editor. Here is descriptioin:

 

Description : eFTE is an advanced programmers editor with goals of being lightweight, yet
            : totally configurable. Support for user defined programming languages, menu
            : systems and key bindings are provided with many common defaults already
            : defined. eFTE is still a new project, however, we extend from the FTE editor
            : which was first released in 1995, so eFTE is tried and true with many features
            : for the programmer/text editor.
            : 
            : This package contains nefte, the ncurses version of the editor.

And to install:

Continue reading

vim – yank/xopy in different register to paste

2014-01-16 1 min read Vim Tips

Very quick update, to use registers, you can select and then yank in a register to paste using the same register. This could be a convinient way to copy multiple selections and then paste which ever selection you want. Here is the simple way to do it:

visuallly select with v/V

then “qy to yank (here we are yanking into register q, so in the command you can use any of a-z to use as register)

Continue reading

Check all vim colorschemes for minor issues

2013-10-10 2 min read Bash Vim Tips

Here is script that checks all the colorschemes in the current directory and corrects them if possible (Processing of the file is done with simple commands like sed, grep)

Checks that the color_name is same as Filename

Here is the script:

#!/bin/bash -
#===============================================================================
#
#          FILE: check_colors.sh
#
#         USAGE: ./check_colors.sh
#
#   DESCRIPTION:
#
#       OPTIONS: ---
#  REQUIREMENTS: ---
#          BUGS: ---
#         NOTES: ---
#        AUTHOR: Amit Agarwal (aka), 
#      REVISION:  ---
#===============================================================================
cd ~/.vim/colors
for i in *vim
do
    #echo "Processing $i"
    if [[ $(grep -c g:colors_name $i ) -eq 0 ]]; then
        if [[ $(grep -c colors_name $i ) -eq 0 ]]; then
            echo "File $i does not have colorname";
            missing=$missing" $i"
        else
            sed -i.bak '/colors_name/ s/.*/let g:colors_name="'${i//.vim}'"/g' $i
        fi
    else
        if [[ $(grep -c colors_name $i|grep let ) -gt 1 ]]; then
            echo "WARN ----->> File $i has more than one colorsname"
        fi
        colorname=$(grep g:colors_name $i|grep let| sed -e 's/"//g' -e 's/.*=//' |tr -d ' ')
        if [[ ${colorname}.vim != $i ]]; then
            echo "Filename $i does not match colorname $colorname .. correcting "
            sed -i.bak '/colors_name/ s/.*/let g:colors_name="'${i//.vim}'"/g' $i
            #sed -i.bak 's/(.*g:colors_name.*=)/1'${i//.vim}'/g' $i
        fi
    fi
done

if [[ x$missing != x ]] ; then
    echo "Missing colornames in $missing"
fi

 

Continue reading

vim maps – simple commands to do stuff.

2013-08-28 1 min read Vim Tips

Some time back, I was working on some script for logging and I wanted to change the class to function like this:

$logger->Debug("Test string");
loggerFunc("Debug", "Test String");

As you can see, this change could be quite frustrating if you have quite a few references. And thus vim comes to rescue.

Simple map like ::

:map ,mm :s/(.*)$logger->(.*)((.*)).*/1loggerFunc("2",3);/

and then I can do “/$logger->” and then “n” to go to next match. Just do “,mm” and the line is re-factored.

Continue reading

Vim – Why and where am I getting these errors from?

2013-05-15 1 min read Vim Tips

If you have got this question in your mind, then you are in right place.

vim -V20  2>&1 |tee

You can give the debugfile as any file, where you would want to log the debug messages. This will log a lot of information in the debugfile, you can open the file, once you have got the error in the main vim window. After this, you can open the debugfile and simply search for the error that you were getting. Just look for the reason why this error is originated in the debug logs and then it should be pretty simple to fix that.

Continue reading
Older posts