Mercurial > dotfiles
changeset 45:aac6188ab4d6
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.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 29 Nov 2011 18:04:16 -0800 |
parents | 263d5383be8a |
children | 0e849b8f727b |
files | .hgsub .hgsubstate vim/vimrc |
diffstat | 3 files changed, 46 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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
--- 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 <leader>ev :vsplit $MYVIMRC<cr> nnoremap <leader>sv :source $MYVIMRC<cr> -" MiniBufExplorer mappings -nnoremap <F2> :MiniBufExplorer<cr> +" MiniBufExplorer mappings. +nnoremap <F2> :TMiniBufExplorer<cr> -" Open NERDtree +" Open NERDtree. nnoremap <F3> :NERDTreeToggle<cr> -" Switch between FR and US keyboard layouts -nnoremap <leader>fr :set keymap=french<cr> -nnoremap <leader>us :set keymap=<cr> +" Switch between FR and US keyboard layouts. +nnoremap <leader>fr :setlocal keymap=french<cr> +nnoremap <leader>us :setlocal keymap=<cr> + +" Toggle spell check according to current keyboard layout. +nnoremap <leader>sp :call <SID>ToggleSpellCheck()<cr> + +" Simple way to close a buffer without closing the window. +nnoremap <leader>bd :bprevious<cr>:bdelete #<cr> " Abbreviations iabbrev @@ ludovic@chabant.com iabbrev ccopy Copyright ©2011 Ludovic Chabant, all rights reserved. iabbrev ssig --<cr>l u d o .<cr>. 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=","