Skip to content

Instantly share code, notes, and snippets.

@i-e-b
Last active March 24, 2017 11:00
Show Gist options
  • Save i-e-b/9638225 to your computer and use it in GitHub Desktop.
Save i-e-b/9638225 to your computer and use it in GitHub Desktop.
vim configuration files for Window
" THIS rc is for VsVim under Visual Studio on Windows
set virtualedit=onemore
set selectmode=
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set backspace=indent,eol,start
" Map gi for VsVim:
" nmap gi `^i
" Using `gd` for ReSharper's Go to declaration
"nmap gd :vsc Edit.GoToDefinition<CR>
nnoremap gd :vsc ReSharper.ReSharper_GotoDeclaration<CR>
" Using `gi` for ReSharper's Go to implementation
nmap gi :vsc ReSharper.ReSharper_GotoImplementations<CR>
" `gu` for ReSharper's find usages
nmap gu :vsc ReSharper.ReSharper_FindUsages<CR>
" THIS rc file is for gVim on Windows
set virtualedit=onemore
set selectmode=
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set backspace=indent,eol,start
set noswapfile
set nobackup
set nowritebackup
set list listchars=trail:.,precedes:<,extends:>,tab:\ \
let g:racer_cmd = "W:\\Programs\\Rust\\racer\\target\\release\\racer.exe"
let $RUST_SRC_PATH="W:\\Programs\\Rust\\src\\rustc-1.4.0\\src"
execute pathogen#infect()
command! CleanLines %s/
//g
" quick windows clipboard<->buffer access:
vnoremap <C-C> "+y
map <C-V> "+gP
cmap <C-V> <C-R>+
imap <C-V> <Esc>"+gpa
" go to file in a new tab:
nnoremap gf <C-W>gf
" shift-k to show current file in little-navigtor
" the `start /min ` part prevents a console screen flash on Windows
noremap K :silent! !start /min lnav %<CR>
nnoremap <F9> :GundoToggle<CR>
set guifont=Consolas:h10:cANSI
set guioptions-=T
au BufNewFile,BufRead *.elm set filetype=haskell
au BufNewFile,BufRead *.jsm set filetype=javascript
au BufRead,BufNewFile *.ts setlocal filetype=typescript
" Set ctrl-space to trigger omni-complete:
function! Auto_complete_string()
if pumvisible()
return "\<C-n>"
else
return "\<C-x>\<C-o>\<C-r>=Auto_complete_opened()\<CR>"
end
endfunction
function! Auto_complete_opened()
if pumvisible()
return "\<Down>"
end
return ""
endfunction
inoremap <expr> <Nul> Auto_complete_string()
inoremap <expr> <C-Space> Auto_complete_string()
" End of ctrl-space
" sensible.vim - Defaults everyone can agree on
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 1.0
if exists('g:loaded_sensible') || &compatible
finish
else
let g:loaded_sensible = 1
endif
if has('autocmd')
filetype plugin indent on
endif
if has('syntax') && !exists('g:syntax_on')
syntax enable
endif
" Use :help 'option' to see the documentation for the given option.
set nu
set autoindent
set backspace=indent,eol,start
set complete-=i
set showmatch
set smarttab
set nrformats-=octal
set shiftround
set ttimeout
set ttimeoutlen=50
set incsearch
" Use <C-L> to clear the highlighting of :set hlsearch.
if maparg('<C-L>', 'n') ==# ''
nnoremap <silent> <C-L> :nohlsearch<CR><C-L>
endif
set laststatus=2
set ruler
set showcmd
set wildmenu
if !&scrolloff
set scrolloff=1
endif
if !&sidescrolloff
set sidescrolloff=5
endif
set display+=lastline
if &encoding ==# 'latin1' && has('gui_running')
set encoding=utf-8
endif
if &listchars ==# 'eol:$'
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
if !has('win32') && (&termencoding ==# 'utf-8' || &encoding ==# 'utf-8')
let &listchars = "tab:\u21e5 ,trail:\u2423,extends:\u21c9,precedes:\u21c7,nbsp:\u00b7"
endif
endif
if &shell =~# 'fish$'
set shell=/bin/bash
endif
set autoread
set fileformats+=mac
if &history < 1000
set history=1000
endif
if &tabpagemax < 50
set tabpagemax=50
endif
if !empty(&viminfo)
set viminfo^=!
endif
" Allow color schemes to do bright colors without forcing bold.
if &t_Co == 8 && $TERM !~# '^linux'
set t_Co=16
endif
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
inoremap <C-U> <C-G>u<C-U>
inoremap <c-u> <c-g>u<c-u>
inoremap <c-w> <c-g>u<c-w>
" End of sensible
if has("gui_running")
colorscheme bclear
endif
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
" Alt- , or . to move a buffer between tabs
nnoremap <A-.> :call MoveToNextTab()<CR>
nnoremap <A-,> :call MoveToPrevTab()<CR>
" vim:set ft=vim et sw=2:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment