Mercurial > dotfiles
diff vim/vimrc @ 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 | 25e8b2fffd50 |
children | ee3d235ca3fb |
line wrap: on
line diff
--- 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=","