From 53270a0bd774aa32f6e5f07ac780539f74d352ea Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Mon, 16 Apr 2018 13:50:58 +0100 Subject: [PATCH] Add c-o to vimrc --- .vimrc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.vimrc b/.vimrc index f4b419a..354da50 100644 --- a/.vimrc +++ b/.vimrc @@ -12,6 +12,7 @@ filetype plugin indent on call pathogen#infect() call pathogen#helptags() + "Leaders {{{1 let mapleader = "," let maplocalleader = "\\" @@ -294,6 +295,20 @@ function! NewLatex() setlocal filetype=tex endfunction +" Strip the newline from the end of a string +function! Chomp(str) + return substitute(a:str, '\n$', '', '') +endfunction + +" Find a file and pass it to cmd +function! DmenuOpen(cmd) + let fname = Chomp(system("git ls-files | rofi -dmenu -i -l 20 -p " . a:cmd)) + if empty(fname) + return + endif + execute a:cmd . " " . fname +endfunction + " Commands {{{1 "gets the wp salts @@ -314,6 +329,8 @@ nnoremap :set spell! noremap noremap +nnoremap :call DmenuOpen("e") + " Make Ctrl C and Ctrl V work on system buffer " if in visual or insert mode respectively vnoremap "+y