Thursday, April 24, 2014

Unite.vim is quite useful

For several days I had been using Unite.vim plugin to navigate through the project files. It's quite useful.

After installing plugin my ~/.vimrc contains the following code ( I found somewhere on the web )

  " Unite : http://www.codeography.com/2013/06/17/replacing-all-the-things-with-unite-vim.html  
  let g:unite_source_history_yank_enable = 1  
  call unite#filters#matcher_default#use(['matcher_fuzzy'])  
  nnoremap <leader>t :<C-u>Unite -no-split -buffer-name=files  -start-insert file_rec/async:!<cr>  
  nnoremap <leader>f :<C-u>Unite -no-split -buffer-name=files  -start-insert file<cr>  
  nnoremap <leader>r :<C-u>Unite -no-split -buffer-name=mru   -start-insert file_mru<cr>  
  nnoremap <leader>o :<C-u>Unite -no-split -buffer-name=outline -start-insert outline<cr>  
  nnoremap <leader>y :<C-u>Unite -no-split -buffer-name=yank  history/yank<cr>  
  nnoremap <leader>e :<C-u>Unite -no-split -buffer-name=buffer buffer<cr>  
  " Custom mappings for the unite buffer  
  autocmd FileType unite call s:unite_settings()  
  function! s:unite_settings()  
   " Play nice with supertab  
   let b:SuperTabDisabled=1  
   " Enable navigation with control-j and control-k in insert mode  
   imap <buffer> <C-j>  <Plug>(unite_select_next_line)  
   imap <buffer> <C-k>  <Plug>(unite_select_previous_line)  
   imap <silent><buffer><expr> <C-t> unite#do_action('tabopen')  
   imap <silent><buffer><expr> <C-v> unite#do_action('vsplit')  
   imap <silent><buffer><expr> <C-x> unite#do_action('split')  
  endfunction  

Find a file somewhere in the source code.

Today I find another feature of Unite.vim, searching files.

It turns out you don't need to know which directory the file is in under your source code. Just



<Leader>f
**/*obj.pm

and Unite will display the matched files.
 

Tuesday, April 22, 2014

tmux + bash - C-a to move to the start of command line.

Recently I compiled tmux on the development server when I got tired of trying to find a good terminal multiplexer which I could use confortably.

Don't get me wrong ConEmu is a terminal as good as it gets on Windows.

I've tried several of them following are a few of them
  • Putty Connection Manager
  • Poderosa - Development on this one seems to have been stalled quite a while back.
  • mrxvt - Compiled on Cygwin, this was working fine and probably the longest one I used. But it doesn't support Unicode and there's no plan of supporting it as well. If you just want the multiple TABS with a single window, this should be the choice.
For one reason or the other they fell short. None of the above do more than giving you a TABBED interface like "gnome-terminal" or KDE "konsole".

Then I found ConEmu and it's simply great! Although I could not find a key to set CTRL-Arrow to move from one tab to another.

Bugged me a lot! And hence compiling "tmux" on the Linux server so that I can use it.

"tmux" is great although comes with a default Key Prefix C-b. GNU screen uses CTRL-a as a Prefix key.

If you are like me, I use C-a a lot to move about on the command prompt. Once you bind C-a in ~/.tmux.conf as prefix to "tmux" commands you can't seem to use it.

So if I define the following in ~/.tmux.conf 

unbind C-b
set -g prefix C-a    # I loose the ability to use C-a to move to the start of the line. 

How to use C-a mentions the following tmux configuration to be able to use familiar shortcut.

bind a send-prefix




And now one can use "C-a a"  to do the same trick.

Just in case you want to see what tmux looks like? Here's the screenshot.

tmux running under ConEmu!