diff --git a/vim/7.3-cygwin-mouse.patch b/vim/7.3-cygwin-mouse.patch new file mode 100644 index 00000000..da25898d --- /dev/null +++ b/vim/7.3-cygwin-mouse.patch @@ -0,0 +1,24 @@ +FTBFS due to MOUSE_* not being defined with FEAT_SMALL + +--- origsrc/vim73/src/feature.h 2013-05-13 12:58:34.639790600 -0500 ++++ src/vim73/src/feature.h 2013-05-13 15:27:48.418748300 -0500 +@@ -1137,7 +1137,7 @@ + * in an xterm like in the GUI. + */ + +-#ifdef FEAT_CYGWIN_WIN32_CLIPBOARD ++#if defined(FEAT_CYGWIN_WIN32_CLIPBOARD) && defined(FEAT_NORMAL) + # define FEAT_CLIPBOARD + #endif + +--- origsrc/vim73/src/os_unix.c 2013-05-13 12:58:22.159511200 -0500 ++++ src/vim73/src/os_unix.c 2013-05-13 15:28:11.656077400 -0500 +@@ -1274,7 +1274,7 @@ mch_init() + #ifdef MACOS_CONVERT + mac_conv_init(); + #endif +-#ifdef FEAT_CYGWIN_WIN32_CLIPBOARD ++#if defined(FEAT_CYGWIN_WIN32_CLIPBOARD) && defined(FEAT_NORMAL) + win_clip_init(); + #endif + } diff --git a/vim/7.3-cygwin-python-dyn.patch b/vim/7.3-cygwin-python-dyn.patch new file mode 100644 index 00000000..cd8878db --- /dev/null +++ b/vim/7.3-cygwin-python-dyn.patch @@ -0,0 +1,25 @@ +This is not an issue on Cygwin as all extensions must be linked against +their respective libpython on PE platforms. + +--- origsrc/vim73/src/if_python.c 2013-05-13 12:58:43.770727000 -0500 ++++ src/vim73/src/if_python.c 2013-05-13 16:40:04.432754100 -0500 +@@ -506,7 +506,7 @@ python_runtime_link_init(char *libname, + int i; + void *ucs_as_encoded_string; + +-#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON3) ++#if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && !defined(__CYGWIN__) && defined(FEAT_PYTHON3) + /* Can't have Python and Python3 loaded at the same time. + * It cause a crash, because RTLD_GLOBAL is needed for + * standard C extension libraries of one or both python versions. */ +--- origsrc/vim73/src/if_python3.c 2013-05-13 12:58:44.176767800 -0500 ++++ src/vim73/src/if_python3.c 2013-05-13 16:40:26.651024900 -0500 +@@ -471,7 +471,7 @@ py3_runtime_link_init(char *libname, int + int i; + void *ucs_from_string, *ucs_decode, *ucs_as_encoded_string; + +-# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && defined(FEAT_PYTHON) ++# if !(defined(PY_NO_RTLD_GLOBAL) && defined(PY3_NO_RTLD_GLOBAL)) && defined(UNIX) && !defined(__CYGWIN__) && defined(FEAT_PYTHON) + /* Can't have Python and Python3 loaded at the same time. + * It cause a crash, because RTLD_GLOBAL is needed for + * standard C extension libraries of one or both python versions. */ diff --git a/vim/7.3-virc.patch b/vim/7.3-virc.patch new file mode 100644 index 00000000..88dc60fb --- /dev/null +++ b/vim/7.3-virc.patch @@ -0,0 +1,42 @@ +As vi is compiled with only FEAT_SMALL, it does not support many +options which users may have in their vimrc. + +--- origsrc/vim73/src/os_unix.h 2013-06-09 06:45:33.504200800 -0500 ++++ src/vim73/src/os_unix.h 2013-06-09 07:03:37.315191300 -0500 +@@ -241,7 +241,11 @@ typedef struct dsc$descriptor DESC; + * Unix system-dependent file names + */ + #ifndef SYS_VIMRC_FILE +-# define SYS_VIMRC_FILE "$VIM/vimrc" ++# ifdef FEAT_NORMAL ++# define SYS_VIMRC_FILE "/etc/vimrc" ++# else ++# define SYS_VIMRC_FILE "/etc/virc" ++# endif + #endif + #ifndef SYS_GVIMRC_FILE + # define SYS_GVIMRC_FILE "$VIM/gvimrc" +@@ -290,7 +294,11 @@ typedef struct dsc$descriptor DESC; + # ifdef VMS + # define USR_VIMRC_FILE "sys$login:.vimrc" + # else ++# ifdef FEAT_NORMAL + # define USR_VIMRC_FILE "$HOME/.vimrc" ++# else ++# define USR_VIMRC_FILE "$HOME/.virc" ++# endif + # endif + #endif + +@@ -340,7 +348,11 @@ typedef struct dsc$descriptor DESC; + #endif + + #ifndef VIMRC_FILE ++# ifdef FEAT_NORMAL + # define VIMRC_FILE ".vimrc" ++# else ++# define VIMRC_FILE ".virc" ++# endif + #endif + + #ifdef FEAT_GUI diff --git a/vim/PKGBUILD b/vim/PKGBUILD new file mode 100644 index 00000000..2d7b31c8 --- /dev/null +++ b/vim/PKGBUILD @@ -0,0 +1,153 @@ +# Maintainer: Alexey Pavlov + +pkgname=vim +_topver=7.4 +_patchlevel=069 +__hgrev=e6c00dbedde1 +_versiondir="${pkgname}${_topver//./}" +pkgver=${_topver}.${_patchlevel} +pkgrel=1 +arch=('i686' 'x86_64') +license=('custom:vim') +url="http://www.vim.org" +depends=('ncurses') +makedepends=('gawk' 'perl' 'python2' 'python3' 'ruby' 'mercurial' 'iconv') +source=("${pkgname}-${pkgver}"::"hg+http://vim.googlecode.com/hg/vim#tag=v${pkgver//./-}" + #"ftp://ftp.archlinux.org/other/vim/${pkgname}-${pkgver}.tar.xz" + #"ftp://ftp.archlinux.org/other/vim/${pkgname}-${pkgver}.tar.xz.sig" + 'dot.vimrc' + 7.3-cygwin-mouse.patch + 7.3-virc.patch + 7.3-cygwin-python-dyn.patch + 'vim-completion') +md5sums=('SKIP' + 'b18bd005832117243727e9fef1b45691' + '82e8c2ae0821d3a453c808e98916c4b8' + 'e776f485d8f027050ff040120acb8a86' + '88ab80d81af8e88cf80d21b2796ec94d' + '87fe7821e180647f3bf48ed099a22b83') + +prepare() { + cd ${srcdir}/${pkgname}-${pkgver} + + iconv -f ISO-8859-1 -t UTF-8 runtime/doc/eval.txt \ + > runtime/doc/eval.tmp && mv -f runtime/doc/eval.{tmp,txt} + + patch -p2 -i ${srcdir}/7.3-cygwin-mouse.patch + patch -p2 -i ${srcdir}/7.3-virc.patch + patch -p2 -i ${srcdir}/7.3-cygwin-python-dyn.patch + + # define the place for the global (g)vimrc file (set to /etc/vimrc) + #sed -i 's|^.*\(#define SYS_.*VIMRC_FILE.*"\) .*$|\1|' \ + # vim-build/src/feature.h + #sed -i 's|^.*\(#define VIMRC_FILE.*"\) .*$|\1|' \ + # vim-build/src/feature.h + + cd src + autoconf +} + +build() { + cd ${srcdir}/${pkgname}-${pkgver} + + # ./configure \ + # --prefix=/usr \ + # --build=${CHOST} \ + # --with-features=small \ + # --with-tlib=ncursesw \ + # --enable-multibyte \ + # --disable-luainterp \ + # --disable-perlinterp \ + # --disable-pythoninterp \ + # --disable-python3interp \ + # --disable-rubyinterp \ + # --disable-tclinterp \ + # --disable-gpm --disable-sysmouse \ + # --disable-gui --without-x \ + # --with-compiledby="" + # make auto/osdef.h + # make VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/vim${slot/\.} || die "make 2 fail" + # mv vim.exe vi.exe + # make distclean + + ./configure \ + --prefix=/usr \ + --build=${CHOST} \ + --with-features=huge \ + --with-tlib=ncursesw \ + --enable-cscope \ + --enable-multibyte \ + --enable-luainterp=dynamic \ + --enable-perlinterp=dynamic \ + --enable-pythoninterp=dynamic \ + --enable-python3interp=dynamic \ + --enable-rubyinterp=dynamic \ + --disable-tclinterp \ + --disable-gpm --disable-sysmouse \ + --disable-gui --without-x \ + CPPFLAGS="${CPPFLAGS} -I/usr/include/ncursesw" \ + --with-compiledby="" + + #make auto/osdef.h + make VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/vim${_topver/\.} +} + +check() { + # disable tests because they seem to freeze + + cd "${srcdir}"/${pkgname}-${pkgver} + + #make test +} + +package() { + cd "${srcdir}"/${pkgname}-${pkgver} + make -j1 VIMRCLOC=/etc DESTDIR="${pkgdir}" install + + make install -j1 \ + VIMRCLOC=/etc VIMRUNTIMEDIR=/usr/share/vim/vim${_topver/\.} \ + STRIP=: INSTALL_DATA="cp -L" INSTALL_DATA_R="cp -Lr" \ + DESTDIR="${pkgdir}" + + #for x in ex rvi vi.exe + #do + # cp -f vi.exe ${pkgdir}/usr/bin/${x} + #done + + for y in vimdiff view rview rvim + do + cp -f ${pkgdir}/usr/bin/vim.exe ${pkgdir}/usr/bin/${y} + done + + mkdir -p ${pkgdir}/usr/share/bash-completion/completions + cp -f ${srcdir}/vim-completion ${pkgdir}/usr/share/bash-completion/completions/vim + + # delete some manpages + find "${pkgdir}"/usr/share/man -type d -name 'man1' 2>/dev/null | \ + while read _mandir; do + cd ${_mandir} + rm -f ex.1 # provided by (n)vi + rm -f evim.1 # this does not make sense if we have no GUI + done + + # fix FS#17216 + sed -i 's|messages,/var|messages,/var/log/messages.log,/var|' \ + "${pkgdir}"/usr/share/vim/${_versiondir}/filetype.vim + + # patch filetype.vim for better handling of pacman related files + sed -i "s/rpmsave/pacsave/;s/rpmnew/pacnew/;s/,\*\.ebuild/\0,PKGBUILD*,*.install/" \ + "${pkgdir}"/usr/share/vim/${_versiondir}/filetype.vim + sed -i "/find the end/,+3{s/changelog_date_entry_search/changelog_date_end_entry_search/}" \ + "${pkgdir}"/usr/share/vim/${_versiondir}/ftplugin/changelog.vim + + # rc files + install -Dm644 "${srcdir}"/dot.vimrc "${pkgdir}"/usr/etc/skel/.vimrc + + # rgb.txt file + install -Dm644 "${srcdir}"/vim-${pkgver}/runtime/rgb.txt \ + "${pkgdir}"/usr/share/vim/${_versiondir}/rgb.txt + + # license + install -Dm644 "${srcdir}"/vim-${pkgver}/runtime/doc/uganda.txt \ + "${pkgdir}"/usr/share/licenses/${pkgname}/license.txt +} diff --git a/vim/dot.vimrc b/vim/dot.vimrc new file mode 100644 index 00000000..3e9b56f0 --- /dev/null +++ b/vim/dot.vimrc @@ -0,0 +1,96 @@ +" An example for a vimrc file. +" +" Maintainer: Bram Moolenaar +" Last change: 2011 Apr 15 +" +" To use it, copy it to +" for Unix and OS/2: ~/.vimrc +" for Amiga: s:.vimrc +" for MS-DOS and Win32: $VIM\_vimrc +" for OpenVMS: sys$login:.vimrc + +" When started as "evim", evim.vim will already have done these settings. +if v:progname =~? "evim" + finish +endif + +" Use Vim settings, rather than Vi settings (much better!). +" This must be first, because it changes other options as a side effect. +set nocompatible + +" allow backspacing over everything in insert mode +set backspace=indent,eol,start + +if has("vms") + set nobackup " do not keep a backup file, use versions instead +else + set backup " keep a backup file +endif +set history=50 " keep 50 lines of command line history +set ruler " show the cursor position all the time +set showcmd " display incomplete commands +set incsearch " do incremental searching + +" For Win32 GUI: remove 't' flag from 'guioptions': no tearoff menu entries +" let &guioptions = substitute(&guioptions, "t", "", "g") + +" Don't use Ex mode, use Q for formatting +map Q gq + +" CTRL-U in insert mode deletes a lot. Use CTRL-G u to first break undo, +" so that you can undo CTRL-U after inserting a line break. +inoremap u + +" In many terminal emulators the mouse works just fine, thus enable it. +if has('mouse') + set mouse=a +endif + +" Switch syntax highlighting on, when the terminal has colors +" Also switch on highlighting the last used search pattern. +if &t_Co > 2 || has("gui_running") + syntax on + set hlsearch +endif + +" Only do this part when compiled with support for autocommands. +if has("autocmd") + + " Enable file type detection. + " Use the default filetype settings, so that mail gets 'tw' set to 72, + " 'cindent' is on in C files, etc. + " Also load indent files, to automatically do language-dependent indenting. + filetype plugin indent on + + " Put these in an autocmd group, so that we can delete them easily. + augroup vimrcEx + au! + + " For all text files set 'textwidth' to 78 characters. + autocmd FileType text setlocal textwidth=78 + + " When editing a file, always jump to the last known cursor position. + " Don't do it when the position is invalid or when inside an event handler + " (happens when dropping a file on gvim). + " Also don't do it when the mark is in the first line, that is the default + " position when opening a file. + autocmd BufReadPost * + \ if line("'\"") > 1 && line("'\"") <= line("$") | + \ exe "normal! g`\"" | + \ endif + + augroup END + +else + + set autoindent " always set autoindenting on + +endif " has("autocmd") + +" Convenient command to see the difference between the current buffer and the +" file it was loaded from, thus the changes you made. +" Only define it when not defined already. +if !exists(":DiffOrig") + command DiffOrig vert new | set bt=nofile | r ++edit # | 0d_ | diffthis + \ | wincmd p | diffthis +endif diff --git a/vim/vim-completion b/vim/vim-completion new file mode 100644 index 00000000..157b5464 --- /dev/null +++ b/vim/vim-completion @@ -0,0 +1,36 @@ +# Author: Ciaran McCreesh +# +# completion for vim + +_vim() +{ + local cur prev cmd args + + COMPREPLY=() + cur=${COMP_WORDS[COMP_CWORD]} + prev=${COMP_WORDS[COMP_CWORD-1]} + cmd=${COMP_WORDS[0]} + + if [[ "${prev}" == "--servername" ]] ; then + local servers + servers=$(gvim --serverlist ) + COMPREPLY=( $( compgen -W "${servers}" -- $cur ) ) + + elif [[ "${prev}" == -[uUi] ]] ; then + COMPREPLY=( $( compgen -W "NONE" ) \ + $( compgen -f -X "!*vim*" -- "$cur" ) ) + + elif [[ "${cur}" == -* ]] ; then + args='-t -q -c -S --cmd -A -b -C -d -D -e -E -f --nofork \ + -F -g -h -H -i -L -l -m -M -N -n -nb -o -R -r -s \ + -T -u -U -V -v -w -W -x -X -y -Y -Z --echo-wid \ + --help --literal --noplugin --version' + COMPREPLY=( $( compgen -W "${args}" -- $cur ) ) + else + _filedir + fi +} + +complete -o filenames -F _vim vim ex view evim rvim rview + +# vim: set ft=sh sw=4 et sts=4 :