Sunday, February 17, 2019

Mac Faqs

1. How to cut a pdf?
 Install qpdf
And then use the command
qpdf --pages input.pdf 1-10 -- input.pdf output.pdf

Friday, March 13, 2015

My Simple Tips

Map Keyboard keys to mouse

-------------------------------------------------------------------
This can be useful in place where you want to use keyboard than mouse.

Packages:
sudo apt-get install xkbset

xkbset m # This will enable keyboard keys to act as mouse keys.

And then map it to keys using the command

xmodmap -e "keycode 108 = Pointer_Button3"

Here the keycode 108 corresponds to AltGr key
And the keycode can be found by using the command

xev | grep keycode

example o/p:
state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,
    state 0x0, keycode 23 (keysym 0xff09, Tab), same_screen YES,
    state 0x0, keycode 23 (keysym 0xff09, Tab), same_screen YES,
    state 0x0, keycode 108 (keysym 0xfeeb, Pointer_Button3),

 Pointer_Button3 is for right click
 Pointer_Button2 is for middle click
 Pointer_Button1 is for left click


To persist the settings across reboots.
For kde desktop, the autostart files can be placed at
~/.kde/Autostart/

Place the below lines in shell script and copy to the location above


#!/bin/bash
xkbset m
xmodmap -e "keycode 108 = Pointer_Button3"
xmodmap -e "keycode 133 = Pointer_Button2"
xmodmap -e "keycode 66  = Pointer_Button1"

Mapped :
CAPS LOCK --> left click
altgr --> right click
meta/windows button -> center click


Vim To have smart search feature 

 ----------------------------------------------------------------------------------
Add this to the ~/.vimrc file
 -----------------------------------------
set ignorecase
#If you type small letters it will ignore casing. If you start with #capital letter it will match exact one
set smartcase 
#This is for incremental search , search will happen as you type
set incsearch
#This is for highlighting the search
set hlsearch
#This is to reset the highligt by pressing enter. Enter key Mapped to reset command
nnoremap <CR> :noh<CR><CR>