Conor Mac Aoidh
http://macaoidh.name
conor@macaoidh.name
 

Search

Archives

  • September 2010
  • August 2010
  • July 2010
  • June 2010
  • April 2010
  • March 2010
  • December 2009
  • November 2009
  • October 2009
  • September 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008

Spam

4,906 spam comments
blocked by
Akismet

Tag Cloud

    1.0 beta CMS conor's management system conormacaoidh conor mac aoidh content management system download drums Fedora fedora 10 furasta furasta cms furasta org gnome hello world HTML icsp Java javascript joomla jquery kde Linux Mandriva mc kennas Monaghan Music mysql php plugin release Scratch stealing the ceiling The Dominican Affair the pot smoking pirates the strats tutorial Twitter updates web design forum webme webworks weekly tweets wordpress

Ads

OS X VIM Syntax Highlighting

Posted Jun 12th, 2010 by Conor in in Linux,UNIX

Syntax highlighting isn’t enabled by default on OS X, though it’s easy enough to set it up, and a few other small enhancments at the same it.

Start by executing this command:

cd /usr/share/vim && sudo vim vimrc

After entering your password press i to enter insertion mode and add the following lines after the line set backspace=2:

set showmatch           " automatically show matching brackets
set binary noeol        " do NOT put a carriage return at the end of the last line
set backspace=indent,eol,start  " make that backspace key work the way it should
set history=100         " keep 100 lines of history
set ruler               " show the cursor position
syntax on               " syntax highlighting
set hlsearch            " highlight the last searched term
filetype plugin on      " use the file type plugins

" When editing a file, always jump to the last cursor position
autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") < = line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif

The lines above add syntax highlighting and a few other useful things. The line set binary noeol is very important for web developers. For example if you are programming in PHP and you leave a space outside the closing ?> it will cause http headers to be needlessly sent. That line prevents that from happening.

Well that's it if you press ESC then type :wq you will return to the terminal. Try editing some files again and the highlighting should be enabled.

4 responses so far

Mac OS X – VIM Templates

Posted Dec 24th, 2009 by Conor in in Linux,UNIX

I have always wondered if it was possible to use a template system with VIM. Whenever I used large editors it was usually because of the default template schemes they allow. I have always preferred using VIM because it’s so practical, and it’s useful to be able to execute commands in-between editing files.

Well anyway here are a few commands to configure a vim template system on UNIX (It should work on both OSX and Linux):

  • Download the template system:
    curl -C - -O http://www.vim.org/scripts/download_script.php?src_id=3747
  • Open VIM:
    sudo vim
  • Source the file you have downloaded from within VIM by typing:
    :source ./download_script.php\?src_id=3747
  • Now the VIM template system has been configured. The previous command should output the template directory so that you can create new templates, it differs depending on your OS.

That’s it if you need more info on how the system works you can visit the project homepage here.

No responses yet



Conor's Blog is powered by Wordpress | Template design by Conor Mac Aoidh