Friday, August 31, 2007

TownkVisualMarks (Screenshot)

I'm solving some issues with balloons and marks but I'm pretty confident that I'll release a test version this weekend.

And just to give you a glimpse of what this plugin will be, here it go a screenshot:



I hope you like it!

Thursday, August 30, 2007

Done!

The TownkVisualMarks plugin seems to be done! I need to run some unit tests on it and if everything pass successfully I'll publish it on VIM.org to evaluation and tests :D

Sunday, August 26, 2007

TownkVisualMarks (development report)

First of all, let me explain what this plugin is:

Its a plugin that puts visual marks on a text file that could be persistent (a.k.a. Bookmarks), dynamics (warning, error and info) or temporaries (quick bookmarks).

As you could see the TownkVisualMarks has (at least until version 1.0) 5 marks that could be inserted into some text file, they are:

  • Information
  • Warning
  • Error
  • Bookmark
  • Quick Bookmark
Three of this marks (information, warning and error) are only inserted into the text through a dynamic way. This means that, like OmniFuncions, a predefined function is called when a buffer is read or saved to know where to put these marks.

The "Bookmark" mark is the one that is persistent, this mean that if you put a Bookmark into any text file, no mater if you turn Vim off or not, this mark will be saved into your .vimfile (only if you have the "!" option added to viminfo option).

If you want just a quick book mark to a file that you are editing right now, than the "Quick Bookmark" mark is for you. This mark is just like a Bookmark but it is not stored on your .viminfo file.

Well, probably this coming week I'll post some more news about this, keep tunned!

Tuesday, August 21, 2007

Update

Ok, I finish the book and boy, this book worth every penny I paid on it!

Well, what I decide to do is separate my entire work in modules and delivery every one on vim.org after I finish it.

The modules that I want to do are:

Visual Marks: use 'sign' command to create visual marks automatically when we get an error, a warning or just a info (i.e. TODO, FIXME, etc) on quicklist (i.e. when use :make command). Also this plugin should allow user to create persistent bookmarks on vim, this way he/she can bookmark a given line on a given file, close vim, open it again and by menu (gVim) or command go right through that bookmark that he/she previously save.

TextMate snippets: I know that there are some plugins that claim to do just that, but my proposal is to create a plugin that reads each snippet from a file that has it syntax exactly like what TextMate propose.

Project Manager: This plugin will be the biggest and most difficult one. As its name says it will control solutions, files, and whatever I found interesting.

Project Tags: This will be the last plugin and it will control the ctags' tag creation to each file of the project.

Well, right now I started the Visual Marks plugin and when I have something that works as I expect that the hole plugin works, I'll publish the file here. In the mean time keep following the blog to get updates about the project.

Friday, August 10, 2007

New Vim book

Since yesterday I'm reading a new Vim book: Hacking Vim (A cookbook to get the most out of the latest Vim editor).

Well I don't have to tell you that this book will help me a lot on this new Vim project!

As soon as I got some news I post here... be prepared to even a change of the name of this blog!

Tuesday, August 7, 2007

The Project Manager

I looked for some IDEs and thought that a good way to represent the project manager is the way that Mono Developer and Visual Studio do this stuff: a window to show "Solutions" and other to show classes from the selected solution.

I did a mockup of this just to put here:


As you can see, the top window will be made using a ctags database that will be generated as we create/expand our project.

Now, the bottom window will contain all of our "solutions" that are nothing more than our projects. This windows must be created and controlled by our own plugin.

Friday, August 3, 2007

"Perfect"??? ctags DB for a .CPP file

Ok, I figure out a way to create at least a good ctags file to a .cpp/.h file being edited.

I use the C Pre-Processor (cpp) that came with GCC but I believe that should be very easy to adapt this to other pre processor. Well, let me show you some code:

function! CreateTag()
  let inc_list = ["/myproject/include", "/otherproject/include"]

  if !has("unix")
    let redirect_null="> nul"
  else
    let redirect_null="2>&1 1> /dev/null"
  endif
  
  let inc_cmd = " " 
  for inc in inc_list
    let inc_cmd = inc_cmd."-I".inc." "
  endfor

  let pp_cmd="cpp -H -M" . inc_cmd . expand('%') . " " . redirect_null
  let register_a = @a
  redir @a>
  exec ":silent !".pp_cmd
  redir END

  " remove every line that doesn't start with a '.'
  let @a = substitute(@a, "^.\\{-}\n\\(\\..\\{-}\n\\)[^\\.].*$", "\\1","g") 
  " remove '.' from beginning
  let @a = substitute(@a, "\\.\\{-1,} ", "", "g")
  " prepare it to be evaluated as an array
  let @a = "[\"" . substitute(@a, "\r\n", "\",\"", "g") . "\"]"

  " convert the founded files into an array
  let file_array = eval(@a)
  " restore register
  let @a = register_a

  " mount the ctags command
  let ctags_cmd="ctags --c++-kinds=+p --fields=+iaS --extra=+q -f /tmp/" . expand('%') . ".tags "
  for inc in file_array
    let ctags_cmd = ctags_cmd . " " . inc
  endfor
  let ctags_cmd = ctags_cmd . " " . expand('%')

  exec ":silent !" . ctags_cmd
  exec ":set tags=/tmp/" . expand('%') . ".tags"
endfunction

I know, I know, its not clean but it was quickly made just for test purpose, but I think that already is a good start!

ps.: If you want to do a plugin with this code, feel free to do it, but just give me some credit ;-)
pps.: I need to find a better way to put codes here, specially with highlighting
ppps.: Stupid me! There is a TOhtml command in Vim 7.1 that does exactly what I want :P

Thursday, August 2, 2007

Things to think

Today I discover some interest thing about code complete in Vim.

I'm using OmniCppComplete and I spend some time figuring out how to create the perfect tag database to a single file.

The "hole project" tags is not what I want because if my file didn't include "MyHeader.h" where is located "class MyClass;" and I use the "hole project" tag I will get the completion for MyClass stuffs anyway.

So, I found a Vim plugin called Intellisense and in a page of this project they explain how it works. I found myself thinking in how can I discover all included files from a single cpp file with tools already available on my Linux box (or Windows).

Well, I'm digging a path through the gcc preprocessor, but as soon as I get something better, I'll put it here.