CtrlP

Bookmarks

CtrlP provides a bookmark feature to search in specific directories. This reduces the tagging and search time drastically.


Adding bookmark:

CtrlPBookmarkDirAdd <DIRECTORY>

After adding a directory, it prompts for a name to save the bookmark. Give relevant name.


Accessing bookmark:

CtrlPBookmarkDir

This gives a list of bookmark saved (@ ~/.cache/ctrlp). A key map will help to access easily.

e.g.: noremap <C-z> :CtrlPBookmarkDir<CR>


Removing Bookmark:

To remove a bookmark first open the list of bookmarks using "CtrlPBookmarkDir", then use Ctrl+z to mark/select the bookmark and F7 to delete them.


Opening files in split/tab view

Horizontal split - Ctrl+x

Vertical split - Ctrl+v

Tab - Ctrl+t


Override the default behavior (to open in split view by default):

Default:

\ 'AcceptSelection("e")': ['<cr>', '<2-LeftMouse>'],

\ 'AcceptSelection("h")': ['<c-x>', '<c-cr>', '<c-s>'],

\ 'AcceptSelection("t")': ['<c-t>'],

\ 'AcceptSelection("v")': ['<c-v>', '<RightMouse>'],


Remap:

let g:ctrlp_prompt_mappings = {

\ 'AcceptSelection("e")': ['<c-t>'],

\ 'AcceptSelection("h")': ['<cr>', '<2-LeftMouse>'],

\ }



Useful key bindings and options:


let g:ctrlp_max_files=0

let g:ctrlp_custom_ignore = 'DIR1\|DIR2\|DIR3'


noremap <C-a> :CtrlP ROOT_DIR_PATH<CR>

noremap <C-z> :CtrlPBookmarkDir<CR>

noremap <C-c> :!terminal_command %<CR>