You are here

Shells and editors configuration

This is part of my shell configuration


This configuration allow, when using tmux:

  • Ctrl+arrow to move around words in tcsh and zsh
  • Ctrl+arrow to move around words in vim
  • Shift+arrow to selects characters in vim
  • Ctrl+Shift+arrow to selects words in vim
  • Many other things


set nocompatible
set tabstop=4
set shiftwidth=2
set showmatch
set guioptions-=T
set vb t_vb=
set ruler
set nohls
set incsearch
set virtualedit=all
set bs=2

syntax on
colorscheme zenburn
if !empty($TMUX)
    if &term =~ 'xterm-256color'
      " Disable Background Color Erase (BCE) so that color schemes
      " work properly when Vim is used inside tmux and GNU screen.
      " See also
      set term=cons25
      set t_ut=
      set t_Co=256

      "Ctrl + Arrows => Move fast
      map ^[[1;5C w
      map ^[[1;5D b
      imap ^[[1;5C w
      imap ^[[1;5D b
      "Del => Delete
      map ^[[3~ x
      imap ^[[3~ x

      "Shift + Arrow => Select
      map      ^[[1;2A vk
      map      ^[[1;2B vj
      map      ^[[1;2D vh
      map      ^[[1;2C vl
      inoremap ^[[1;2A vk
      vnoremap ^[[1;2A k
      inoremap ^[[1;2B vj
      vnoremap ^[[1;2B j
      inoremap ^[[1;2C vl
      vnoremap ^[[1;2C l
      inoremap ^[[1;2D vh
      vnoremap ^[[1;2D h

      "Simple arrows in visual mode gets back to normal mode
      vnoremap ^[[C vl
      vnoremap ^[[D vh
      vnoremap ^[[A vk
      vnoremap ^[[B vj

      "Shift + Select + Arrow => Select fast
      map      ^[[1;6C vw
      map      ^[[1;6D vb
      map      ^[[1;6A vk
      map      ^[[1;6B vj
      inoremap ^[[1;6C vw
      inoremap ^[[1;6D vb
      inoremap ^[[1;6A vk
      inoremap ^[[1;6B vj
      vnoremap ^[[1;6C w
      vnoremap ^[[1;6D b
      vnoremap ^[[1;6A k
      vnoremap ^[[1;6B j

      "End, Home
      map      ^[[F $
      map      ^[[H 0
      inoremap ^[[F $
      inoremap ^[[H 0
      vnoremap ^[[F $
      vnoremap ^[[H 0
      "Ctrl + End, Home => Document Start, End
      map      ^[[1;5F G
      map      ^[[1;5H gg
      inoremap ^[[1;5F G
      inoremap ^[[1;5H gg
      vnoremap ^[[1;5F G
      vnoremap ^[[1;5H gg
      map      ^[[1;2F v$
      map      ^[[1;2H v0
      inoremap ^[[1;2F v$
      inoremap ^[[1;2H v0
      vnoremap ^[[1;2F $
      vnoremap ^[[1;2H 0

      "PgUp, PgDown
      map      ^[[5~ 
      map      ^[[6~ 

      " backspace in Visual mode deletes selection
      vnoremap ^? d

    if &term =~ 'xterm-256color'
        set t_Co=256
        map ^[[C w
        map ^[[D b
        imap ^[[C w
        imap ^[[D b

ZenBurn Color scheme

.cshrc, relevant parts

if ( $?tcsh ) then
        bindkey "^W" backward-delete-word
        bindkey -k up history-search-backward
        bindkey -k down history-search-forward
        bindkey "^[[1;5D" backward-word
        bindkey "^[[1;5C" forward-word

.zshrc, relevant parts

bindkey "^[OD" backward-word
bindkey "^[OC" forward-word
bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[[3~" delete-char

.tmux.conf, relevant parts

set -g default-terminal "xterm-256color-tmuxed-zwm"
set -g terminal-overrides "xterm*:colors=256:XT:smcup@:rmcup@:kUP5=\eOA:kDN5=\eOB:kLFT5=\eOD:kRIT5=\eOC"
set-option -gw xterm-keys on

To get the full, experience, you need to SSH to your box using Futty.

Be sure to use a version with Ctrl+Shift+Keys enabled.