Added <Tab> and <Shift><Tab> to normal mode, doing the same thing as in

visual, :wsudo and :esudo can now be run with :sudow and :sudoe, fixed
a few issues where gvim settings wouldn't be enabled if gvim was started
using :gui in command mode, = now does what + does so you can use - and
+ without holding shift for the + part, the ctrl/shift
up/down/left/right + h/j/k/l stuff now works the same for both using the
behaviour I suspect most people will expect from them, a 'lot' of
behaviour that didn't work in tmux should now work provided tmux is
using xterm-keys and has its $TERM set to screen*, a bunch of new
default settings have been added to settings.vim (though they're mostly
subtle or behind the scenes tweaks) and it's commented and organized
better now too, and the gvim menubar no longer appears by default (but
you can toggle it with <Ctrl><F1>)
This commit is contained in:
Kevin 2014-03-28 07:36:19 -04:00
parent 62596daf72
commit 2ee0a576e3
5 changed files with 105 additions and 67 deletions

@ -1 +1 @@
Subproject commit 750f7286c10e42cab2663a4a1bc38ae13b105a34
Subproject commit 6515e65b9ef467d0ce542e5515a5f39aa36ae963

@ -1 +1 @@
Subproject commit 0511be8ac531bd8a934d31849e1a3e47139f0560
Subproject commit 5916ad27fa2cc34bf5ab79175715a42e4c7bb4eb

@ -1 +1 @@
Subproject commit 5b5bee9c44f5d24dc7499b92efd5ed8eac305f04
Subproject commit 099b9181413b81deb49e87d6c787d6cfe8b43ea5

View file

