About My Blog



Whenever I get stuck doing something - the time comes to venture in the world of internet to find solution. In most cases I do find the solution, solve my problem and go on with my life. Then one day I am faced with the same problem. But now - I can't remember how the hell I solved it the first time. So the cycle begins again. Then I thought, what if I can remember all the those things? So here it is, my Auxiliary Memory. I decided to save all the problems and their solution in this blog so that I can get back to them when I need them. And the plus point is - so can everybody else.
Showing posts with label Vim. Show all posts
Showing posts with label Vim. Show all posts

Tuesday, November 11, 2014

Installing VoraX (A vim based Oracle IDE) on Windows

I am quite a fan of Vim and use it everyday. So it's natural that I was drawn to VoraX. I installed using the following procedure, but got stuck when connecting to the database. The error is related to Broken Pipe during connection. So if anyone has a solution for that please let me know. I will update this blog post if I find the solution.
The things we need for vorax to be installed are -
  1. Oracle Sql Client
  2. Gvim 7.4
  3. Ruby
  4. Ruby Dev Tools
  5. And last, vorax itself

Lets start with Oracle Client. Vorax uses sqlplus to connect to Oracle database. So it needs to be installed and it's path added in Environment Path. I already had it installed in my machine and no further configuration was needed for it.
Next up, Gvim. Just download gvim from it's official website and install it. But the problem with that is gvim requires msvcrt-ruby192.dll. But I was unable to find a windows ruby installer that contained this specific version of the dll. So I downloaded custom gvim build from wyw.dcweb.cn which uses msvcrt-ruby200.dll. I found this link in this stackoverflow discussion. After downloading the custom build I replaced the original gvim74.exe and vim74.exe with the custom ones.
Now, it's time to install ruby. Downloaded Ruby 2.0.0-p594 and extract it in a local directory. Lets call it RUBY_DIR. Now put RUBY_DIR\bin in Environment Path.
After this we need to set up Ruby Dev Tools. Download it and extract to some local path. Let's call it's location DEV_DIR. Now open cmd and goto DEV_DIR. Execute the following command -
DEV_DIR>ruby dk.rb init

This will create a file named config.yml in DEV_DIR. Open the file with notepad and insert the RUBY_DIR location at the end of it if the line already doesn't exist and save it. Now run the following command -
ruby dk.rb install

This will install devkit.rb file in RUBY_DIR\lib\ruby\site_ruby.
Now lets start installing VoraX. First we install some ruby gems required by VoraX. For that Open a cmd and goto RUBY_DIR\bin. Now it's time to install some gems required by VoraX. Execute the following command in cmd -
RUBY_DIR\bin>gem install vorax --no-rdoc --no-ri

If you are behind a proxy set up HTTP_PROXY variable first -
set HTTP_PROXY=http://<proxy address or IP>:port

Now download vorax plugin and extract it's contents in %userprofile%\vimfiles. Make sure %userprofile%\_vimrc file contains the line "filetype plugin on".
Now when you run gvim with vorax installed. Further information can be found
  1. vorax.txt file in downloaded plugins doc folder
  2. https://github.com/oneclick/rubyinstaller/wiki

Friday, November 7, 2014

My Most Used Vim Commands

I have become fond of Vi/Vim in recent years. For most of my typing works I prefer to use Vim. Well editors which provide vim emulation. So I thought why not share the vim commands that I use most.
Lets start with the basics :).

Moving arround:

Command Description
h move the cursor left
j move the cursor down
k move the cursor up
l move the cursor right


Moving arround (advance):

And some advance command for moving arround..

Command Description Remarks
w move cursor to the next word W does the same but considers special characters part of word
b Same as w, but works backwords B is same as W, but works backwords
e Same as w, but cursor moves to the end of word Same as W, but cursor moves to the end of word
% Go to the matching bracket
( Goto start of sentence
) Goto end of sentence
^ Goto first printable character of the line
0 Goto start of the line
$ Goto end of the line
H Move cursor to the first viewable line
L Move cursor to the last viewable line
zz Move window such that the cursor comes to the middle of the screen


Manipulating Text:


Command Description Remarks
u Undo last action
x delete character under cursor
dw delete one word can be used with other movement commands
dd delete whole line
I Goto start of the first printable character on the line and switch to insert mode
a Switch to insert mode after the character under cursor
A Goto end of line and switch to insert mode
o insert line below current line and goto insert mode
O insert line above current line and goto insert mode
y Copy/yank character under cursor yy copies current line
p paste copied text
~ change letter case
v turn on selection mode you can use movement commands to selecte texts in visual mode


Searching


Command Description Remarks
/ searches the following text starting from the cursor and forward type the text to be searched after the / and press enter
n goto the next occurence of the searched text
N goto the previsou occurence of the searched text


Miscelleneous:


Command Description
zo Open folded lines
zc fold the foldable region the cursor is currently in


Ex Commands

Now some ex commands. (These commands are given using :) -
Command Description
:w save file
:q quit vim
:%sort sort all lines in the files lexicographically
:nohl turn off highlighing of searched items
:syntax on turn on syntax highlighting
:set ft=<filetype> sets filetype of the file for syntax highlighting
:set wrap turns on wrapping of lines
:set nowrap turns off wrapping of lines

Phew... the list got bigger than I expected. And these are only the ones I use in my regular vim activity. Furthermore, I consider myselft just a novice of vim :p.