Jan 192014
 

Eclipse and VIM are my favorite editors. For tasks that requires a lot of coding and especially for java Eclipse is the best, but it requires a lot of resources (CPU and RAM). When I have to modify just couple of lines, then VIM is the choice; I fix the code faster that Eclipse starts.

For both cases there are situations when you would like to see the lines number. Here is how I do it.
In VIM, having the editor open in command mode, just type :set number, or only :set nu.
Here is the result:

vim show lines number

vim show lines number



To revert it (make lines number not visible), just type :set no number, or :set nonu

To make the lines number visible in Eclipse, we have to play a little with the menu entries: Window->Preferences, a popup will open and then select in the tree General->>Editors->Text Editors and check the Show line numbers, just like bellow
eclipse_show_lines_number

And the result is something like this:

Eclipse show lines number

Eclipse show lines number

Jun 032013
 

Since year 2000 I'm a big fun of vim editor, in that period I've switched from joe editor to the more powerful vim.

In that period I have used it mostly for PHP programming.
What was not quite OK was the fact that I did not have a PHP help "integrated" into my editor.
What I knew is that the documentation of C/C++ was easy accessible within vim.
In vim when editing C/C++ code just go the the name of a function/structure and press K (SHIFT + k) and magically you will notice the documentation of that word coming up.
The background of this behaviour: when "K" is pressed the vim editor will run the command "man $word" and the output of this command is shown in your editor ($word is the word where the cursor is placed)
The good thing is that the "K" bind key is configurable, all that we have to do is to run set keywordprg=/path/to/my_script in vim (or put it in vim.rc file for needed extensions) and when the "K" key will be press then the vim will run "/path/to/my_script $word".

The next good thing is that on PHP site if you need the documentation for a function or for a statement is enough to put in your browser an URL like http://www.php.net/$a_word (e.g. http://www.php.net/foreach http://www.php.net/printf ), and php.net will give you the documentation page.

So, for PHP extension I've run set keywordprg=/home/mark/my_php_doc and inside /home/mark/my_php_doc I have next couple of lines:

#!/usr/bin/bash
elinks http://www.php.net/$1

It will launch the elinks browser using URL http://www.php.net/$1
Now I have an online PHP help available, always up to date 😉 .

A lot of other things can be done here...
If there is not internet available (hard to believe it nowdays) instead of visiting http://www.php.net/site you can build your own script which will grep some local files and eventually will print the piece of file that you need to stdout (it will be redirected to your editor).
You can also extend the documentation with the function/classes from your own libraries, or for other languages than PHP you can search in the specific directories/files .

This is an old vim tip that I'm using since years, but few days ago talking with some other experienced vim users I've noticed that they were not aware of this feature of vim.
So, I felt the need to share it with other people.

Aug 312012
 

Few months ago I've bought an Android tablet made by ASUS, together with the docking keyboard.

Until few days ago I didn't use to much the keyboard, it is useless for browsing and games.

In one weekend I had to go outside of town (no internet) and I still wanted to code some simple PHP pages.

So I was looking for an editor, but looks like it was not easy to find someting convenient on google play store.
I've try few editors but non of them was what I wanted.
I was looking for at least two features:

  • fast enough when editing
  • syntax highlighting

Because I'm very comfortable with vim, in the end I just search on google play store for vim ... Continue reading »

 Posted by at 9:29 PM