@ -1,4 +1,4 @@
"==========================="
" Keyboard Configuration: "
"==========================="
"
@ -11,14 +11,17 @@
" ds" | (N) -> delete surrounding ""
"
" Mappings:
" = | (N) -> move to the first character on the next line
" <Ctrl-ScrollUp> | (A) -> scroll right
" <Ctrl-ScrollDown> | (A) -> scroll left
" <Shift-MiddleClick> | (A) -> unbind this from vim so xorg can paste
" <Ctrl-t> | (A) -> open a new tab
" <Ctrl-n> | (A) -> go to the next open tab
" <Ctrl-p> | (A) -> go to the previous open tab
" <Tab> | (V) -> indent a block in visual mode
" <Shift-Tab> | (V) -> unindent a block in visual mode
" <Tab> | (V) -> indent all the lines currently selected
" <Tab> | (N) -> indent the current line
" <Shift-Tab> | (V) -> unindent all the lines currently selected
" <Shift-Tab> | (N) -> unindent the current line
" \\ | (N) -> show spelling suggestions popup for selection
" ` | (N) -> toggle the nerdtree sidebar
" ~ | (N) -> toggle the tagbar sidebar
@ -55,19 +58,22 @@
" <Leader><Backspace> | (N) -> undo the most recent match selection
"
" GVim Mappings:
" <Ctrl-F1> | (A) -> toggle the menu
" <Ctrl-F2> | (A) -> toggle the toolbar
" <Ctrl-F3> | (A) -> toggle the scrollbar
" <Ctrl-F1> | (A) -> toggle the menu
" <Ctrl-F2> | (A) -> toggle the toolbar
" <Ctrl-F3> | (A) -> toggle the scrollbar
"
" Aliases:
" :wsudo | (N) -> :SudoWrite (write the file as root using sudo)
" :esudo | (N) -> :SudoRead (read a file as root using sudo)
" :wsudo & :sudow | (N) -> :SudoWrite (write the file as root using sudo)
" :esudo & :sudoe | (N) -> :SudoRead (read a file as root using sudo)
"
" Notes:
" *by the default <Leader> key is: \
"
"MAPPINGS: GENERAL KEYBINDINGS AND REBINDINGS {{{
"map = to + so shift doesn't need to be held to use its functionality
nnoremap = +
"hold shift to enable middle-click paste
noremap <S-Insert> <MiddleMouse>
noremap! <S-Insert> <MiddleMouse>
@ -79,6 +85,8 @@
"tab and untabbing selected blocks
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
nnoremap <Tab> v>gv<Esc>
nnoremap <S-Tab> v<gv<Esc>
"press backslash twice on a mispelled word for suggestions
nnoremap \\ ea<C-X><C-S>
@ -98,15 +106,9 @@
vnoremap <silent><expr> <F1> '<Esc>:set number!<CR>v'
"toggle line wrapping (and bottom bar if using the gui)
if !has("gui_running")
nnoremap <silent><expr> <F2> ':set wrap!<CR>'
inoremap <silent><expr> <F2> '<Esc>:set wrap!<CR>'
vnoremap <silent><expr> <F2> '<Esc>:set wrap!<CR>'
else
nnoremap <silent><expr> <F2> ':set wrap! go'.'-+'[&wrap]."=b\r"
inoremap <silent><expr> <F2> '<Esc>:set wrap! go'.'-+'[&wrap]."=b\ra"
vnoremap <silent><expr> <F2> '<Esc>:set wrap! go'.'-+'[&wrap]."=b\rv"
endif
nnoremap <silent><expr> <F2> ':set wrap! go'.'-+'[&wrap]."=b\r"
inoremap <silent><expr> <F2> '<Esc>:set wrap! go'.'-+'[&wrap]."=b\ra"
vnoremap <silent><expr> <F2> '<Esc>:set wrap! go'.'-+'[&wrap]."=b\rv"
"toggle the cursor line and column
nnoremap <silent><expr> <F3> ':set cursorline! cursorcolumn!<CR>'
@ -131,25 +133,25 @@
nnoremap <silent><expr> <Leader><C-w> ':FixWhitespace<CR>'
"remap keys to scroll through text
nnoremap <C-Up> gg
nnoremap <C-Up> gg0
nnoremap <C-k> gg0
nnoremap <C-Down> G
nnoremap <C-Down> G$
nnoremap <C-j> G$
nnoremap <C-Right> $
nnoremap <C-l> $
nnoremap <C-Left> ^
nnoremap <C-h> 0
nnoremap <C-h> ^
"map remap keys to select text
nnoremap <C-a> gg0vG$
nnoremap <S-Up> vgg
nnoremap <S-Up> vgg0
nnoremap <S-k> vgg0
nnoremap <S-Down> vG
nnoremap <S-Down> vG$
nnoremap <S-j> vG$
nnoremap <S-Right> v$
nnoremap <S-l> v$
nnoremap <S-Left> v^
nnoremap <S-h> v0
nnoremap <S-h> v^
"}}}
"PLUGIN KEYBINDINGS {{{
@ -175,16 +177,44 @@
nmap <Esc>OF <End>
imap <Esc>OF <End>
endif
"tmux will send xterm-style keys when xterm-keys is on
if &term =~ '^screen' && exists('$TMUX')
execute "set <xUp>=\e[1;*A"
execute "set <xDown>=\e[1;*B"
execute "set <xRight>=\e[1;*C"
execute "set <xLeft>=\e[1;*D"
execute "set <xHome>=\e[1;*H"
execute "set <xEnd>=\e[1;*F"
execute "set <Insert>=\e[2;*~"
execute "set <Delete>=\e[3;*~"
execute "set <PageUp>=\e[5;*~"
execute "set <PageDown>=\e[6;*~"
execute "set <xF1>=\e[1;*P"
execute "set <xF2>=\e[1;*Q"
execute "set <xF3>=\e[1;*R"
execute "set <xF4>=\e[1;*S"
execute "set <F5>=\e[15;*~"
execute "set <F6>=\e[17;*~"
execute "set <F7>=\e[18;*~"
execute "set <F8>=\e[19;*~"
execute "set <F9>=\e[20;*~"
execute "set <F10>=\e[21;*~"
execute "set <F11>=\e[23;*~"
execute "set <F12>=\e[24;*~"
endif
"}}}
"GVIM: MAPPINGS FOR GUI ELEMENTS {{{
"map toggles for the menu, toolbar and scrollbar
"map toggles for the menu, toolbar and vertical scrollbar
noremap <silent><expr> <C-F1> ":if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>"
noremap <silent><expr> <C-F2> ":if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>"
noremap <silent><expr> <C-F3> ":if &go=~#'r'<Bar>set go-=r<Bar>else<Bar>set go+=r<Bar>endif<CR>"
"}}}
"ALIASES: COMMAND SHORTCUTS {{{
cabbrev sudow SudoWrite
cabbrev wsudo SudoWrite
cabbrev sudoe SudoRead
cabbrev esudo SudoRead
"}}}

View file

