vc: how I replaced Cursor with Vim and Claude Code

  • vim
  • claude-code
  • tooling
on this page
  1. What it’s made of
  2. The layout
  3. Keyboard first
  4. Small things that help
  5. The config

I’ve used Vim every day for more than 20 years. When AI coding assistants took off I switched to Cursor like a lot of people, and I never settled in. It felt slow and I kept running into its limits. Worse, it kept pulling me toward the mouse, after two decades of Vim muscle memory built around the keyboard.

So I built my own setup and called it vc. It’s a shell alias that opens Vim with a file tree on the left, my code in the middle and Claude Code on the right. It opens as fast as Vim does, and I can drive all of it without touching the mouse. Switching was the right call.

┌─ 1 main.go  4 util.go  5 README.md + ─────────────────────────────┐
│ tree     │ editor                         │ Claude Code           │
│          │                                │                       │
│          │                                │                       │
│          │                                │ 5h ██░░░ 24% · 7d ███ │
└──────────┴────────────────────────────────┴───────────────────────┘

What it’s made of

Nothing exotic. Vim 9.1 built with +terminal, vim-plug and the nord colorscheme, plus two plugins: vim-claude-code, which runs the claude CLI in a Vim terminal split, and NERDTree for the file tree. Claude Code runs on my claude.ai subscription. The rest is my usual desktop, Debian with i3, Alacritty and tmux.

The layout

vc on its own opens an empty editor, and vc some/file opens that file. Either way I get three panels. The NERDTree file tree sits on the left. The editor in the middle has line numbers and a tab bar across the top listing my open files, with a + next to anything unsaved. Claude Code takes the right quarter of the screen.

The side panels stay where they are. If I close the tree or Claude by mistake, they reopen straight away with the same folders expanded and the same conversation. Closing my last file exits everything, although Vim still stops me if a file has unsaved changes.

Keyboard first

Keeping my hands on the keyboard was the whole point, so most of the work went into the shortcuts:

Key Action
vc [file] Open the layout
Alt+Left / Alt+Right Move between tree, editor and Claude, in any mode (insert mode included)
Ctrl-W Close the current file; the window stays and shows the previous one
Ctrl-T New empty file
:b N Jump to file N in the tab bar
\c + e / f / r / t / R Ask Claude to explain, fix, refactor, write tests for, or review the code (works on a visual selection)
\cC Continue the last Claude session
o, s, m, I in the tree Open, open in a split, file menu, show hidden files

Ctrl-W and Ctrl-T behave like closing and opening browser tabs, and both ask before throwing away unsaved work. My i3 config used Alt+arrows to switch between desktop windows, so I moved that to Ctrl+arrows and gave Alt to Vim.

The mouse works as well: I can click into a panel, scroll, double-click a file in the tree or drag a border. It’s there if I want it, but the keyboard is still quicker.

Small things that help

Panels I’m not working in get grey text, so I can tell at a glance where the cursor is.

The bottom of every Claude session shows my claude.ai usage, the 5-hour and the 7-day limits, as bars that go from green through yellow and orange to red as they fill up:

5h ██░░░░░░░░ 24% (16:03) · 7d ███████░░░ 72% (Sat 00:28)

The line shrinks to fit the space it has. In the narrow vc panel it drops the reset times and uses shorter bars: 5h █░░░░ 24% · 7d ███░░ 72%. One catch is that Claude Code only sends usage numbers after its first reply in a session, so a fresh session says usage limits: after first reply until then.

The config

~/.zshrc

alias vc="vim -c VcLayout"

~/.config/i3/config (excerpt)

Ctrl+arrows now handle left/right focus in i3, which leaves Alt+arrows free for Vim:

bindsym Ctrl+Left focus left
bindsym Ctrl+Right focus right

~/.claude/settings.json (excerpt)

"statusLine": {
  "type": "command",
  "command": "/home/<you>/.claude/statusline-usage.sh"
}

~/.vimrc

This is everything vc needs, added after my usual base settings. Plain vim doesn’t change: the layout and its keys only kick in through :VcLayout.

call plug#begin()
Plug 'arcticicestudio/nord-vim'
Plug 'rishi-opensource/vim-claude-code', { 'tag': 'v1.4.1' }
Plug 'preservim/nerdtree', { 'tag': '7.1.3' }
call plug#end()

" Claude panel width: 25% of the screen (plugin default 0.4)
let g:claude_code_split_ratio = 0.25

colorscheme nord


" Alt+Left / Alt+Right: move between the editor and the Claude panel.
" (i3 focus left/right moved to Ctrl+arrows to free these.) Alacritty/tmux send
" xterm sequences Vim doesn't always decode as <M-Left>, so register them as
" spare function keys too.
if !has('gui_running')
  execute "set <F35>=\e[1;3D"
  execute "set <F36>=\e[1;3C"
