Skip to content

Commit

Permalink
Replace Ctrl+P with fzf
Browse files Browse the repository at this point in the history
Faster.
  • Loading branch information
henrik committed Oct 30, 2017
1 parent ff22407 commit 6168386
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Expand Up @@ -122,3 +122,6 @@
[submodule "vim/bundle/vim-swift"]
path = vim/bundle/vim-swift
url = https://github.com/keith/swift.vim.git
[submodule "vim/bundle/fzf.vim"]
path = vim/bundle/fzf.vim
url = https://github.com/junegunn/fzf.vim.git
5 changes: 5 additions & 0 deletions README.markdown
Expand Up @@ -15,6 +15,11 @@ This rake task will not replace existing files, but it will replace existing sym

The dotfiles will be symlinked, e.g. `~/.bash_profile` symlinked to `~/.dotfiles/bash_profile`.

To use [fzf](https://github.com/junegunn/fzf) in Vim (or the shell), install it with:

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

Don't forget to **replace the name and email in gitconfig** if you're not Henrik :p


Expand Down
3 changes: 3 additions & 0 deletions bash_profile
Expand Up @@ -3,6 +3,9 @@
# Work environment: https://github.com/barsoom/bs
[[ -s "$HOME/.bs/profile" ]] && source "$HOME/.bs/profile"

# Fuzzy file finder used by Vim: https://github.com/junegunn/fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash

source ~/.bash/path.sh
source ~/.bash/env.sh
source ~/.bash/completion.sh
Expand Down
1 change: 1 addition & 0 deletions vim/bundle/fzf.vim
Submodule fzf.vim added at f31a29
5 changes: 3 additions & 2 deletions vim/config/mappings.vim
Expand Up @@ -72,9 +72,10 @@ vnoremap < <gv
vnoremap u <nop>
vnoremap gu u
" Because I often accidentally :W when I mean to :w.
" Used to have this mapped to ":w" because I often accidentally :W when I mean to :w.
" Disabled to see if I can learn to do better.
"command! W w
" It remains as a no-op since I will otherwise trigger fzf.vim's ":Windows" " all the time.
command! W echoerr "Use :w, not :W."

" In command mode, type %% to insert the path of the currently edited file, as a shortcut for %:h<tab>.
cmap %% <C-R>=expand("%:h") . "/" <CR>
Expand Down
12 changes: 12 additions & 0 deletions vim/config/plugins.vim
Expand Up @@ -6,8 +6,20 @@ call pathogen#infect()
call pathogen#helptags()
filetype plugin indent on

" fzf (fuzzy file finder)

" Include the basic fzf Vim functionality for the fzf.vim plugin to work.
source ~/.fzf/plugin/fzf.vim

let g:fzf_history_dir = '~/.local/share/fzf-history'

" All files, with no respect for .gitignore or wildignore. Still blazingly fast.
map <C-p> :Files<CR>
" Ctrl-P

let g:ctrlp_map = '<Nop>'

let g:ctrlp_match_window_bottom = 0
let g:ctrlp_match_window_reversed = 0
let g:ctrlp_max_height = 20
Expand Down

0 comments on commit 6168386

Please sign in to comment.