Friday, August 9, 2013

git update remote origin

git update remote origin
It might happen during  addition of the repository origin that you typed an incorrect URL ( happened to me :P ) .  In such cases you will get an error like this
just update the remote origin with this command

  • git remote set-url origin <URL>

Wednesday, August 7, 2013

Need to copy directories from your computer to laptop ?

Ssh is handy in such cases , all you need to do is

  • scp -r userName@ipAddress:/path/to/folder destinationFolder
  • e.x scp -r vihaan@192.168.0.1:~/Downloads/eclipse .
  • "." refers to the current directory.


Tuesday, August 6, 2013

Word wrap the contents of a file

    • :set wrap
How to open a file in Read Only mode

    • vim -R fileName
Typing a big command on Terminal ?

Why don't you try reverse-i-search  feature built in the terminal. Just press Ctrl + R and only a unique part of the big command that you have already executed before.

Here is how I start eclipse on my system just by typing 'ec'
You might find a problem associated with reverse search that it just searches in the reverse direction and once your are past what you were searching for , your efforts are rendered useless.

There is a solution around this and you can enable forward search by some modifications.

  • Open up .bashrc and add the following lines in it 
    • stty -ixon
  • refresh the bash setting by executing
    • source .bashrc
Now you will be able to search forward using Ctrl + s .
Dot Files

Make Vim even better with some dot files ( https://github.com/sontek/dotfiles ).
Handy Vim shortcuts

  • Line Numbers
    • Set line number with
      • :set nu
    • Unset line numbers with
      • :set nonu
    • Set relative line numbers with 
      • :set relativenumber.

  • Copy selected lines from vim visual mode to system clipboard.
    • "+y and then paste it outside vim.

  • Make vim paste the content from outside properly.
    •  :set paste
  • unfold code
    • zo
  •  fold code  
    • zc