index edit log

opening switching files in vim

Opening and switching between buffers/ files is very related. Often you want to edit a file and don't care about whether you've previously opened it. There are many ways to help with it

related tips

auto-create-directories-before-writing

using vim only tools

typing ctrl-o: open last file (after restarting vim)
:e/n **/*foo.txt<c-d> or <tab> to find a file

:enew|r!find<cr> then gf/gF on a file

" this is very useful, because typing some characters and <tab> expanding is enough:
set wildcharm=<tab>
map lhs :b<space><tab>

tab like solutions:

using additional plugins

The_NERD_tree is popular, because it has a tree view.

using your own implementation

Is as easy as doing such:

" simple glob open based on tlib's List function (similar to TCommand or fuzzy
" plugin etc)

" don't ask me why glob() from Vim is that slow .. :(
" one reason is that it doesn't follow symlinks (unless you pass -L to find)
" of course you can use Vim's glob instead ..
fun! FastGlob(glob)
  let g = '^'.a:glob.'$'
  let replace = {'': '.*','*': '[^/\\]*','.': '\.'}
  let g = substitute(g, '\(\*\*\|\*\|\.\)', '\='.string(replace).'[submatch(1)]','g')
  let cmd = 'find | grep -e '.shellescape(g)
  " let exclude = a:exclude_pattern == ''? '' : ' | grep -v -e '.shellescape(a:exclude_pattern)
  " let cmd .= exclude
  return system(cmd)
endfun
noremap \go :exec 'e '. fnameescape(tlib#input#List('s','select file', split(FastGlob(input('glob pattern, curr dir:','/*')),"\n") ))<cr>

additional tools:

most recently used files

Opening files you used recently fast:

related links

unite