endif
for s:k in ['<M-Left>', '<F35>']
  execute 'nnoremap <silent> ' . s:k . ' <C-w>h'
  execute 'tnoremap <silent> ' . s:k . ' <C-w>h'
  execute 'inoremap <silent> ' . s:k . ' <Esc><C-w>h'
endfor
for s:k in ['<M-Right>', '<F36>']
  execute 'nnoremap <silent> ' . s:k . ' <C-w>l'
  execute 'tnoremap <silent> ' . s:k . ' <C-w>l'
  execute 'inoremap <silent> ' . s:k . ' <Esc><C-w>l'
endfor

" When the last editor window closes, close the side panels (Claude, file tree)
" too, and so Vim. :quit! ends the Claude job; Vim still stops on unsaved hidden
" buffers. Each :quit! fires WinClosed again, so remaining panels close in turn.
function! s:IsSidePanel(winnr) abort
  let l:buf = winbufnr(a:winnr)
  return !empty(getbufvar(l:buf, 'claude_code_instance'))
        \ || getbufvar(l:buf, '&filetype') ==# 'nerdtree'
endfunction
function! s:OnWinClosed(...) abort
  let l:wins = range(1, winnr('$'))
  if empty(filter(l:wins, '!s:IsSidePanel(v:val)'))
    quit!
  elseif get(g:, 'vc_layout', 0)
    call s:RestorePanels()
  endif
endfunction
augroup claude_autoquit
  autocmd!
  " Deferred: closing windows isn't allowed inside WinClosed itself.
  autocmd WinClosed * call timer_start(0, function('s:OnWinClosed'))
augroup END

" Buffer tabs at the top (enabled by :VcLayout). Lists file buffers only, so
" the Claude terminal and file tree are skipped; buffers in a window are lit.
function! BufTabline() abort
  let l:shown = tabpagebuflist()
  let l:s = '%<'
  for l:b in range(1, bufnr('$'))
    if !buflisted(l:b) || !empty(getbufvar(l:b, '&buftype'))
      continue
    endif
    let l:name = empty(bufname(l:b)) ? '[No Name]' : fnamemodify(bufname(l:b), ':t')
    let l:s .= (index(l:shown, l:b) >= 0 ? '%#TabLineSel#' : '%#TabLine#')
          \ . ' ' . l:b . ' ' . substitute(l:name, '%', '%%', 'g')
          \ . (getbufvar(l:b, '&modified') ? ' +' : '') . ' '
  endfor
  return l:s . '%#TabLineFill#'
endfunction

" Buffer commands for `vc` (Ctrl-W close, Ctrl-T new). From a side panel they
" act on the editor window. Closing keeps the window open (switching it to
" another file buffer or an empty one), so it doesn't trigger the auto-quit.
function! s:GoToEditor() abort
  if s:IsSidePanel(winnr())
    let l:eds = filter(range(1, winnr('$')), '!s:IsSidePanel(v:val)')
    if empty(l:eds)
      return 0
    endif
    execute l:eds[0] . 'wincmd w'
  endif
  return 1
endfunction
function! s:CloseBuffer() abort
  if !s:GoToEditor() || !empty(&buftype)
    return
  endif
  let l:buf = bufnr('%')
  let l:others = filter(range(1, bufnr('$')),
        \ 'v:val != l:buf && buflisted(v:val) && empty(getbufvar(v:val, "&buftype"))')
  let l:next = index(l:others, bufnr('#')) >= 0 ? bufnr('#') : get(l:others, -1, 0)
  " :confirm asks to save unsaved changes; Cancel leaves everything as is.
  execute 'confirm ' . (l:next ? 'buffer ' . l:next : 'enew')
  if bufnr('%') != l:buf && bufexists(l:buf)
    execute 'bdelete! ' . l:buf
  endif
endfunction
function! s:NewBuffer() abort
  if s:GoToEditor()
    confirm enew
  endif
endfunction

" In `vc`, panels can't be closed: a closed tree or Claude panel reopens right
" away. NERDTree keeps its state and the plugin only hides Claude, so both come
" back as they were.
function! s:RestorePanels() abort
  let l:bufs = tabpagebuflist()
  let l:has_tree = !empty(filter(copy(l:bufs), 'getbufvar(v:val, "&filetype") ==# "nerdtree"'))
  let l:has_claude = !empty(filter(copy(l:bufs), '!empty(getbufvar(v:val, "claude_code_instance"))'))
  if l:has_tree && l:has_claude
    return
  endif
  let l:win = win_getid()
  call s:GoToEditor()
  if !l:has_tree
    NERDTreeToggle
    wincmd p
  endif
  if !l:has_claude
    Claude
    wincmd p
  endif
  call win_gotoid(l:win)
endfunction

" Mute every window but the current one (see vc_dim in :VcLayout).
function! s:SyncMute() abort
  let l:cur = win_getid()
  for l:w in range(1, winnr('$'))
    let l:want = win_getid(l:w) == l:cur ? '' : 'VcInactive'
    if getwinvar(l:w, '&wincolor') !=# l:want
      call setwinvar(l:w, '&wincolor', l:want)
    endif
  endfor
