Last active
September 11, 2021 13:33
-
-
Save evokateur/b9225a815628beed2b5f0aab343c8506 to your computer and use it in GitHub Desktop.
script with the things I do to make vim the way I like it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ] | |
then | |
mkdir -p ~/.vim/autoload ~/.vim/bundle && curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim | |
if [ ! -d ~/.vim/bundle/nerdtree ]; then | |
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree | |
fi | |
if [[ "${OSTYPE:0:4}" == "cygw" ]] | |
then | |
find ~/.vim -name *.vim -print0 | xargs -0 dos2unix | |
fi | |
touch proper.vimrc | |
echo "filetype plugin indent on" >> proper.vimrc | |
echo "syntax on" >> proper.vimrc | |
echo "set hlsearch" >> proper.vimrc | |
echo "autocmd BufRead,BufNewFile *.ejs set filetype=html" >> proper.vimrc | |
echo "autocmd BufRead,BufNewFile *.twig set filetype=html" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "set tabstop=4" >> proper.vimrc | |
echo "set softtabstop=4" >> proper.vimrc | |
echo "set shiftwidth=4" >> proper.vimrc | |
echo "set expandtab" >> proper.vimrc | |
echo "set autoindent" >> proper.vimrc | |
echo "set smarttab" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "set splitright" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "set foldmethod=indent" >> proper.vimrc | |
echo "set foldnestmax=10" >> proper.vimrc | |
echo "set nofoldenable" >> proper.vimrc | |
echo "set foldlevel=1" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "set clipboard=unnamed" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "vnoremap <C-r> \"hy:%s/<C-r>h//gc<left><left><left>" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "call pathogen#infect()" >> proper.vimrc | |
echo "" >> proper.vimrc | |
echo "map <F2> :NERDTreeToggle<CR>" >> proper.vimrc | |
echo "map <F3> :noh<CR>" >> proper.vimrc | |
echo "map <C-N><C-N> :set invnumber<CR>" >> proper.vimrc | |
mv -i proper.vimrc ~/.vimrc | |
rm -f proper.vimrc | |
else | |
path="${0}" | |
host="${1}" | |
file_name=`basename $0` | |
echo "Uploading ${path} to ${host}.." | |
scp ${path} ${host}:. | |
if [ $? -eq 0 ] | |
then | |
echo "Running ~/.${file_name} on ${host}.." | |
ssh ${host} "./${file_name}" | |
echo "Cleaning up ~/.${file_name} on ${host}.." | |
ssh ${host} "rm -f ./${file_name}" | |
fi | |
fi |
Last revision: Will attempt to scp
and run the script on a host if given a host argument.
Your public key should be in the host's authorized_keys
For example, with this in ~/.ssh/config
Host homestead
HostName 127.0.0.1
User vagrant
Port 2222
$ ./configure-vim.sh homestead
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Last revision
.vim
files when run in Cygwin