Skip to content

Instantly share code, notes, and snippets.

@evokateur
Last active September 11, 2021 13:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save evokateur/b9225a815628beed2b5f0aab343c8506 to your computer and use it in GitHub Desktop.
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
#!/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
@evokateur
Copy link
Author

evokateur commented Sep 11, 2021

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