Split vim config into a seaprate Linux and cygwin parts

This commit is contained in:
Cyryl Płotnicki 2016-09-10 13:38:42 +02:00
parent d6e49e681f
commit 241829126d
12 changed files with 143 additions and 132 deletions

131
.vimrc
View file

@ -1,131 +0,0 @@
" global settings
set nocompatible
set noswapfile
set undofile
set undodir=$HOME/.vim/undo
set spell spelllang=en_gb
" buffers can be switched despite having changes
set hidden
" file settings
set encoding=utf-8
" key mappings
let mapleader = ","
nmap <leader>p :set paste!<CR>
nmap <leader>h :set hlsearch!<CR>
nmap <leader>t :wa <bar> :Make test<CR>
" navigate buffers by ctrl-b
nmap <C-b> :bprevious<CR>
" YCM
nnoremap <Leader>g :YcmCompleter GoTo<CR>
nnoremap ; :
" no cheating !
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" for damaged keyboards
map <F1> <Esc>
imap <F1> <Esc>
" special chars
nmap <leader>l :set list!<CR>
set listchars=tab:▸\ ,eol
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
" tabs and spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" plugins
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'https://github.com/cyplo/vim-colors-solarized.git'
Plugin 'mileszs/ack.vim'
Plugin 'scrooloose/nerdtree.git'
Plugin 'scrooloose/syntastic.git'
Plugin 'wting/rust.vim'
Plugin 'sjl/splice.vim.git'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'timonv/vim-cargo'
Plugin 'kien/ctrlp.vim'
Plugin 'will133/vim-dirdiff'
Plugin 'tpope/vim-dispatch.git'
Plugin 'tpope/vim-fugitive.git'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-cucumber'
Plugin 'airblade/vim-gitgutter.git'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'Shougo/neocomplete.vim'
call vundle#end()
filetype plugin indent on
" line ending
set fileformats=unix,dos
" colours
set t_Co=256
syntax enable
set background=dark
highlight clear SignColumn
colorscheme solarized
" plugins: neocomplete
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
"" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
endfunction
"" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" plugins: airline
let g:bufferline_echo = 0
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" plugins: rust
let g:rustfmt_autosave = 1
" plugins: ag/ack
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" appearance
set number
set relativenumber
set laststatus=2
set noshowmode
set showtabline=1 "only show tabline when more than 1 tab
" exclude quickfix from the buffers list
augroup qf
autocmd!
autocmd FileType qf set nobuflisted
augroup END
" vimdiff
set diffopt+=iwhite
set diffexpr=""

42
.vimrc.common.epilogue Normal file
View file

@ -0,0 +1,42 @@
call vundle#end()
filetype plugin indent on
" line ending
set fileformats=unix,dos
" colours
set t_Co=256
syntax enable
set background=dark
highlight clear SignColumn
colorscheme solarized
" plugins: airline
let g:bufferline_echo = 0
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
" plugins: rust
let g:rustfmt_autosave = 1
" plugins: ag/ack
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
" appearance
set number
set relativenumber
set laststatus=2
set noshowmode
set showtabline=1 "only show tabline when more than 1 tab
" exclude quickfix from the buffers list
augroup qf
autocmd!
autocmd FileType qf set nobuflisted
augroup END
" vimdiff
set diffopt+=iwhite
set diffexpr=""

19
.vimrc.common.plugins Normal file
View file

@ -0,0 +1,19 @@
Plugin 'VundleVim/Vundle.vim'
Plugin 'https://github.com/cyplo/vim-colors-solarized.git'
Plugin 'mileszs/ack.vim'
Plugin 'scrooloose/nerdtree.git'
Plugin 'scrooloose/syntastic.git'
Plugin 'wting/rust.vim'
Plugin 'sjl/splice.vim.git'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'timonv/vim-cargo'
Plugin 'kien/ctrlp.vim'
Plugin 'will133/vim-dirdiff'
Plugin 'tpope/vim-dispatch.git'
Plugin 'tpope/vim-fugitive.git'
Plugin 'tpope/vim-sensible'
Plugin 'tpope/vim-cucumber'
Plugin 'airblade/vim-gitgutter.git'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'

53
.vimrc.common.prelude Normal file
View file

@ -0,0 +1,53 @@
" global settings
set nocompatible
set noswapfile
set undofile
set undodir=$HOME/.vim/undo
set spell spelllang=en_gb
" buffers can be switched despite having changes
set hidden
" file settings
set encoding=utf-8
" key mappings
let mapleader = ","
nmap <leader>p :set paste!<CR>
nmap <leader>h :set hlsearch!<CR>
nmap <leader>t :wa <bar> :Make test<CR>
" navigate buffers by ctrl-b
nmap <C-b> :bprevious<CR>
nnoremap ; :
" no cheating !
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>
" for damaged keyboards
map <F1> <Esc>
imap <F1> <Esc>
" special chars
nmap <leader>l :set list!<CR>
set listchars=tab:▸\ ,eol:¬
highlight NonText guifg=#4a4a59
highlight SpecialKey guifg=#4a4a59
" tabs and spaces
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
" plugins
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

6
.vimrc.cygwin Executable file
View file

@ -0,0 +1,6 @@
source .vimrc.cygwin.prelude
source .vimrc.common.plugins
source .vimrc.cygwin.plugins
source .vimrc.common.epilogue
source .vimrc.cygwin.settings

1
.vimrc.cygwin.plugins Normal file
View file

@ -0,0 +1 @@
Plugin 'Shougo/neocomplete.vim'

10
.vimrc.cygwin.settings Normal file
View file

@ -0,0 +1,10 @@
" plugins: neocomplete
let g:neocomplete#enable_at_startup = 1
let g:neocomplete#enable_smart_case = 1
"" <CR>: close popup and save indent.
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
return (pumvisible() ? "\<C-y>" : "" ) . "\<CR>"
endfunction
"" <TAB>: completion.
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"

6
.vimrc.linux Executable file
View file

@ -0,0 +1,6 @@
source ~/dev/dotfiles/.vimrc.common.prelude
source ~/dev/dotfiles/.vimrc.common.plugins
source ~/dev/dotfiles/.vimrc.linux.plugins
source ~/dev/dotfiles/.vimrc.common.epilogue
source ~/dev/dotfiles/.vimrc.linux.settings

1
.vimrc.linux.plugins Normal file
View file

@ -0,0 +1 @@
Plugin 'Valloric/YouCompleteMe'

3
.vimrc.linux.settings Normal file
View file

@ -0,0 +1,3 @@
" YCM
nnoremap <Leader>g :YcmCompleter GoTo<CR>

View file

@ -32,7 +32,7 @@ git submodule update --init --recursive
#configs
ln -vfs "$DIR/.vim" ~/.
ln -vfs "$DIR/.vimrc" ~/.
ln -vfs "$DIR/.vimrc.linux" ~/.vimrc
ln -vfs "$DIR/.tmux.conf" ~/.
rm -f "~/.zshrc"
ln -vfs "$DIR/.zshrc" ~/.

View file

@ -22,4 +22,5 @@ python /tmp/get-pip.py
$DIR/common/configure_fresh_system
ln -vfs $DIR/windows_cygwin/.minttyrc $HOME/
ln -vfs $DIR/.gitconfig.cygwin $HOME/.gitconfig
ln -vfs $DIR/.vimrc.cygwin $HOME/.vimrc