@ -3,18 +3,58 @@
"==============================="
"COMPATIBILITY SETTINGS: DOCUMENT AND ENVIRONMENT SETTINGS {{{
set nocompatible "enable vim specific capabilities"
set lazyredraw "only redraw what needs to be redrawn"
set encoding=utf-8 "set encoding"
set fileformats=unix,dos,mac "set compatible line endings in order of preference"
set nocompatible "enable vim specific capabilities
set hidden "tells vim to track things like undo history while a buffer is in the background
set encoding=utf-8 "set encoding
set fileformats=unix,dos,mac "set compatible line endings in order of preference
set backspace=indent,eol,start "enables backspacing
set mouse=a "enables extended mouse capabilities
set clipboard=unnamedplus "enable copy/paste support between vim and the environment's clipboard
set lazyredraw "only redraw what needs to be redrawn
set ttyfast "assume a fast connection to the terminal for better rendering
if $TERM =~ '^linux'
set t_Co=8 "use 8 colours when a vterm is detected
elseif !has("gui_running")
set t_Co=256 "assume 256 colours when any other terminal is detected
set ttymouse=xterm2 "sets the type of mouse to one we can expect in most gui envs
endif
"}}}
"GENERAL: ANYTHING THAT DOESN'T FIT ELSEWHERE {{{
set number "enable line numbers
set nowrap "disable line wrapping
set cursorline cursorcolumn "enable row/column highlighting
set visualbell "notify visually instead of with an audible bell
set splitright "add new tiles on the right (and not left) when added
set scrolloff=1 sidescrolloff=1 "start scrolling if the cursor is one position away from the edge
set list listchars=tab:>-,trail:- "display tabs as >--- and trailing spaces as -
set autochdir "current dir is file dir
set history=250 "undo history
set whichwrap=b,s,<,>,[,] "allow the cursor to wrap lines
set textwidth=0 "set an unlimited text width before breaking the line when line breaks are enabled
set nolinebreak "disable linebreaks, though this will be overridden by filetype plugins
set showmatch "show matching open bracket when closed bracket is inserted
set matchtime=5 "the amount of time the matching bracket will highlight
set smarttab expandtab autoindent tabstop=4 shiftwidth=4 "configure tabs
set laststatus=2 showcmd statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] "statusline init and config
set hlsearch incsearch ignorecase smartcase "configure search
"load the system version of matchit if another hasn't already been
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
"enable tab completion in command mode and configure how it handles extensions
set completeopt=longest,menuone
set wildmenu
set wildmode=list:longest,full
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,*.jpg,*.gif,*.png
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
"}}}
"SYNTAX: INDENTING, HIGHLIGHTING, FOLDING {{{
filetype plugin indent on
syntax on "turn syntax highlighting on
@ -33,47 +73,15 @@
au BufNewFile,BufRead ircd.conf setf javascript "set syntax for *ircd.conf to javascript
"}}}
"GENERAL: ANYTHING THAT DOESN'T FIT ELSEWHERE {{{
set cursorline cursorcolumn "enable row/column highlighting
set splitright "add new tiles on the right (and not left) when added
set scrolloff=1 sidescrolloff=1 "how many vertical and horizontal characters left before scrolling
set number "enable line numbers
set list listchars=tab:>-,trail:- "display whitespace
set nowrap "disable line wrapping
set autochdir "current dir is file dir
set backspace=indent,eol,start "enables backspacing
set history=75 "undo history
set mouse=a "enables mouse
set whichwrap=b,s,<,>,[,] "allow the cursor to wrap lines
set clipboard=unnamedplus "enable copy/paste support between vim and xorg's middle-click style clipboard
set textwidth=0 "the default width text will go before breaking when line breaks are enabled
set nolinebreak "disable linebreaks, though this will be overridden by filetype plugins
set showmatch "show matching open bracket when closed bracket is inserted
set matchtime=5 "the amount of time the matching bracket will highlight
set smarttab expandtab autoindent tabstop=4 shiftwidth=4 "configure tabs
set laststatus=2 showcmd statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v] "statusline init and config
set hlsearch incsearch ignorecase smartcase "configure search
"GVIM: GUI CONFIG OPTIONS {{{
set guicursor+=a:blinkon0 "disable the blinking cursor
"load the system version of matchit if another hasn't already been
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
"enable menu tab completion, configure its behaviour and set configure suffixes to reduce priority for and ignore"
set completeopt=longest,menuone
set wildmenu
set wildmode=list:longest,full
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,*.jpg,*.gif,*.png
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
"}}}
"GVIM: GUI CONFIG OPTIONS {{{
set guioptions-=T "remove the toolbar
set guioptions-=m "remove the toolbar
if &wrap
set go-=b "disable the bottom scrollbar iff text wrapping is enabled
set go-=b "disable the bottom scrollbar on launch iff text wrapping is enabled
else
set go+=b "enable the bottom scrollbar iff text wrapping is disabled
set go+=b "enable the bottom scrollbar on launch iff text wrapping is disabled
endif
"}}}