From 38f2e3087d62a2ff95e45626a36975abfabbb412 Mon Sep 17 00:00:00 2001 From: Michael Campagnaro Date: Fri, 16 Nov 2012 21:52:40 -0500 Subject: [PATCH] add ability to move tab to another with vert split --- .vimrc | 60 +++++++++++++++++++++++++++++++++++++++++++++++-- setup_notes.txt | 6 +++++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/.vimrc b/.vimrc index ea1e9e5..93044df 100644 --- a/.vimrc +++ b/.vimrc @@ -19,7 +19,10 @@ map fh :CtrlP app/helpers map fl :CtrlP lib map fp :CtrlP public map fs :CtrlP app/stylesheets - +let g:ctrlp_prompt_mappings = { + \ 'AcceptSelection("e")': [''], + \ 'AcceptSelection("t")': ['', '<2-LeftMouse>'], + \ } """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " BASIC EDITING CONFIGURATION """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -107,7 +110,10 @@ imap => imap " remap semicolon -nmap . : +nmap ; : + +" suspend process +nmap z " Quickly edit/reload the vimrc file nmap ev :e $MYVIMRC @@ -314,3 +320,53 @@ function! RunTests(filename) end end endfunction + + +" From http://vim.wikia.com/wiki/Move_current_window_between_tabs +" Moves a window from one tab to another. +function MoveToPrevTab() + "there is only one window + if tabpagenr('$') == 1 && winnr('$') == 1 + return + endif + "preparing new window + let l:tab_nr = tabpagenr('$') + let l:cur_buf = bufnr('%') + if tabpagenr() != 1 + close! + if l:tab_nr == tabpagenr('$') + tabprev + endif + sp + else + close! + exe "0tabnew" + endif + "opening current buffer in new window + exe "b".l:cur_buf +endfunc + +function MoveToNextTab() + "there is only one window + if tabpagenr('$') == 1 && winnr('$') == 1 + return + endif + "preparing new window + let l:tab_nr = tabpagenr('$') + let l:cur_buf = bufnr('%') + if tabpagenr() < tab_nr + close! + if l:tab_nr == tabpagenr('$') + tabnext + endif + sp + else + close! + tabnew + endif + "opening current buffer in new window + exe "b".l:cur_buf +endfunc +map :call MoveToNextTab()H +map :call MoveToPrevTab()H + diff --git a/setup_notes.txt b/setup_notes.txt index e6c3c5d..c65539c 100644 --- a/setup_notes.txt +++ b/setup_notes.txt @@ -12,3 +12,9 @@ Setting up Ruby Setup Vim --------- Map to in System Preferences -> Keyboard -> Modifier Keys. Now can leave insert mode. + +Setup Git +--------- +Vim might not work properly when writing commit messages. To fix, run: + + $ git config --global core.editor /usr/bin/vim