# HG changeset patch # User Ludovic Chabant # Date 1322618656 28800 # Node ID aac6188ab4d6d1dded10646467746caccdd10469 # Parent 263d5383be8ac40eb2c21c9c8924c8d79eb58791 Added vimroom plugin (disabled by default). VIMRC not setting some GUI stuff on re-sourcing (to not screw up the window when I iterate on it). Changed some mappings. Added some function to toggle spell-checking depending on the keyboard map. diff -r 263d5383be8a -r aac6188ab4d6 .hgsub --- a/.hgsub Thu Nov 24 18:25:07 2011 -0800 +++ b/.hgsub Tue Nov 29 18:04:16 2011 -0800 @@ -10,6 +10,7 @@ vim/bundle/haml = [git]git://github.com/tpope/vim-haml.git vim/bundle/supertab = [git]https://github.com/ervandew/supertab.git vim/bundle/nerdtree = [git]https://github.com/scrooloose/nerdtree.git +vim/bundle/vimroom = [git]https://github.com/mikewest/vimroom.git lib/hg/hg-git = ssh://hg@bitbucket.org/durin42/hg-git lib/hg/onsub = ssh://hg@bitbucket.org/aragost/onsub diff -r 263d5383be8a -r aac6188ab4d6 .hgsubstate --- a/.hgsubstate Thu Nov 24 18:25:07 2011 -0800 +++ b/.hgsubstate Tue Nov 29 18:04:16 2011 -0800 @@ -11,3 +11,4 @@ cdffdd43816ddaeee858ae42da3ab6ddcfa25d19 vim/bundle/repeat 688b5d706c21fbc6b2db6499f3cfbdeb35309b5a vim/bundle/supertab 4eb2cdfccc016889acfa3b5d63e8f390a87863cf vim/bundle/surround +0db7b49ebf86924573d340729e38c18bf78b0e89 vim/bundle/vimroom diff -r 263d5383be8a -r aac6188ab4d6 vim/vimrc --- a/vim/vimrc Thu Nov 24 18:25:07 2011 -0800 +++ b/vim/vimrc Tue Nov 29 18:04:16 2011 -0800 @@ -10,6 +10,13 @@ " This must be first, because it changes other options as a side effect. set nocompatible +" Set a variable that says we already sourced this file, for those few +" settings we don't want to re-apply. +if exists('g:sourced_vimrc') + let g:resourcing_vimrc = 1 +endif +let g:sourced_vimrc = 1 + " Set some important system-dependent variables. if has("win32") || has("win64") || has("dos32") let $HOMEVIM = "vimfiles" @@ -23,12 +30,13 @@ let g:pathogen_disabled = [] call add(g:pathogen_disabled, 'command-t') call add(g:pathogen_disabled, 'lawrencium') +call add(g:pathogen_disabled, 'vimroom') " Load pathogen. call pathogen#infect() " Hide the toolbar in MacVim/gVIM, and set a nice window size. -if has("gui_running") +if has("gui_running") && !exists('g:resourcing_vimrc') set guioptions=-t set lines=50 set columns=135 @@ -134,45 +142,68 @@ endif -" Syntax highlighting +" Syntax highlighting. syntax on " Change the current directory to the home directory. -cd ~/ +if !exists('g:resourcing_vimrc') + cd ~/ +endif -" Default color scheme +" Default color scheme. colorscheme peaksea set background=dark " Enable file type detection. filetype indent plugin on -" MiniBufExplorer -" Navigate with CTRL+Tab/CTRL+Shift+Tab +" Navigate MiniBufExplorer with CTRL+Tab/CTRL+Shift+Tab. let g:miniBufExplMapCTabSwitchBufs = 1 " Custom mappings. let mapleader="," -" Edit & source the VIMRC +" Edit & source the VIMRC. nnoremap ev :vsplit $MYVIMRC nnoremap sv :source $MYVIMRC -" MiniBufExplorer mappings -nnoremap :MiniBufExplorer +" MiniBufExplorer mappings. +nnoremap :TMiniBufExplorer -" Open NERDtree +" Open NERDtree. nnoremap :NERDTreeToggle -" Switch between FR and US keyboard layouts -nnoremap fr :set keymap=french -nnoremap us :set keymap= +" Switch between FR and US keyboard layouts. +nnoremap fr :setlocal keymap=french +nnoremap us :setlocal keymap= + +" Toggle spell check according to current keyboard layout. +nnoremap sp :call ToggleSpellCheck() + +" Simple way to close a buffer without closing the window. +nnoremap bd :bprevious:bdelete # " Abbreviations iabbrev @@ ludovic@chabant.com iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. iabbrev ssig --l u d o .. 8 0 17 80 +" Functions {{{ + +function! s:ToggleSpellCheck() abort + if &spell ==? 'nospell' + if &keymap ==? 'french' + setlocal spell spelllang=fr_fr + else + setlocal spell spelllang=en_us,en_ca + endif + else + setlocal spell nospell + endif +endfunction + +" }}} + " Temporary stuff "let mapleader="," " Use , as Leader "let gmapleader=","