From 241829126dc46462b026144b6322cb36538a8128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 10 Sep 2016 13:38:42 +0200 Subject: [PATCH 1/2] Split vim config into a seaprate Linux and cygwin parts --- .vimrc | 131 -------------------------------- .vimrc.common.epilogue | 42 ++++++++++ .vimrc.common.plugins | 19 +++++ .vimrc.common.prelude | 53 +++++++++++++ .vimrc.cygwin | 6 ++ .vimrc.cygwin.plugins | 1 + .vimrc.cygwin.settings | 10 +++ .vimrc.linux | 6 ++ .vimrc.linux.plugins | 1 + .vimrc.linux.settings | 3 + common/configure_fresh_system | 2 +- windows_cygwin/build_insider.sh | 1 + 12 files changed, 143 insertions(+), 132 deletions(-) delete mode 100755 .vimrc create mode 100644 .vimrc.common.epilogue create mode 100644 .vimrc.common.plugins create mode 100644 .vimrc.common.prelude create mode 100755 .vimrc.cygwin create mode 100644 .vimrc.cygwin.plugins create mode 100644 .vimrc.cygwin.settings create mode 100755 .vimrc.linux create mode 100644 .vimrc.linux.plugins create mode 100644 .vimrc.linux.settings diff --git a/.vimrc b/.vimrc deleted file mode 100755 index 6046b727..00000000 --- a/.vimrc +++ /dev/null @@ -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 p :set paste! -nmap h :set hlsearch! -nmap t :wa :Make test - -" navigate buffers by ctrl-b -nmap :bprevious - -" YCM -nnoremap g :YcmCompleter GoTo - -nnoremap ; : - -" no cheating ! -map -map -map -map - -" for damaged keyboards -map -imap - -" special chars -nmap l :set list! -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 -"" : close popup and save indent. -inoremap =my_cr_function() -function! s:my_cr_function() - return (pumvisible() ? "\" : "" ) . "\" -endfunction -"" : completion. -inoremap pumvisible() ? "\" : "\" - -" 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="" diff --git a/.vimrc.common.epilogue b/.vimrc.common.epilogue new file mode 100644 index 00000000..964640cf --- /dev/null +++ b/.vimrc.common.epilogue @@ -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="" diff --git a/.vimrc.common.plugins b/.vimrc.common.plugins new file mode 100644 index 00000000..fdc1e14a --- /dev/null +++ b/.vimrc.common.plugins @@ -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' diff --git a/.vimrc.common.prelude b/.vimrc.common.prelude new file mode 100644 index 00000000..84792bc2 --- /dev/null +++ b/.vimrc.common.prelude @@ -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 p :set paste! +nmap h :set hlsearch! +nmap t :wa :Make test + +" navigate buffers by ctrl-b +nmap :bprevious + +nnoremap ; : + +" no cheating ! +map +map +map +map + +" for damaged keyboards +map +imap + +" special chars +nmap l :set list! +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() diff --git a/.vimrc.cygwin b/.vimrc.cygwin new file mode 100755 index 00000000..18efa097 --- /dev/null +++ b/.vimrc.cygwin @@ -0,0 +1,6 @@ +source .vimrc.cygwin.prelude +source .vimrc.common.plugins +source .vimrc.cygwin.plugins +source .vimrc.common.epilogue +source .vimrc.cygwin.settings + diff --git a/.vimrc.cygwin.plugins b/.vimrc.cygwin.plugins new file mode 100644 index 00000000..a3f2e027 --- /dev/null +++ b/.vimrc.cygwin.plugins @@ -0,0 +1 @@ +Plugin 'Shougo/neocomplete.vim' diff --git a/.vimrc.cygwin.settings b/.vimrc.cygwin.settings new file mode 100644 index 00000000..a478e5b0 --- /dev/null +++ b/.vimrc.cygwin.settings @@ -0,0 +1,10 @@ +" plugins: neocomplete +let g:neocomplete#enable_at_startup = 1 +let g:neocomplete#enable_smart_case = 1 +"" : close popup and save indent. +inoremap =my_cr_function() +function! s:my_cr_function() + return (pumvisible() ? "\" : "" ) . "\" +endfunction +"" : completion. +inoremap pumvisible() ? "\" : "\" diff --git a/.vimrc.linux b/.vimrc.linux new file mode 100755 index 00000000..5027e176 --- /dev/null +++ b/.vimrc.linux @@ -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 + diff --git a/.vimrc.linux.plugins b/.vimrc.linux.plugins new file mode 100644 index 00000000..145eaf9b --- /dev/null +++ b/.vimrc.linux.plugins @@ -0,0 +1 @@ +Plugin 'Valloric/YouCompleteMe' diff --git a/.vimrc.linux.settings b/.vimrc.linux.settings new file mode 100644 index 00000000..189ebdcc --- /dev/null +++ b/.vimrc.linux.settings @@ -0,0 +1,3 @@ +" YCM +nnoremap g :YcmCompleter GoTo + diff --git a/common/configure_fresh_system b/common/configure_fresh_system index 9b13c143..3ae0760d 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -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" ~/. diff --git a/windows_cygwin/build_insider.sh b/windows_cygwin/build_insider.sh index f1c25446..de6c738c 100755 --- a/windows_cygwin/build_insider.sh +++ b/windows_cygwin/build_insider.sh @@ -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 From c3939c56c952be729dc93ce262165555fab015bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Sat, 10 Sep 2016 15:19:33 +0200 Subject: [PATCH 2/2] rebuild YCM on Linux but not under cygwin --- common/configure_fresh_system | 4 ++++ windows_cygwin/build_insider.sh | 1 + 2 files changed, 5 insertions(+) diff --git a/common/configure_fresh_system b/common/configure_fresh_system index 3ae0760d..51055965 100755 --- a/common/configure_fresh_system +++ b/common/configure_fresh_system @@ -106,6 +106,10 @@ fi if [[ -z $NOVIM ]]; then echo "\n" | vim +PluginInstall +qa + if [[ -z $NOYCM ]]; then + cd ~/.vim/bundle/YouCompleteMe + ./install.py --clang-completer --racer-completer --tern-completer + fi fi if [[ -z $NO_GO ]]; then diff --git a/windows_cygwin/build_insider.sh b/windows_cygwin/build_insider.sh index de6c738c..507496b6 100755 --- a/windows_cygwin/build_insider.sh +++ b/windows_cygwin/build_insider.sh @@ -15,6 +15,7 @@ export NORUST=true export NORUBY=true export NO_GO=true export DIR=$DOTFILES_PATH +export NOYCM=true curl https://bootstrap.pypa.io/get-pip.py > /tmp/get-pip.py python /tmp/get-pip.py