aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2018-03-16 08:55:06 +0000
committerJuan J. Martinez <jjm@usebox.net>2022-05-29 22:57:27 +0100
commitb3d6bb5b58d9fd840b8bd5ac5855a0ed8b1d4693 (patch)
treeb8cde45b55da9104954ed638b1d5187f5f223b1d
downloaddotnvim-b3d6bb5b58d9fd840b8bd5ac5855a0ed8b1d4693.tar.gz
dotnvim-b3d6bb5b58d9fd840b8bd5ac5855a0ed8b1d4693.zip
Initial import
-rw-r--r--README.md3
-rw-r--r--autoload/pathogen.vim328
-rw-r--r--gvimrc16
-rw-r--r--plugin/bufkill.vim637
-rw-r--r--plugin/python_pydoc.vim196
-rw-r--r--vimrc73
6 files changed, 1253 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..dfb7771
--- /dev/null
+++ b/README.md
@@ -0,0 +1,3 @@
+# My ~/.vim
+
+
diff --git a/autoload/pathogen.vim b/autoload/pathogen.vim
new file mode 100644
index 0000000..16c21fe
--- /dev/null
+++ b/autoload/pathogen.vim
@@ -0,0 +1,328 @@
+" pathogen.vim - path option manipulation
+" Maintainer: Tim Pope <http://tpo.pe/>
+" Version: 2.2
+
+" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
+"
+" For management of individually installed plugins in ~/.vim/bundle (or
+" ~\vimfiles\bundle), adding `call pathogen#infect()` to the top of your
+" .vimrc is the only other setup necessary.
+"
+" The API is documented inline below. For maximum ease of reading,
+" :set foldmethod=marker
+
+if exists("g:loaded_pathogen") || &cp
+ finish
+endif
+let g:loaded_pathogen = 1
+
+function! s:warn(msg)
+ if &verbose
+ echohl WarningMsg
+ echomsg a:msg
+ echohl NONE
+ endif
+endfunction
+
+" Point of entry for basic default usage. Give a relative path to invoke
+" pathogen#incubate() (defaults to "bundle/{}"), or an absolute path to invoke
+" pathogen#surround(). For backwards compatibility purposes, a full path that
+" does not end in {} or * is given to pathogen#runtime_prepend_subdirectories()
+" instead.
+function! pathogen#infect(...) abort " {{{1
+ for path in a:0 ? reverse(copy(a:000)) : ['bundle/{}']
+ if path =~# '^[^\\/]\+$'
+ call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
+ call pathogen#incubate(path . '/{}')
+ elseif path =~# '^[^\\/]\+[\\/]\%({}\|\*\)$'
+ call pathogen#incubate(path)
+ elseif path =~# '[\\/]\%({}\|\*\)$'
+ call pathogen#surround(path)
+ else
+ call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
+ call pathogen#surround(path . '/{}')
+ endif
+ endfor
+ call pathogen#cycle_filetype()
+ return ''
+endfunction " }}}1
+
+" Split a path into a list.
+function! pathogen#split(path) abort " {{{1
+ if type(a:path) == type([]) | return a:path | endif
+ let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
+ return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
+endfunction " }}}1
+
+" Convert a list to a path.
+function! pathogen#join(...) abort " {{{1
+ if type(a:1) == type(1) && a:1
+ let i = 1
+ let space = ' '
+ else
+ let i = 0
+ let space = ''
+ endif
+ let path = ""
+ while i < a:0
+ if type(a:000[i]) == type([])
+ let list = a:000[i]
+ let j = 0
+ while j < len(list)
+ let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
+ let path .= ',' . escaped
+ let j += 1
+ endwhile
+ else
+ let path .= "," . a:000[i]
+ endif
+ let i += 1
+ endwhile
+ return substitute(path,'^,','','')
+endfunction " }}}1
+
+" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
+function! pathogen#legacyjoin(...) abort " {{{1
+ return call('pathogen#join',[1] + a:000)
+endfunction " }}}1
+
+" Remove duplicates from a list.
+function! pathogen#uniq(list) abort " {{{1
+ let i = 0
+ let seen = {}
+ while i < len(a:list)
+ if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
+ call remove(a:list,i)
+ elseif a:list[i] ==# ''
+ let i += 1
+ let empty = 1
+ else
+ let seen[a:list[i]] = 1
+ let i += 1
+ endif
+ endwhile
+ return a:list
+endfunction " }}}1
+
+" \ on Windows unless shellslash is set, / everywhere else.
+function! pathogen#separator() abort " {{{1
+ return !exists("+shellslash") || &shellslash ? '/' : '\'
+endfunction " }}}1
+
+" Convenience wrapper around glob() which returns a list.
+function! pathogen#glob(pattern) abort " {{{1
+ let files = split(glob(a:pattern),"\n")
+ return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
+endfunction "}}}1
+
+" Like pathogen#glob(), only limit the results to directories.
+function! pathogen#glob_directories(pattern) abort " {{{1
+ return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
+endfunction "}}}1
+
+" Turn filetype detection off and back on again if it was already enabled.
+function! pathogen#cycle_filetype() " {{{1
+ if exists('g:did_load_filetypes')
+ filetype off
+ filetype on
+ endif
+endfunction " }}}1
+
+" Check if a bundle is disabled. A bundle is considered disabled if it ends
+" in a tilde or its basename or full name is included in the list
+" g:pathogen_disabled.
+function! pathogen#is_disabled(path) " {{{1
+ if a:path =~# '\~$'
+ return 1
+ elseif !exists("g:pathogen_disabled")
+ return 0
+ endif
+ let sep = pathogen#separator()
+ let blacklist = g:pathogen_disabled
+ return index(blacklist, strpart(a:path, strridx(a:path, sep)+1)) != -1 && index(blacklist, a:path) != 1
+endfunction "}}}1
+
+" Prepend the given directory to the runtime path and append its corresponding
+" after directory. If the directory is already included, move it to the
+" outermost position. Wildcards are added as is. Ending a path in /{} causes
+" all subdirectories to be added (except those in g:pathogen_disabled).
+function! pathogen#surround(path) abort " {{{1
+ let sep = pathogen#separator()
+ let rtp = pathogen#split(&rtp)
+ if a:path =~# '[\\/]{}$'
+ let path = fnamemodify(a:path[0:-4], ':p:s?[\\/]\=$??')
+ let before = filter(pathogen#glob_directories(path.sep.'*'), '!pathogen#is_disabled(v:val)')
+ let after = filter(reverse(pathogen#glob_directories(path.sep."*".sep."after")), '!pathogen#is_disabled(v:val[0:-7])')
+ call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
+ else
+ let path = fnamemodify(a:path, ':p:s?[\\/]\=$??')
+ let before = [path]
+ let after = [path . sep . 'after']
+ call filter(rtp, 'index(before + after, v:val) == -1')
+ endif
+ let &rtp = pathogen#join(before, rtp, after)
+ return &rtp
+endfunction " }}}1
+
+" Prepend all subdirectories of path to the rtp, and append all 'after'
+" directories in those subdirectories. Deprecated.
+function! pathogen#runtime_prepend_subdirectories(path) " {{{1
+ call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#surround('.string(a:path.'/{}').')')
+ return pathogen#surround(a:path . pathogen#separator() . '{}')
+endfunction " }}}1
+
+" For each directory in the runtime path, add a second entry with the given
+" argument appended. If the argument ends in '/{}', add a separate entry for
+" each subdirectory. The default argument is 'bundle/{}', which means that
+" .vim/bundle/*, $VIM/vimfiles/bundle/*, $VIMRUNTIME/bundle/*,
+" $VIM/vim/files/bundle/*/after, and .vim/bundle/*/after will be added (on
+" UNIX).
+function! pathogen#incubate(...) abort " {{{1
+ let sep = pathogen#separator()
+ let name = a:0 ? a:1 : 'bundle/{}'
+ if "\n".s:done_bundles =~# "\\M\n".name."\n"
+ return ""
+ endif
+ let s:done_bundles .= name . "\n"
+ let list = []
+ for dir in pathogen#split(&rtp)
+ if dir =~# '\<after$'
+ if name =~# '{}$'
+ let list += filter(pathogen#glob_directories(substitute(dir,'after$',name[0:-3],'').'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
+ else
+ let list += [dir, substitute(dir, 'after$', '', '') . name . sep . 'after']
+ endif
+ else
+ if name =~# '{}$'
+ let list += [dir] + filter(pathogen#glob_directories(dir.sep.name[0:-3].'*[^~]'), '!pathogen#is_disabled(v:val)')
+ else
+ let list += [dir . sep . name, dir]
+ endif
+ endif
+ endfor
+ let &rtp = pathogen#join(pathogen#uniq(list))
+ return 1
+endfunction " }}}1
+
+" Deprecated alias for pathogen#incubate().
+function! pathogen#runtime_append_all_bundles(...) abort " {{{1
+ if a:0
+ call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#incubate('.string(a:1.'/{}').')')
+ else
+ call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#incubate()')
+ endif
+ return call('pathogen#incubate', map(copy(a:000),'v:val . "/{}"'))
+endfunction
+
+let s:done_bundles = ''
+" }}}1
+
+" Invoke :helptags on all non-$VIM doc directories in runtimepath.
+function! pathogen#helptags() abort " {{{1
+ let sep = pathogen#separator()
+ for glob in pathogen#split(&rtp)
+ for dir in split(glob(glob), "\n")
+ if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
+ helptags `=dir.'/doc'`
+ endif
+ endfor
+ endfor
+endfunction " }}}1
+
+command! -bar Helptags :call pathogen#helptags()
+
+" Execute the given command. This is basically a backdoor for --remote-expr.
+function! pathogen#execute(...) abort " {{{1
+ for command in a:000
+ execute command
+ endfor
+ return ''
+endfunction " }}}1
+
+" Like findfile(), but hardcoded to use the runtimepath.
+function! pathogen#runtime_findfile(file,count) abort "{{{1
+ let rtp = pathogen#join(1,pathogen#split(&rtp))
+ let file = findfile(a:file,rtp,a:count)
+ if file ==# ''
+ return ''
+ else
+ return fnamemodify(file,':p')
+ endif
+endfunction " }}}1
+
+" Backport of fnameescape().
+function! pathogen#fnameescape(string) abort " {{{1
+ if exists('*fnameescape')
+ return fnameescape(a:string)
+ elseif a:string ==# '-'
+ return '\-'
+ else
+ return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
+ endif
+endfunction " }}}1
+
+if exists(':Vedit')
+ finish
+endif
+
+let s:vopen_warning = 0
+
+function! s:find(count,cmd,file,lcd) " {{{1
+ let rtp = pathogen#join(1,pathogen#split(&runtimepath))
+ let file = pathogen#runtime_findfile(a:file,a:count)
+ if file ==# ''
+ return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
+ endif
+ if !s:vopen_warning
+ let s:vopen_warning = 1
+ let warning = '|echohl WarningMsg|echo "Install scriptease.vim to continue using :V'.a:cmd.'"|echohl NONE'
+ else
+ let warning = ''
+ endif
+ if a:lcd
+ let path = file[0:-strlen(a:file)-2]
+ execute 'lcd `=path`'
+ return a:cmd.' '.pathogen#fnameescape(a:file) . warning
+ else
+ return a:cmd.' '.pathogen#fnameescape(file) . warning
+ endif
+endfunction " }}}1
+
+function! s:Findcomplete(A,L,P) " {{{1
+ let sep = pathogen#separator()
+ let cheats = {
+ \'a': 'autoload',
+ \'d': 'doc',
+ \'f': 'ftplugin',
+ \'i': 'indent',
+ \'p': 'plugin',
+ \'s': 'syntax'}
+ if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
+ let request = cheats[a:A[0]].a:A[1:-1]
+ else
+ let request = a:A
+ endif
+ let pattern = substitute(request,'/\|\'.sep,'*'.sep,'g').'*'
+ let found = {}
+ for path in pathogen#split(&runtimepath)
+ let path = expand(path, ':p')
+ let matches = split(glob(path.sep.pattern),"\n")
+ call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
+ call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
+ for match in matches
+ let found[match] = 1
+ endfor
+ endfor
+ return sort(keys(found))
+endfunction " }}}1
+
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
+command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
+
+" vim:set et sw=2:
diff --git a/gvimrc b/gvimrc
new file mode 100644
index 0000000..1334eeb
--- /dev/null
+++ b/gvimrc
@@ -0,0 +1,16 @@
+" Tab headings
+set gtl=%t gtt=%F
+
+" disable guff
+set guioptions-=Tm
+set guioptions=cLrA
+
+" where I am? :)
+set cursorline
+set guifont=Inconsolata\ Medium\ 12
+
+set guicursor+=i:ver100-Cursor/iCursor
+set guicursor+=i:blinkon0
+
+highlight Cursor guifg=black guibg=orange
+
diff --git a/plugin/bufkill.vim b/plugin/bufkill.vim
new file mode 100644
index 0000000..c5771fd
--- /dev/null
+++ b/plugin/bufkill.vim
@@ -0,0 +1,637 @@
+" bufkill.vim
+" Maintainer: John Orr (john undersc0re orr yah00 c0m)
+" Version: 1.10
+" Last Change: 16 June 2011
+
+" Introduction: {{{1
+" Basic Usage:
+" When you want to unload/delete/wipe a buffer, use:
+" :bun/:bd/:bw to close the window as well (vim command), or
+" :BUN/:BD/:BW to leave the window intact (this script).
+" To move backwards/forwards through recently accessed buffers, use:
+" :BB/:BF
+" To move to the alternate buffer whilst preserving cursor column, use:
+" :BA
+" or override Ctrl-^ via g:BufKillOverrideCtrlCaret
+" Mappings are also defined.
+
+" Description:
+" This is a script to
+" a) unload, delete or wipe a buffer without closing the window it was displayed in
+" b) in its place, display the buffer most recently used in the window, prior
+" to the buffer being killed. This selection is taken from the full list of
+" buffers ever displayed in the particular window.
+" c) allow one level of undo in case you kill a buffer then change your mind
+" d) allow navigation through recently accessed buffers, without closing them.
+" e) override the standard Ctrl-^ (Ctrl-6) functionality to maintain the
+" correct cursor column position. (Enable via g:BufKillOverrideCtrlCaret)
+"
+" The inspiration for this script came from
+" a) my own frustration with vim's lack of this functionality
+" b) the description of the emacs kill-buffer command in tip #622
+" (this script basically duplicates this command I believe,
+" not sure about the undo functionality)
+" c) comments by Keith Roberts when the issue was raised in the
+" vim@vim.org mailing list.
+
+" Install Details:
+" Drop this file into your $HOME/.vim/plugin directory (unix)
+" or $HOME/vimfiles/plugin directory (Windows), etc.
+" Use the commands/mappings defined below to invoke the functionality
+" (or redefine them elsewhere to what you want), and set the
+" User Configurable Variables as desired. You should be able to make
+" any customisations to the controls in your vimrc file, such that
+" updating to new versions of this script won't affect your settings.
+
+" Credits:
+" Dimitar Dimitrov - for improvements in mappings and robustness
+" A few people who pointed out bugs I'd fixed but not made public.
+" Magnus Thor Torfason - for improvements relating to the 'confirm' setting.
+" Keith Roberts - for many hours of email discussions, ideas and suggestions
+" to try to get the details as good as possible.
+" Someone from http://www.cs.albany.edu, who described the functionality of
+" this script in tip #622.
+
+" Possible Improvements:
+" If you're particularly interested in any of these, let me know - some are
+" definitely planned to happen when time permits:
+"
+" - Provide a function to save window variables as global variables,
+" in order to have them preserved by session saving/restoring commands,
+" and then restore the globals to window variables with another function.
+"
+" - Add a mode (or duplicate to a new script) to save 'views' - where a view
+" is being at a particular place in a particular file, arrived at via
+" a buffer switch, gf or tag jump. Allow jumping back to the previous
+" view, and kill (delete, wipe) the file when jumping back past the
+" last view in that file.
+
+" Changelog:
+" 1.10 - Various fixes, eg relating to quicklists
+" 1.9 - Remove unnecessary mapping delays, and a debug message
+" 1.8 - Improved mapping handling, and robustness
+" 1.7 - Minor improvements.
+" 1.6 - Added (opt-in) Ctrl-^ override support to preserve cursor column
+" 1.5 - Improved honouring of the 'confirm' vim option.
+" 1.4 - Add buffer navigation, support for scratch buffer removal
+" 1.3 - Convert to vim 7 lists instead of string-based lists
+" 1.2 - Add column-saving support, to ensure returning to a buffer means
+" positioning the cursor not only at the right line, but also column,
+" and prompting the user when removing modified buffers
+" 1.1 - Fix handling of modified, un-named buffers
+" 1.0 - initial functionality
+"
+" Implementation Notes:
+" w:BufKillList stores the list of buffers accessed so far, in order
+" of most recent access, for each respective window.
+" w:BufKillColumnList store the list of columns the cursor was in when
+" a buffer was left. It follows that since w:BufKillList lists
+" all buffers ever entered, but w:BufKillColumnList lists columns
+" only for those exited, the latter is expected to be one element
+" shorted than the former (since the current buffer should only be
+" entered, but not yet exited).
+" w:BufKillIndex stores the current index into the w:BufKillList array
+
+" Reload guard and 'compatible' handling {{{1
+let s:save_cpo = &cpo
+set cpo&vim
+
+if v:version < 700
+ echoe "bufkill.vim requires vim version 7.00 or greater (mainly because it uses the new lists functionality)"
+ finish
+endif
+
+if exists("loaded_bufkill")
+ finish
+endif
+let loaded_bufkill = 1
+
+
+" User configurable variables {{{1
+" The following variables can be set in your .vimrc/_vimrc file to override
+" those in this file, such that upgrades to the script won't require you to
+" re-edit these variables.
+
+" g:BufKillCommandWhenLastBufferKilled {{{2
+" When you kill the last buffer that has appeared in a window, something
+" has to be displayed if we are to avoid closing the window. Provide the
+" command to be run at this time in this variable. The default is 'enew',
+" meaning that a blank window will be show, with an empty, 'No File' buffer.
+" If this parameter is not set to something valid which changes the buffer
+" displayed in the window, the window may be closed.
+if !exists('g:BufKillCommandWhenLastBufferKilled')
+ let g:BufKillCommandWhenLastBufferKilled = 'enew'
+endif
+
+" g:BufKillActionWhenBufferDisplayedInAnotherWindow {{{2
+" If the buffer you are attempting to kill in one window is also displayed
+" in another, you may not want to kill it afterall. This option lets you
+" decide how this situation should be handled, and can take one of the following
+" values:
+" 'kill' - kill the buffer regardless, always
+" 'confirm' - ask for confirmation before removing it
+" 'cancel' - don't kill it
+" Regardless of the setting of this variable, the buffer will always be
+" killed if you add an exclamation mark to the command, eg :BD!
+if !exists('g:BufKillActionWhenBufferDisplayedInAnotherWindow')
+ let g:BufKillActionWhenBufferDisplayedInAnotherWindow = 'confirm'
+endif
+
+" g:BufKillFunctionSelectingValidBuffersToDisplay {{{2
+" When a buffer is removed from a window, the script finds the previous
+" buffer displayed in the window. However, that buffer may have been
+" unloaded/deleted/wiped by some other mechanism, so it may not be a
+" valid choice. For some people, an unloaded buffer may be a valid choice,
+" for others, no.
+" - If unloaded buffers should be displayed, set this
+" variable to 'bufexists'.
+" - If unloaded buffers should not be displayed, set this
+" variable to 'buflisted' (default).
+" - Setting this variable to 'auto' means that the command :BW will use
+" 'bufexists' to decide if a buffer is valid to display, whilst using
+" :BD or :BUN will use 'buflisted'
+if !exists('g:BufKillFunctionSelectingValidBuffersToDisplay')
+ let g:BufKillFunctionSelectingValidBuffersToDisplay = 'buflisted'
+endif
+
+" g:BufKillActionWhenModifiedFileToBeKilled {{{2
+" When a request is made to kill (wipe, delete, or unload) a modified buffer
+" and the "bang" (!) wasn't included in the commend, two possibilities exist:
+" 1) Fail in the same way as :bw or :bd would, or
+" 2) Prompt the user to save, not save, or cancel the request.
+" Possible values are 'fail' (for options 1), and 'confirm' for option 2
+" This is similar to the vim 'confirm' option. Thus, if this variable
+" isn't defined, the 'confirm' setting will be adopted. Since we want
+" the most current value of 'confirm', no default value need be set
+" for this variable, and it needn't exist.
+
+" g:BufKillOverrideCtrlCaret {{{2
+" The standard vim functionality for Ctrl-^ or Ctrl-6 (swap to alternate
+" buffer) swaps to the alternate file, and preserves the line within that file,
+" but does not preserve the column within the line - instead it goes to the
+" start of the line. If you prefer to go to the same column as well,
+" set this variable to 1.
+if !exists('g:BufKillOverrideCtrlCaret')
+ let g:BufKillOverrideCtrlCaret = 0
+endif
+
+" g:BufKillVerbose {{{2
+" If set to 1, prints extra info about what's being done, why, and how to
+" change it
+if !exists('g:BufKillVerbose')
+ let g:BufKillVerbose = 1
+endif
+
+
+" Commands {{{1
+"
+if !exists(':BA')
+ command -bang BA :call <SID>GotoBuffer('#',"<bang>")
+endif
+if !exists(':BB')
+ command -bang BB :call <SID>GotoBuffer('bufback',"<bang>")
+endif
+if !exists(':BF')
+ command -bang BF :call <SID>GotoBuffer('bufforward',"<bang>")
+endif
+if !exists(':BD')
+ command -bang BD :call <SID>BufKill('bd',"<bang>")
+endif
+if !exists(':BUN')
+ command -bang BUN :call <SID>BufKill('bun',"<bang>")
+endif
+if !exists(':BD')
+ command -bang BD :call <SID>BufKill('bd',"<bang>")
+endif
+if !exists(':BW')
+ command -bang BW :call <SID>BufKill('bw',"<bang>")
+endif
+if !exists(':BUNDO')
+ command -bang BUNDO :call <SID>UndoKill()
+endif
+
+" Keyboard mappings {{{1
+"
+noremap <Plug>BufKillAlt :call <SID>GotoBuffer('#', '')<CR>
+noremap <Plug>BufKillBangAlt :call <SID>GotoBuffer('#', '!')<CR>
+noremap <Plug>BufKillBack :call <SID>GotoBuffer('bufback', '')<CR>
+noremap <Plug>BufKillBangBack :call <SID>GotoBuffer('bufback', '!')<CR>
+noremap <Plug>BufKillForward :call <SID>GotoBuffer('bufforward', '')<CR>
+noremap <Plug>BufKillBangForward :call <SID>GotoBuffer('bufforward', '!')<CR>
+noremap <Plug>BufKillBun :call <SID>BufKill('bun', '')<CR>
+noremap <Plug>BufKillBangBun :call <SID>BufKill('bun', '!')<CR>
+noremap <Plug>BufKillBd :call <SID>BufKill('bd', '')<CR>
+noremap <Plug>BufKillBangBd :call <SID>BufKill('bd', '!')<CR>
+noremap <Plug>BufKillBw :call <SID>BufKill('bw', '')<CR>
+noremap <Plug>BufKillBangBw :call <SID>BufKill('bw', '!')<CR>
+noremap <Plug>BufKillUndo :call <SID>UndoKill()<CR>
+
+function! <SID>CreateUniqueMapping(lhs, rhs, ...)
+ if hasmapto(a:rhs) && !(a:0 == 1 && a:1 == 'AllowDuplicate')
+ " The user appears to have defined an alternate mapping for this command
+ return
+ elseif maparg(a:lhs, 'n') != ""
+ " The user appears to have defined a mapping for a:lhs already
+ return
+ endif
+ exec 'nmap <silent> <unique> '.a:lhs.' '.a:rhs
+endfunction
+
+call <SID>CreateUniqueMapping('<Leader>bb', '<Plug>BufKillBack')
+call <SID>CreateUniqueMapping('<Leader>bf', '<Plug>BufKillForward')
+call <SID>CreateUniqueMapping('<Leader>bun', '<Plug>BufKillBun')
+call <SID>CreateUniqueMapping('<Leader>!bun', '<Plug>BufKillBangBun')
+call <SID>CreateUniqueMapping('<Leader>bd', '<Plug>BufKillBd')
+call <SID>CreateUniqueMapping('<Leader>!bd', '<Plug>BufKillBangBd')
+call <SID>CreateUniqueMapping('<Leader>bw', '<Plug>BufKillBw')
+call <SID>CreateUniqueMapping('<Leader>!bw', '<Plug>BufKillBangBw')
+call <SID>CreateUniqueMapping('<Leader>bundo','<Plug>BufKillUndo')
+call <SID>CreateUniqueMapping('<Leader>ba', '<Plug>BufKillAlt')
+if g:BufKillOverrideCtrlCaret == 1
+ call <SID>CreateUniqueMapping('<C-^>', '<Plug>BufKillAlt', 'AllowDuplicate')
+endif
+
+function! <SID>BufKill(cmd, bang) "{{{1
+" The main function that sparks the buffer change/removal
+ if !exists('w:BufKillList')
+ echoe "BufKill Error: array w:BufKillList does not exist!"
+ echoe "Restart vim and retry, and if problems persist, notify the author!"
+ return
+ endif
+
+ call <SID>SaveWindowPos()
+
+ " Get the buffer to delete - the current one obviously
+ let s:BufKillBufferToKill = bufnr('%')
+ let s:BufKillBufferToKillPath = expand('%:p')
+
+ " If the buffer is already '[No File]' then doing enew won't create a new
+ " buffer, hence the bd/bw command will kill the current buffer and take
+ " the window with it... so check for this case
+ " However - if it's a scratch buffer with text enew should create a new
+ " buffer, so don't return if it is a scratch buffer
+ if bufname('%') == '' && ! &modified && &modifiable
+ " No buffer to kill, ensure not scratch buffer
+ if &buftype == 'nofile' && &swapfile == 0
+ " Is scratch buffer, keep processing
+ else
+ return
+ endif
+ endif
+
+ " Just to make sure, check that this matches the buffer currently pointer to
+ " by w:BufKillIndex - else I've stuffed up
+ if s:BufKillBufferToKill != w:BufKillList[w:BufKillIndex]
+ echom "BufKill Warning: bufferToKill = ".s:BufKillBufferToKill." != element ".w:BufKillIndex." in the list: (".string(w:BufKillList).")"
+ echom "Please notify the author of the circumstances of this message!"
+ endif
+
+ " If the buffer is modified, and a:bang is not set, give the same kind of
+ " error (or confirmation) as normal bw/bd
+ if &modified && strlen(a:bang) == 0
+ if exists('g:BufKillActionWhenModifiedFileToBeKilled')
+ let s:BufKillActionWhenModifiedFileToBeKilled = g:BufKillActionWhenModifiedFileToBeKilled
+ else
+ if &confirm
+ let s:BufKillActionWhenModifiedFileToBeKilled = 'confirm'
+ else
+ let s:BufKillActionWhenModifiedFileToBeKilled = 'fail'
+ endif
+ endif
+ if s:BufKillActionWhenModifiedFileToBeKilled =~ '[Ff][Aa][Ii][Ll]'
+ echoe "No write since last change for buffer '" . bufname(s:BufKillBufferToKill) . "' (add ! to override)"
+ return
+ elseif s:BufKillActionWhenModifiedFileToBeKilled =~ '[Cc][Oo][Nn][Ff][Ii][Rr][Mm]'
+ let options = "&Yes\n&No\n&Cancel"
+ let actionAdjustment = 0
+ let bufname = bufname(winbufnr(winnr()))
+ if bufname == ''
+ let bufname = '[No File]'
+ let options = "&No\n&Cancel"
+ let actionAdjustment = 1
+ endif
+ let action=confirm("Save Changes in " . bufname . " before removing it?", options)
+ if action + actionAdjustment == 1
+ " Yes - try to save - if there is an error, cancel
+ let v:errmsg = ""
+ silent w
+ if v:errmsg != ""
+ echoerr "Unable to write buffer!"
+ return
+ endif
+ elseif action + actionAdjustment == 2
+ " No, abandon changes
+ set nomodified
+ else
+ " Cancel (or any other result), don't do the open
+ return
+ endif
+ else
+ echoe "Illegal value (' . s:BufKillActionWhenModifiedFileToBeKilled . ') stored in variable s:BufKillActionWhenModifiedFileToBeKilled, please notify the author"
+ endif
+ endif
+
+ " Get a list of all windows which have this buffer loaded
+ let s:BufKillWindowListWithBufferLoaded = []
+ let i = 1
+ let buf = winbufnr(i)
+ while buf != -1
+ if buf == s:BufKillBufferToKill
+ let s:BufKillWindowListWithBufferLoaded += [i]
+ endif
+ let i = i + 1
+ let buf = winbufnr(i)
+ endwhile
+
+ " Handle the case where the buffer is displayed in multiple windows
+ if len(s:BufKillWindowListWithBufferLoaded) > 1 && strlen(a:bang) == 0
+ if g:BufKillActionWhenBufferDisplayedInAnotherWindow =~ '[Cc][Aa][Nn][Cc][Ee][Ll]'
+ if g:BufKillVerbose
+ echom "Buffer '" . bufname(s:BufKillBufferToKill) . "' displayed in multiple windows - " . a:cmd . " cancelled (add ! to kill anywawy, or set g:BufKillActionWhenBufferDisplayedInAnotherWindow to 'confirm' or 'kill')"
+ endif
+ return
+ elseif g:BufKillActionWhenBufferDisplayedInAnotherWindow =~ '[Cc][Oo][Nn][Ff][Ii][Rr][Mm]'
+ let choice = confirm("Buffer '" . bufname(s:BufKillBufferToKill) . "' displayed in multiple windows - " . a:cmd . " it anyway?", "&Yes\n&No", 1)
+ if choice != 1
+ return
+ endif
+ elseif g:BufKillActionWhenBufferDisplayedInAnotherWindow =~ '[Rr][Ee][Mm][Oo][Vv][Ee]'
+ if g:BufKillVerbose
+ echom "Buffer '" . bufname(s:BufKillBufferToKill) . "' displayed in multiple windows - executing " . a:cmd . " anyway."
+ endif
+ " Fall through and continue
+ endif
+ endif
+
+ " For each window that the file is loaded in, go to the previous buffer from its list
+ let i = 0
+ while i < len(s:BufKillWindowListWithBufferLoaded)
+ let win = s:BufKillWindowListWithBufferLoaded[i]
+
+ " Go to the right window in which to perform the action
+ if win > 0
+ exec 'normal! ' . win . 'w'
+ endif
+
+ " Go to the previous buffer for this window
+ call <SID>GotoBuffer(a:cmd, a:bang)
+
+ let i = i + 1
+ endwhile
+
+ " Restore the cursor to the correct window _before_ removing the buffer,
+ " since the buffer removal could have side effects on the windows (eg
+ " minibuffer disappearing due to not enough buffers)
+ call <SID>RestoreWindowPos()
+
+ " Kill the old buffer, but save info about it for undo purposes
+ let s:BufKillLastWindowListWithBufferLoaded = s:BufKillWindowListWithBufferLoaded
+ let s:BufKillLastBufferKilledPath = s:BufKillBufferToKillPath
+ let s:BufKillLastBufferKilledNum = s:BufKillBufferToKill
+ " In some cases (eg when deleting the quickfix buffer) the buffer will
+ " already have been deleted by the switching to another buffer in its
+ " window. Thus we must check before deleting.
+ if bufexists(s:BufKillBufferToKill)
+ let killCmd = a:cmd . a:bang . s:BufKillBufferToKill
+ exec killCmd
+ else
+ endif
+
+endfunction
+
+function! <SID>GotoBuffer(cmd, bang) "{{{1
+ "Function to display the previous buffer for the specified window
+ " a:cmd is one of
+ " bw - Wiping the current buffer
+ " bd - Deleting the current buffer
+ " bufback - stepping back through the list
+ " bufforward - stepping forward through the list
+ " # - swap to alternate buffer, if one exists. Use this instead of
+ " Ctrl-^, in order to swap to the previous column of the alternate
+ " file, which does not happen with regular Ctrl-^.
+
+ if (a:cmd=='bw' || a:cmd=='bd')
+ let w:BufKillLastCmd = a:cmd . a:bang
+ " Handle the 'auto' setting for
+ " g:BufKillFunctionSelectingValidBuffersToDisplay
+ let validityFunction = g:BufKillFunctionSelectingValidBuffersToDisplay
+ if validityFunction == 'auto'
+ " The theory here is that if a person usually uses bd, then buffers
+ " they've intended to delete will still exist, but not be listed. Hence
+ " we use buflisted to check if they've deleted the buffer already, so as
+ " not to show the ones they've deleted. If instead they use bw,
+ " then the assumption is that to really delete buffers they use bw, so
+ " if they've used bd, they were meaning to hide the file from view - but
+ " keep it around - hence we should find it if it's only been deleted,
+ " hence we use bufexists to look for it. Yes, it's weak logic - but you
+ " can always override it! ;)
+ if a:cmd == 'bw'
+ let validityFunction = 'bufexists'
+ else
+ let validityFunction = 'buflisted'
+ endif
+ endif
+ let w:BufKillIndex -= 1
+ else
+ let w:BufKillLastCmd = 'bufchange'
+ " Should only be used with undeleted (and unwiped) buffers
+ let validityFunction = 'buflisted'
+
+ if a:cmd == 'bufforward'
+ let w:BufKillIndex += 1
+ elseif a:cmd == 'bufback'
+ let w:BufKillIndex -= 1
+ elseif a:cmd == '#'
+ let bufnum = bufnr('#')
+ if bufnum == -1
+ echom "E23: No alternate file (error simulated by bufkill.vim)"
+ return
+ endif
+ if bufnum == bufnr('.')
+ " If the alternate buffer is also the current buffer, do nothing
+ " Update: I've seen cases (vim 7.2.411) where we end up here, though
+ " :ls suggests bufnr('.') is returning the wrong value. So allow
+ " the command to proceed...
+ echom "bufkill: bufnr('#')=".bufnr('#')." and bufnr('.')=".bufnr('.')." - trying anyway"
+ " return
+ elseif !buflisted(bufnum)
+ " Vim just ignores the command in this case, so we'll do likewise
+ " Update: it seems it no longer ignores the command in this case
+ " but in my experience, I don't want to jump to an unlisted
+ " buffer via this command - so I'll continue to ignore it - but notify
+ " the user...
+ echom "bufkill: Alternate buffer is unlisted buffer ".bufnum." ("
+ \ .bufname(bufnum).") - ignoring request"
+ return
+ endif
+ " Find this buffer number in the w:BufKillList
+ let w:BufKillIndex = index(w:BufKillList, bufnum)
+ endif
+ endif
+
+ " Find the most recent buffer to display
+ if w:BufKillIndex < 0 || w:BufKillIndex >= len(w:BufKillList)
+ let newBuffer = -1
+ else
+ let newBuffer = w:BufKillList[w:BufKillIndex]
+ let newColumn = w:BufKillColumnList[w:BufKillIndex]
+ exec 'let validityResult = '.validityFunction.'(newBuffer)'
+ while !validityResult
+ call remove(w:BufKillList, w:BufKillIndex)
+ call remove(w:BufKillColumnList, w:BufKillIndex)
+ if a:cmd != 'bufforward'
+ let w:BufKillIndex -= 1
+ " No change needed for bufforward since we just deleted the element
+ " being pointed to, so effectively, we moved forward one spot
+ endif
+ if w:BufKillIndex < 0 || w:BufKillIndex >= len(w:BufKillList)
+ let newBuffer = -1
+ break
+ endif
+ let newBuffer = w:BufKillList[w:BufKillIndex]
+ let newColumn = w:BufKillColumnList[w:BufKillIndex]
+ exec 'let validityResult = '.validityFunction.'(newBuffer)'
+ endwhile
+ endif
+
+ " Handle the case of no valid buffer number to display
+ let cmd = ''
+ if newBuffer == -1
+ " Ensure index is meaningful
+ if a:cmd == 'bufforward'
+ let w:BufKillIndex = len(w:BufKillList) - 1
+ else
+ let w:BufKillIndex = 0
+ endif
+ " Reset lastCmd since didn't work
+ let w:BufKillLastCmd = ''
+ echom 'BufKill: already at the limit of the BufKill list'
+ " Leave cmd empty to do nothing
+ else
+ let cmd = 'b' . a:bang . newBuffer . "|call cursor(line('.')," . newColumn . ')'
+ endif
+ exec cmd
+
+endfunction " GotoBuffer
+
+function! <SID>UpdateList(event) "{{{1
+ " Function to update the window list with info about the current buffer
+ if !exists('w:BufKillList')
+ let w:BufKillList = []
+ endif
+ if !exists('w:BufKillColumnList')
+ let w:BufKillColumnList = []
+ endif
+ if !exists('w:BufKillIndex')
+ let w:BufKillIndex = -1
+ endif
+ if !exists('w:BufKillLastCmd')
+ let w:BufKillLastCmd = ''
+ endif
+ let bufferNum = bufnr('%')
+
+ if (w:BufKillLastCmd=~'bufchange')
+ " When stepping through files, the w:BufKillList should not be changed
+ " here, only by the GotoBuffer command since the files must already
+ " exist in the list to jump to them.
+ else
+ " Increment index
+ let w:BufKillIndex += 1
+ if w:BufKillIndex < len(w:BufKillList)
+ " The branch is diverging, remove the end of the list
+ call remove(w:BufKillList, w:BufKillIndex, -1)
+ " Same for column list
+ if w:BufKillIndex < len(w:BufKillColumnList)
+ call remove(w:BufKillColumnList, w:BufKillIndex, -1)
+ endif
+ endif
+ " Now remove any pre-existing instances of the buffer in the list
+ let existingIndex = index(w:BufKillList, bufferNum)
+ if existingIndex != -1
+ call remove(w:BufKillList, existingIndex)
+ let w:BufKillIndex -= 1
+ if existingIndex < len(w:BufKillColumnList)
+ call remove(w:BufKillColumnList, existingIndex)
+ endif
+ endif
+ " Now add the buffer to the list, at the end
+ let w:BufKillList += [bufferNum]
+ endif
+
+ " Reset since command processed
+ let w:BufKillLastCmd = ''
+
+endfunction " UpdateList
+
+function! <SID>UpdateLastColumn(event) "{{{1
+ " Function to save the current column and buffer and window numbers,
+ if !exists('w:BufKillList')
+ " Just give up for now.
+ return
+ endif
+ let index = index(w:BufKillList, bufnr('%'))
+ if index != -1
+ " Extend list if required, then set the value
+ let w:BufKillColumnList += repeat([0], index - len(w:BufKillColumnList) + 1)
+ let w:BufKillColumnList[index] = col('.')
+ else
+ echom 'UpdateLastColumn failed to find bufnr ' . bufnr('%') . ' in w:BufKillList'
+ endif
+endfunction
+
+function! <SID>UndoKill() "{{{1
+
+ if !exists('s:BufKillLastBufferKilledNum') || !exists('s:BufKillLastBufferKilledPath') || s:BufKillLastBufferKilledNum == -1 || s:BufKillLastBufferKilledPath == ''
+ echoe 'BufKill: nothing to undo (only one level of undo is supported)'
+ else
+ if bufexists(s:BufKillLastBufferKilledNum)
+ let cmd = 'b' . s:BufKillLastBufferKilledNum
+ elseif filereadable(s:BufKillLastBufferKilledPath)
+ let cmd = 'e ' . s:BufKillLastBufferKilledPath
+ else
+ unlet s:BufKillLastBufferKilledNum
+ unlet s:BufKillLastBufferKilledPath
+ unlet s:BufKillLastWindowListWithBufferLoaded
+ echoe 'BufKill: unable to undo. Neither buffer (' . s:BufKillLastBufferKilledNum . ') nor file (' . s:BufKillLastBufferKilledPath . ') could be found.'
+ endif
+
+ " For each window the buffer was removed from, show it again
+ call <SID>SaveWindowPos()
+ let i = 0
+ while i < len(s:BufKillLastWindowListWithBufferLoaded)
+ let win = s:BufKillLastWindowListWithBufferLoaded[i]
+ exec 'normal! ' . win . 'w'
+ exec cmd
+ let i = i + 1
+ endwhile
+ call <SID>RestoreWindowPos()
+
+ unlet s:BufKillLastBufferKilledNum
+ unlet s:BufKillLastBufferKilledPath
+ unlet s:BufKillLastWindowListWithBufferLoaded
+ endif
+endfunction
+
+function! <SID>SaveWindowPos() "{{{1
+ " Save the current window, to be able to come back to it after doing things
+ " in other windows
+ let s:BufKillWindowPos = winnr()
+endfunction
+
+function! <SID>RestoreWindowPos() "{{{1
+ " Restore the window from it's saved config variable
+ exec 'normal! ' . s:BufKillWindowPos . 'w'
+endfunction
+
+" Autocommands {{{1
+"
+augroup BufKill
+autocmd BufKill WinEnter * call <SID>UpdateList('WinEnter')
+autocmd BufKill BufEnter * call <SID>UpdateList('BufEnter')
+autocmd BufKill WinLeave * call <SID>UpdateLastColumn('WinLeave')
+autocmd BufKill BufLeave * call <SID>UpdateLastColumn('BufLeave')
+
+" Cleanup and modelines {{{1
+let &cpo = s:save_cpo
+
+" vim:ft=vim:fdm=marker:fen:fmr={{{,}}}:
diff --git a/plugin/python_pydoc.vim b/plugin/python_pydoc.vim
new file mode 100644
index 0000000..30dcd65
--- /dev/null
+++ b/plugin/python_pydoc.vim
@@ -0,0 +1,196 @@
+" Vim ftplugin file
+" Language: Python
+" Authors: André Kelpe <efeshundertelf at googlemail dot com>
+" Romain Chossart <romainchossat at gmail dot com>
+" Matthias Vogelgesang
+" Ricardo Catalinas Jiménez <jimenezrick at gmail dot com>
+" Patches and suggestions from all sorts of fine people
+"
+" More info and updates at:
+"
+" http://www.vim.org/scripts/script.php?script_id=910
+"
+"
+" This plugin integrates the Python documentation view and search tool pydoc
+" into Vim. It allows you to view the documentation of a Python module or class
+" by typing:
+"
+" :Pydoc foo.bar.baz (e.g. :Pydoc re.compile)
+"
+" Or search a word (uses pydoc -k) in the documentation by typing:
+"
+" :PydocSearch foobar (e.g. :PydocSearch socket)
+"
+" Vim will split the current window to show the Python documentation found by
+" pydoc (the buffer will be called '__doc__', Pythonic, isn't it ;-) ). The
+" name may cause problems if you have a file with the same name, but usually
+" this should not happen.
+"
+" pydoc.vim also allows you to view the documentation of the 'word' (see :help
+" word) under the cursor by pressing <Leader>pw or the 'WORD' (see :help WORD)
+" under the cursor by pressing <Leader>pW. This is very useful if you want to
+" jump to the docs of a module or class found by 'PydocSearch' or if you want
+" to see the docs of a module/class in your source code. Additionally K is
+" mapped to show invoke pydoc as well, when you are editing python files.
+"
+" The script is developed in GitHub at:
+"
+" http://github.com/fs111/pydoc.vim
+"
+"
+" If you want to use the script and pydoc is not in your PATH, just put a
+" line like this in your .vimrc:
+"
+" let g:pydoc_cmd = '/usr/bin/pydoc'
+"
+" or more portable
+"
+" let g:pydoc_cmd = 'python -m pydoc'
+"
+" If you want to open pydoc files in vertical splits or tabs, give the
+" appropriate command in your .vimrc with:
+"
+" let g:pydoc_open_cmd = 'vsplit'
+"
+" or
+"
+" let g:pydoc_open_cmd = 'tabnew'
+"
+" The script will highlight the search term by default. To disable this behaviour
+" put in your .vimrc:
+"
+" let g:pydoc_highlight=0
+"
+"
+" In order to install pydoc.vim download it from vim.org or clone the repository
+" on githubi and put it in your .vim/ftplugin directory. pydoc.vim is also fully
+" compatible with pathogen, so cloning the repository into your bundle directory
+" is also a valid way to install it. (I do this myself. see
+" https://github.com/fs111/dotvim).
+"
+" pydoc.vim is free software; you can redistribute it and/or
+" modify it under the terms of the GNU General Public License
+" as published by the Free Software Foundation; either version 2
+" of the License, or (at your option) any later version.
+"
+" Please feel free to contact me and follow me on twitter (@fs111).
+
+" IMPORTANT: We don't use here the `exists("b:did_ftplugin")' guard becase we
+" want to let the Python filetype script that comes with Vim to execute as
+" normal.
+
+" Don't redefine the functions if this ftplugin has been executed previously
+" and before finish create the local mappings in the current buffer
+if exists('*s:ShowPyDoc') && g:pydoc_perform_mappings
+ call s:PerformMappings()
+ finish
+endif
+
+if !exists('g:pydoc_perform_mappings')
+ let g:pydoc_perform_mappings = 1
+endif
+
+if !exists('g:pydoc_highlight')
+ let g:pydoc_highlight = 1
+endif
+
+if !exists('g:pydoc_cmd')
+ let g:pydoc_cmd = 'pydoc3'
+endif
+
+if !exists('g:pydoc_open_cmd')
+ let g:pydoc_open_cmd = 'split'
+endif
+
+setlocal switchbuf=useopen
+highlight pydoc cterm=reverse gui=reverse
+
+function s:ShowPyDoc(name, type)
+ if a:name == ''
+ return
+ endif
+
+ if g:pydoc_open_cmd == 'split'
+ let l:pydoc_wh = 10
+ endif
+
+ if bufloaded("__doc__")
+ let l:buf_is_new = 0
+ if bufname("%") == "__doc__"
+ " The current buffer is __doc__, thus do not
+ " recreate nor resize it
+ let l:pydoc_wh = -1
+ else
+ " If the __doc__ buffer is open, jump to it
+ silent execute "sbuffer" bufnr("__doc__")
+ let l:pydoc_wh = -1
+ endif
+ else
+ let l:buf_is_new = 1
+ silent execute g:pydoc_open_cmd '__doc__'
+ if g:pydoc_perform_mappings
+ call s:PerformMappings()
+ endif
+ endif
+
+ setlocal modifiable
+ setlocal noswapfile
+ setlocal buftype=nofile
+ setlocal bufhidden=delete
+ setlocal syntax=man
+
+ silent normal ggdG
+ " Remove function/method arguments
+ let s:name2 = substitute(a:name, '(.*', '', 'g' )
+ " Remove all colons
+ let s:name2 = substitute(s:name2, ':', '', 'g' )
+ if a:type == 1
+ execute "silent read !" g:pydoc_cmd s:name2
+ else
+ execute "silent read !" g:pydoc_cmd "-k" s:name2
+ endif
+ normal 1G
+
+ if exists('l:pydoc_wh') && l:pydoc_wh != -1
+ execute "silent resize" l:pydoc_wh
+ end
+
+ if g:pydoc_highlight == 1
+ execute 'syntax match pydoc' "'" . s:name2 . "'"
+ endif
+
+ let l:line = getline(2)
+ if l:line =~ "^no Python documentation found for.*$"
+ if l:buf_is_new
+ execute "bdelete!"
+ else
+ normal u
+ setlocal nomodified
+ setlocal nomodifiable
+ endif
+ redraw
+ echohl WarningMsg | echo l:line | echohl None
+ else
+ setlocal nomodified
+ setlocal nomodifiable
+ endif
+endfunction
+
+" Mappings
+function s:PerformMappings()
+ nnoremap <silent> <buffer> <Leader>pw :call <SID>ShowPyDoc('<C-R><C-W>', 1)<CR>
+ nnoremap <silent> <buffer> <Leader>pW :call <SID>ShowPyDoc('<C-R><C-A>', 1)<CR>
+ nnoremap <silent> <buffer> <Leader>pk :call <SID>ShowPyDoc('<C-R><C-W>', 0)<CR>
+ nnoremap <silent> <buffer> <Leader>pK :call <SID>ShowPyDoc('<C-R><C-A>', 0)<CR>
+
+ " remap the K (or 'help') key
+ nnoremap <silent> <buffer> K :call <SID>ShowPyDoc(expand("<cword>"), 1)<CR>
+endfunction
+
+if g:pydoc_perform_mappings
+ call s:PerformMappings()
+endif
+
+" Commands
+command -nargs=1 Pydoc :call s:ShowPyDoc('<args>', 1)
+command -nargs=* PydocSearch :call s:ShowPyDoc('<args>', 0)
diff --git a/vimrc b/vimrc
new file mode 100644
index 0000000..ce5301d
--- /dev/null
+++ b/vimrc
@@ -0,0 +1,73 @@
+" for long lines
+set wrap
+
+" tab position
+set tabstop=4
+
+set autoindent
+
+" autotab
+set shiftwidth=4
+
+" syntax highlighting
+syntax on
+
+" try to detect filetypes
+filetype on
+
+" enable loading indent file for filetype
+filetype plugin indent on
+
+" line numbers
+set number
+
+" highlight end of line whitespace
+highlight WhitespaceEOL ctermbg=red guibg=red
+match WhitespaceEOL /\s\+$/
+
+" spellcheck please!
+setlocal spell spelllang=en_gb
+hi clear SpellBad
+hi SpellBad term=standout ctermfg=1 cterm=bold gui=undercurl guisp=Red
+
+" extra python
+"" wrapping and tabs
+autocmd FileType python set ts=4 sw=4 et sta sts=4 ai
+"" smart indenting
+autocmd FileType python let python_highlight_all = 1
+"" extra highlighting
+autocmd FileType python set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
+
+let g:syntastic_python_checkers = ['pyflakes']
+let g:syntastic_go_checkers = ['go', 'golint', 'govet', 'errcheck']
+
+let g:syntastic_scala_scalastyle_jar = '/home/juanmartinez/scala-local/lib/scalastyle_2.12-1.0.0-batch.jar'
+let g:syntastic_scala_scalastyle_config_file = '/home/juanmartinez/scala-local/lib/scalastyle_config.xml'
+let g:syntastic_scala_checkers = ['fsc', 'scalastyle']
+
+let g:syntastic_always_populate_loc_list = 1
+let g:syntastic_auto_loc_list = 0
+let g:syntastic_check_on_open = 1
+let g:syntastic_check_on_wq = 0
+let g:syntastic_loc_list_height = 5
+
+" scala
+let g:scala_scaladoc_indent = 1
+noremap <C-F5> :Autoformat<CR>
+let g:formatdef_scalariform = '"java -jar /home/juanmartinez/scalalocal/lib/scalariform.jar -f -q +compactControlReadability +alignParameters +alignSingleLineCaseStatements +doubleIndentConstructorArguments +rewriteArrowSymbols +preserveSpaceBeforeArguments --stdin --stdout"'
+let g:formatters_scala = ['scalariform']
+
+" use local tags if found
+set tags=./.tags;
+let g:easytags_dynamic_files = 1
+
+" build tags
+map <C-F12> :!ctags -R -f ./.tags .<CR>
+
+call pathogen#infect()
+
+" looks nice; apparently needs to go after pathogen
+set background=dark
+colorscheme base16-google-dark
+let base16colorspace=256 " Access colors present in 256 colorspace
+