Wednesday, September 30, 2009

my ~/.vimrc

"-------------------------------------
" always show this custom status line
set notitle       " to avoid vim renaming the title of the xterm window
set nonumber      " we don't need line numbers on the left, because we have status line
set laststatus=2  " always show the status line
set statusline=%<%F%h%m%r%h%w%y\ %{&ff}\ %{strftime(\"%c\",getftime(expand(\"%:p\")))}%=\ col:%c%V\ line:%l\,%L\ %P
" -------------------------------------
" use 2-space indentation
" set tabstop=2     " read :help tab for explanation of tabstop, softtabstop, shiftwidth
" set softtabstop=2 "
set shiftwidth=2  "
" set expandtab     " inserts spaces instead of tab (for real tab use ctrl-V - tab)
" -------------------------------------
set showmatch     " When a bracket is inserted, briefly jump to the matching one if it is visible on the screen.
set matchtime=3
" -------------------------------------
" set autoindent
" set smartindent
" set paste       " you can set paste temporarily, but be aware that it interferes with autoindent
                  " it turns it off (and many other settings). Read :help paste
" -------------------------------------
set incsearch     " search incremental
set ignorecase    " search case-insensitive
set smartcase     " search case-insensitive for small chars, case-sensitive if at least 1 capital char
set nohlsearch    " search highlighting
" -------------------------------------
" This only works if you have plugin under .vim in home dir
" or if you include here a command to source plugin, for example:
"   source ~lselector/lselector/.vim/plugin/taglist.vim
:map :TlistToggle
let Tlist_Exit_OnlyWindow = 1
" -------------------------------------

set ignorecase
set smartcase
set incsearch
set title
set wrap
set wildmenu
set noautoindent smartindent
set hlsearch
set paste
set ic

set softtabstop=2
set shiftwidth=2
set tabstop=2
set expandtab

match ErrorMsg '\%>80v.\+'
match

nnoremap :set invpaste paste?
set pastetoggle=
set showmode

nnoremap :set nowrap!
"set wrap!=
"set showmode

":set mouse=a
":map
":map
":map
":map

:map
:map
noremap :call ToggleMouse()

function! ToggleMouse()
  if &mouse == 'a'
    set mouse=
  else
    set mouse=a
  endif
endfunction

if match($TERMCAP, 'Co#256:') == 0 || match($TERMCAP, ':Co#256:') > 0          
      set t_Co=256                                                               
endif

command -nargs=1 T2 :2match Search //




2nd paragraph is for not putting tab as /t ( instead, put it as 2 spaces).
3rd paragraph is for limiting column to 80. It will start highlighting if it goes after 80. For undoing it in some cases you can say ':match'.

Monday, September 28, 2009

Editing multiple lines in vim

1.Press ctrl + v (To selest visual block. v/V are for visual region)
2.Select lines you want to append to.
3.Press I{string}<ESC>
(Note: Its I = capital i = shift+i)

In our case, {string} = #. It takes a while for changes to appear after you press <ESC>.

Saturday, September 19, 2009

Searching using/in URL bar

1. Go to any site which you use for searching (e.g. Wikipedia).
2. Right click on text box where you enter your query.
3. Click on "Add a keyword for this search".
4. Enter <keyword>(e.g. wk) in keyword box.
5. Save.

Whenever you want to search 'something' in Wikipedia, just type 'wk something' in URL bar. If search doesn't work, try to analyse and modify location field.

Wednesday, September 16, 2009

'rename' command

To rename multiple files:
I wanted to rename all files in a folder from *_vXXX.sh to *_vYYY.sh.
Thus I used

rename XXX YYY *_vXXX.sh


We can specify the number of wild characters in searching pattern by ? e. g. reaplce only a_vXXX.sh but not ab_vXXX.sh

rename XXX YYY ?_vXXX.sh

Monday, September 7, 2009

'ndiswrapper' on fedora 11

Again this might change with newer version of OS or different version of OS.

rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stabl
yum install kmod-ndiswrapper
mkdir ~/new_installation/ndiswrapper_driver
cd ~/new_installation/ndiswrapper_driver
wget http://www.jbg.f2s.com/bcm43.bz2
tar jxvf bcm43.bz2
cd bcmwl5\ driver
ndiswrapper -i bcmwl5.inf


Now reboot your machine and execute these commands.

modprobe ndiswrapper
ndiswrapper -ma

Wednesday, September 2, 2009

Installing GUI on a non-GUI/Command line terminal

We need to execute 2 packages as opposed to google's result.

yum -y groupinstall "X Window System" "GNOME Desktop Environment"