endfunction

" `vc` layout: file tree left, Claude right, line numbers and buffer tabs.
function! s:VcLayout() abort
  let g:vc_layout = 1
  " Mouse: click to focus/place the cursor, drag separators, double-click in
  " the tree, wheel to scroll. SGR works in Alacritty and tmux at any width.
  set mouse=a ttymouse=sgr
  " Let the wheel reach Claude Code (its fullscreen UI scrolls itself) instead
  " of the plugin scrolling Vim's copy of the terminal.
  let g:claude_code_scroll_keys = get(g:, 'claude_code_scroll_keys', 0)
  " Double-clicking the buffer tabs (row 1) would open a new tab page.
  nnoremap <silent> <2-LeftMouse> <Cmd>if getmousepos().screenrow > 1
        \ \| call feedkeys("\<2-LeftMouse>", 'n') \| endif<CR>
  " Mute inactive panes: grey default text (syntax and Claude's own colours
  " still show). Background stays the same as the active pane.
  highlight VcInactive ctermfg=244
  augroup vc_dim
    autocmd!
    " SafeState also catches window switches done with events ignored (NERDTree
    " opens files with eventignore=all, so WinEnter/WinLeave never fire).
    autocmd WinEnter,SafeState * call s:SyncMute()
  augroup END
  windo setlocal number
  set number showtabline=2 tabline=%!BufTabline()
  nnoremap <silent> <C-w> :call <SID>CloseBuffer()<CR>
  nnoremap <silent> <C-t> :call <SID>NewBuffer()<CR>
  " The plugin's normal-mode <C-w>z would make <C-w> wait for a second key.
  silent! nunmap <C-w>z
  NERDTree
  wincmd p
  Claude
  wincmd p
endfunction
command! VcLayout call s:VcLayout()

~/.claude/statusline-usage.sh

#!/bin/sh
# Claude Code status line (statusLine in ~/.claude/settings.json): shows the
# 5-hour and 7-day usage limits on one line, with progress bars:
#   5h ██░░░░░░░░ 24% (15:57) · 7d ████░░░░░░ 41% (Sat 12:57)
# When $COLUMNS (the terminal or `vc` Claude panel width) is too narrow, bars
# shrink to 5 cells, then reset times go, then bars, so the line never wraps.
# Reads the status line JSON on stdin: https://code.claude.com/docs/en/statusline
# `rate_limits` is only sent to claude.ai subscribers, after the first reply.

input=$(cat)
now=$(date +%s)
# Claude Code indents the status line by 2 columns; keep 1 spare.
avail=$(( ${COLUMNS:-80} - 3 ))

limit_part() { # label json-path bar-cells show-reset
  label=$1 cells=$3 show_reset=$4
  vals=$(printf '%s' "$input" | jq -r "$2 | select(.) | \"\(.used_percentage) \(.resets_at // \"\")\"" 2>/dev/null)
  [ -z "$vals" ] && return
  set -- $vals  # used_percentage [resets_at]
  pct=$(printf '%.0f' "$1") resets_at=${2:-}
  # Warmer as the limit nears 100%: green, yellow, orange, red, bold red.
  if [ "$pct" -ge 95 ]; then color='\033[1;31m'
  elif [ "$pct" -ge 85 ]; then color='\033[31m'
  elif [ "$pct" -ge 70 ]; then color='\033[38;5;208m'
  elif [ "$pct" -ge 50 ]; then color='\033[33m'
  else color='\033[32m'; fi
  bar=''
  if [ "$cells" -gt 0 ]; then
    filled=$((pct * cells / 100)); [ "$filled" -gt "$cells" ] && filled=$cells
    bar=$(printf "%${filled}s" '' | sed 's/ /█/g')$(printf "%$((cells - filled))s" '' | sed 's/ /░/g')' '
  fi
  reset=''
  if [ -n "$resets_at" ] && [ "$show_reset" -eq 1 ]; then
    if [ $((resets_at - now)) -lt 86400 ]; then reset=" ($(date -d "@$resets_at" +%H:%M))"
    else reset=" ($(date -d "@$resets_at" '+%a %H:%M'))"; fi
  fi
  printf "%s ${color}%s%s%%\033[0m%s" "$label" "$bar" "$pct" "$reset"
}

render() { # bar-cells show-reset
  five=$(limit_part 5h '.rate_limits.five_hour' "$1" "$2")
  seven=$(limit_part 7d '.rate_limits.seven_day' "$1" "$2")
  printf '%s' "$five${five:+${seven:+ · }}$seven"
}

for layout in '10 1' '5 1' '5 0' '0 0'; do
  line=$(render $layout)
  width=$(printf '%s' "$line" | sed 's/\x1b\[[0-9;]*m//g' | wc -m)
  [ "$width" -le "$avail" ] && break
done
printf '%s\n' "${line:-usage limits: after first reply}"