Vim reset

This commit is contained in:
Max Bucknell 2019-03-04 21:08:35 +00:00
parent 85b7620c85
commit 7caa0e5515
19 changed files with 0 additions and 1613 deletions

View file

@ -114,35 +114,6 @@ install_dotfiles () {
done done
} }
install_vim_plugins () {
info "installing vim plugins"
local PLUGINS=(
"joonty/vdebug"
"w0rp/ale"
"pangloss/vim-javascript"
"sirver/ultisnips"
"tpope/vim-surround"
"tpope/vim-fugitive"
"airblade/vim-gitgutter"
)
local BASE_DIR="$DOTFILES_ROOT/vim/vim.symlink/bundle"
local GIT_HOST="git@github.com"
rm -fr "$BASE_DIR"
success "remove existing plugins"
mkdir -p "$BASE_DIR"
for i in "${PLUGINS[@]}"
do
info "installing $i"
local BASE_NAME="$(basename $i)"
git clone "$GIT_HOST:$i" "$BASE_DIR/$BASE_NAME" &> /dev/null
success "installed $i"
done
}
install_zsh_plugins () { install_zsh_plugins () {
info "installing bash plugins" info "installing bash plugins"
@ -167,7 +138,6 @@ install_zsh_plugins () {
done done
} }
install_vim_plugins
install_zsh_plugins install_zsh_plugins
install_dotfiles install_dotfiles

View file

@ -1,37 +0,0 @@
snippet ttest
/* eslint-env node, mocha */
/* eslint-disable no-unused-expressions */
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
chai.use(sinonChai);
const expect = chai.expect;
$0
endsnippet
snippet tdescribe
describe('${1:Description}', () => {
${2:// specs}
});$0
endsnippet
snippet tbefore
beforeEach(() => {
${1:// do stuff}
});$0
endsnippet
snippet tit
it('should ${1:do something exciting}', () => {
${2:// spec}
});$0
endsnippet
snippet texpect
expect(${1:value}).to.${2:be.true};$0
endsnippet

View file

@ -1,10 +0,0 @@
snippet mimport
import ${1:${2:default}, }${2:\{
${3:...things}
\}} from ${4:'${5:module}'};
$0
endsnippet
snippet mdep
${1:dependency}${2: as ${3:alias}},
endsnippet

View file

@ -1,50 +0,0 @@
snippet action
export const type = '${1:`!p snip.rv = snip.basename`}';
export default (${2:...args}) => (\{
type,${3:
payload: \{
${2/,?( |$)/,\n $1$1/g}\},}
\});$0
endsnippet
snippet testaction
import test from 'tape';
import ${1/-(\w)/\u$1/g}, \{
type,
\} from '../../src/actions/${1:`!p snip.rv = snip.basename`}';
test('${1/-(\w)/\u$1/g} is a function', (t) => \{
const actual = typeof ${1/-(\w)/\u$1/g};
const expected = 'function';
t.equal(
actual, expected,
'${1/-(\w)/\u$1/g} should be a function'
);
t.end();
\});
test('${1/-(\w)/\u$1/g} returns the correct action', (t) => \{
const actual = ${1/-(\w)/\u$1/g}();
const expected = \{ type \};
t.deepEqual(
actual, expected,
'Action not of expected shape'
);
t.end();
\});
endsnippet
snippet impaction
import ${1/-(\w)/\u$1/g}, \{
type as ${1/-(\w)/\u$1/g}Type,
\} from './${1:action-file-name}';
${1/-(\w)/\u$1/g}.type = ${1/-(\w)/\u$1/g}Type;
export \{ ${1/-(\w)/\u$1/g} \};
endsnippet

View file

@ -1,20 +0,0 @@
snippet mcomposer
\{
"name": "${1:vendor}/${2:module}-${3:module-name}",
"description": "${4:Elevator pitch}",
"require": \{
"php": "~5.6.0|~7.0.0"$0
\},
"type": "magento2-$2",
"license": "${5:proprietary}",
"autoload": \{
"files": [
"registration.php"
],
"psr-4": \{
"${1/(^|-)(\w)/\u$2/g}\\\\${3/(^|-)(\w)/\u$2/g}\\\\": ""
\}
\}
\}
endsnippet

View file

@ -1,3 +0,0 @@
snippet mrem
unit($1px / @font-size__s) * 1rem$0
endsnippet

View file

@ -1,65 +0,0 @@
# Python
#
# `mbutils` is a collection of tooling I've built to do some intelligent
# stuff around PHP tooling.
# Found in lib/python/mbutils.py
global !p
import mbutils
import os
def full_path(filename):
cwd = os.getcwd()
filepath = os.path.join(cwd, filename)
return os.path.dirname(filepath)
endglobal
snippet class
<?php
/**
* This file is part of the ${1:`!p snip.rv = mbutils.get_package_name(full_path(path))`} package.
*
* @copyright Copyright `date +%Y` ${2:Redbox Digital}. All rights reserved.
*/
namespace ${12:`!p snip.rv = mbutils.get_namespace(full_path(path))`};${13:
use ${14:ImportedTypes;}}
/**
* ${3:${4:Short description...}
*
* ${5:A slightly longer description of what you want to do.}
*
* ${6:@tags...}}
*/
class ${7:`!p snip.rv = snip.basename`}${8: extends ${9:ParentClass}}${10: implements ${11:$7Interface}}
\{
${0:// Implementation...}
\}
endsnippet
snippet interface
<?php
/**
* This file is part of the ${1:`!p snip.rv = mbutils.get_package_name(full_path(path))`} package.
*
* @copyright Copyright `date +%Y` ${2:Redbox Digital}. All rights reserved.
*/
namespace ${12:`!p snip.rv = mbutils.get_namespace(full_path(path))`};${13:
use ${14:ImportedTypes;}}
/**
* ${3:${4:Short description...}
*
* ${5:A slightly longer description of what you want to do.}
*
* ${6:@tags...}}
*/
interface ${7:`!p snip.rv = snip.basename`}${8: extends ${9:ParentInterface}}
\{
${0:// Methods...}
\}
endsnippet

View file

@ -1,22 +0,0 @@
# Python
#
# `mbutils` is a collection of tooling I've built to do some intelligent
# stuff around PHP tooling.
# Found in lib/python/mbutils.py
global !p
import mbutils
import os
def full_path(filename):
cwd = os.getcwd()
filepath = os.path.join(cwd, filename)
return os.path.dirname(filepath)
endglobal
snippet field
/**
* @var ${1:Type}
*/
private ${2:\$fieldName};
endsnippet

View file

@ -1,87 +0,0 @@
global !p
from mbutils import get_namespace
import os
def full_path(filename):
cwd = os.getcwd()
filepath = os.path.join(cwd, filename)
return os.path.dirname(filepath)
endglobal
snippet mcomponent
<?php
/**
* @copyright Copyright 2017 ${1:Redbox Digital}
*/
use Magento\\Framework\\Component\\ComponentRegistrar;
ComponentRegistrar::register(
ComponentRegistrar::${2:MODULE},
'${3:Redbox}_${4:Module}',
__DIR__
);
endsnippet
snippet mcontroller
<?php
/**
* @copyright Copyright 2017 ${1:Redbox Digital}
*/
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
use Magento\\Framework\\App\\Action\\Action;
use Magento\\Framework\\App\\Action\\Context;
use Magento\\Framework\\Controller\\ResultFactory;
${3:// Use...}
class ${4:`!p snip.rv = snip.basename`} extends ${6:Action}${7: implements ${8:SomeInterface, OtherInterface}}
\{
/**
* @var ResultFactory
*/
private $resultFactory;
/**
* @param Context $context
* @param ResultFactory $resultFactory
*/
public function __construct(
Context $context,
ResultFactory $resultFactory
) \{
parent::__construct($context);
$this->resultFactory = $resultFactory;
\}
/**
* @return \Magento\Framework\Controller\ResultInterface
*/
public function execute()
\{
${0:// Implementation...}
\}
\}
endsnippet
snippet mblock
<?php
/**
* @copyright Copyright 2017 ${1:Redbox Digital}
*/
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
use Magento\\Framework\\View\\Element\\Template;
use Magento\\Framework\\View\\Element\\Template\\Context;
${3:// Use...}
class ${4:`!p snip.rv = snip.basename`} extends ${6:Template}${7: implements ${8:SomeInterface, OtherInterface}}
\{
${0:// Implementation...}
\}
endsnippet

View file

@ -1,98 +0,0 @@
# Python
#
# `mbutils` is a collection of tooling I've built to do some intelligent
# stuff around PHP tooling.
# Found in lib/python/mbutils.py
global !p
import mbutils
import os
def full_path(filename):
cwd = os.getcwd()
filepath = os.path.join(cwd, filename)
return os.path.dirname(filepath)
endglobal
# @param
#
# To make param generation a little easier.
post_jump "if (snip.tabstop is 4): mbutils.add_argument(snip)"
snippet @param
@param ${1:Type}${2:|null} ${3:name} ${4:Description}
endsnippet
# Public method.
#
# Forces me to write a really good docblock.
snippet pubf
/**
* ${2:Short description...}
*
* ${3:A slightly longer description of what you want to do.}
*
* ${4:@api}
* ${5:@params...}
* @return ${6:ReturnType}
* ${7:@throws ${8:ExceptionType}}
*/
public function ${1:methodName}(): `!p snip.rv = mbutils.map_type(t[6])` \{
$0
\}
endsnippet
# Private method. As public.
post_jump "if (snip.tabstop == 0): format_method(snip)"
snippet prif
/**
* ${2:Short description...}
*
* ${3:A slightly longer description of what you want to do.}
*
* ${4:@api}
* ${5:@params...}
* @return ${6:ReturnType}
* ${7:@throws ${8:ExceptionType}}
*/
private function ${1:methodName}(
...\$args
): `!p snip.rv = map_type(t[6])` \{
$0
\}
endsnippet
# Protected method. As public.
snippet prof
/**
* ${2:Short description...}
*
* ${3:A slightly longer description of what you want to do.}
*
* ${4:@api}
* ${5:@params...}
* @return ${6:ReturnType}
* ${7:@throws ${8:ExceptionType}}
*/
protected function ${1:methodName}(): `!p snip.rv = map_type(t[6])` \{
$0
\}
endsnippet
snippet construct
/**
* ${1:@params}
*/
public function __construct(
...\$args
) \{
/*
* Mark the ballot if you want the relevant code to be generated.
*
* [${2: }] - Make fields?
* [${3: }] - Make getters?
* [${4: }] - Make setters?
*/
$0
\}
endsnippet

View file

@ -1,29 +0,0 @@
global !p
from mbutils import get_namespace
import os
def full_path(filename):
cwd = os.getcwd()
filepath = os.path.join(cwd, filename)
return os.path.dirname(filepath)
endglobal
snippet utest
<?php
/**
* @copyright Copyright 2017 ${1:Redbox Digital}
*/
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
${3:// Use...}
class ${4:`!p snip.rv = snip.basename`} extends ${6:\\PHPUnit_Framework_TestCase}${7: implements ${8:SomeInterface, OtherInterface}}
\{
public function test${9:ThatYouAreInFactNotAnIdiot}()
\{
${0:// Implementation...}
\}
\}
endsnippet

View file

@ -1,55 +0,0 @@
snippet mmodxml
<?xml version="1.0"?>
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"
>
<module name="$1" setup_version="0.1.0">
$0
</module>
</config>
endsnippet
snippet mdixml
<?xml version="1.0"?>
<config
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"
>
$0
</config>
endsnippet
snippet mwidgets
<?xml version="1.0" encoding="UTF-8"?>
<widgets
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd"
>
$0
</widgets>
endsnippet
snippet mwidget
<widget id="$1_$2__$3"
class="$1\\$2\Block\Widget\\$4"
is_email_compatible="$5"
placeholder_image="$1_$2::images/$3.png">
<label translate="true">$6</label>
<description translate="true">$7</description>
<parameters>
$0
</parameters>
</widget>
endsnippet
snippet mwidgetparam
<parameter name="$1"
xsi:type="$2"
visible="$3"
required="$4"
sort_order="$5">
<label translate="true">$6</label>
<description translate="true">$7</description>
</parameter>
endsnippet

View file

@ -1,347 +0,0 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.3
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `execute pathogen#infect()` to the top of your
" .vimrc is the only other setup necessary.
"
" The API is documented inline below.
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a relative path to invoke
" pathogen#interpose() (defaults to "bundle/{}"), or an absolute path to invoke
" pathogen#surround(). Curly braces are expanded with pathogen#expand():
" "bundle/{}" finds all subdirectories inside "bundle" inside all directories
" in the runtime path.
function! pathogen#infect(...) abort
for path in a:0 ? filter(reverse(copy(a:000)), 'type(v:val) == type("")') : ['bundle/{}']
if path =~# '^\%({\=[$~\\/]\|{\=\w:[\\/]\).*[{}*]'
call pathogen#surround(path)
elseif path =~# '^\%([$~\\/]\|\w:[\\/]\)'
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#surround(path . '/{}')
elseif path =~# '[{}*]'
call pathogen#interpose(path)
else
call s:warn('Change pathogen#infect('.string(path).') to pathogen#infect('.string(path.'/{}').')')
call pathogen#interpose(path . '/{}')
endif
endfor
call pathogen#cycle_filetype()
if pathogen#is_disabled($MYVIMRC)
return 'finish'
endif
return ''
endfunction
" Split a path into a list.
function! pathogen#split(path) abort
if type(a:path) == type([]) | return a:path | endif
if empty(a:path) | return [] | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction
" Convert a list to a path.
function! pathogen#join(...) abort
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
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort
return call('pathogen#join',[1] + a:000)
endfunction
" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() abort
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction
" Check if a bundle is disabled. A bundle is considered disabled if its
" basename or full name is included in the list g:pathogen_disabled.
function! pathogen#is_disabled(path) abort
if a:path =~# '\~$'
return 1
endif
let sep = pathogen#slash()
let blacklist = map(
\ get(g:, 'pathogen_blacklist', get(g:, 'pathogen_disabled', [])) +
\ pathogen#split($VIMBLACKLIST),
\ 'substitute(v:val, "[\\/]$", "", "")')
return index(blacklist, fnamemodify(a:path, ':t')) != -1 || index(blacklist, a:path) != -1
endfunction "}}}1
" Prepend the given directory to the runtime path and append its corresponding
" after directory. Curly braces are expanded with pathogen#expand().
function! pathogen#surround(path) abort
let sep = pathogen#slash()
let rtp = pathogen#split(&rtp)
let path = fnamemodify(a:path, ':p:?[\\/]\=$??')
let before = filter(pathogen#expand(path), '!pathogen#is_disabled(v:val)')
let after = filter(reverse(pathogen#expand(path.sep.'after')), '!pathogen#is_disabled(v:val[0:-7])')
call filter(rtp, 'index(before + after, v:val) == -1')
let &rtp = pathogen#join(before, rtp, after)
return &rtp
endfunction
" For each directory in the runtime path, add a second entry with the given
" argument appended. Curly braces are expanded with pathogen#expand().
function! pathogen#interpose(name) abort
let sep = pathogen#slash()
let name = a:name
if has_key(s:done_bundles, name)
return ""
endif
let s:done_bundles[name] = 1
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += reverse(filter(pathogen#expand(dir[0:-6].name.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])')) + [dir]
else
let list += [dir] + filter(pathogen#expand(dir.sep.name), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction
let s:done_bundles = {}
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() abort
let sep = pathogen#slash()
for glob in pathogen#split(&rtp)
for dir in map(split(glob(glob), "\n"), 'v:val.sep."/doc/".sep')
if (dir)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir) == 2 && !empty(split(glob(dir.'*.txt'))) && (!filereadable(dir.'tags') || filewritable(dir.'tags'))
silent! execute 'helptags' pathogen#fnameescape(dir)
endif
endfor
endfor
endfunction
command! -bar Helptags :call pathogen#helptags()
" Execute the given command. This is basically a backdoor for --remote-expr.
function! pathogen#execute(...) abort
for command in a:000
execute command
endfor
return ''
endfunction
" Section: Unofficial
function! pathogen#is_absolute(path) abort
return a:path =~# (has('win32') ? '^\%([\\/]\|\w:\)[\\/]\|^[~$]' : '^[/~$]')
endfunction
" Given a string, returns all possible permutations of comma delimited braced
" alternatives of that string. pathogen#expand('/{a,b}/{c,d}') yields
" ['/a/c', '/a/d', '/b/c', '/b/d']. Empty braces are treated as a wildcard
" and globbed. Actual globs are preserved.
function! pathogen#expand(pattern) abort
if a:pattern =~# '{[^{}]\+}'
let [pre, pat, post] = split(substitute(a:pattern, '\(.\{-\}\){\([^{}]\+\)}\(.*\)', "\\1\001\\2\001\\3", ''), "\001", 1)
let found = map(split(pat, ',', 1), 'pre.v:val.post')
let results = []
for pattern in found
call extend(results, pathogen#expand(pattern))
endfor
return results
elseif a:pattern =~# '{}'
let pat = matchstr(a:pattern, '^.*{}[^*]*\%($\|[\\/]\)')
let post = a:pattern[strlen(pat) : -1]
return map(split(glob(substitute(pat, '{}', '*', 'g')), "\n"), 'v:val.post')
else
return [a:pattern]
endif
endfunction
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#slash() abort
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction
function! pathogen#separator() abort
return pathogen#slash()
endfunction
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#slash()."/]$","","")')
endfunction "}}}1
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1
" Remove duplicates from a list.
function! pathogen#uniq(list) abort
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
" Backport of fnameescape().
function! pathogen#fnameescape(string) abort
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction
" 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
" Section: Deprecated
function! s:warn(msg) abort
echohl WarningMsg
echomsg a:msg
echohl NONE
endfunction
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories. Deprecated.
function! pathogen#runtime_prepend_subdirectories(path) abort
call s:warn('Change pathogen#runtime_prepend_subdirectories('.string(a:path).') to pathogen#infect('.string(a:path.'/{}').')')
return pathogen#surround(a:path . pathogen#slash() . '{}')
endfunction
function! pathogen#incubate(...) abort
let name = a:0 ? a:1 : 'bundle/{}'
call s:warn('Change pathogen#incubate('.(a:0 ? string(a:1) : '').') to pathogen#infect('.string(name).')')
return pathogen#interpose(name)
endfunction
" Deprecated alias for pathogen#interpose().
function! pathogen#runtime_append_all_bundles(...) abort
if a:0
call s:warn('Change pathogen#runtime_append_all_bundles('.string(a:1).') to pathogen#infect('.string(a:1.'/{}').')')
else
call s:warn('Change pathogen#runtime_append_all_bundles() to pathogen#infect()')
endif
return pathogen#interpose(a:0 ? a:1 . '/{}' : 'bundle/{}')
endfunction
if exists(':Vedit')
finish
endif
let s:vopen_warning = 0
function! s:find(count,cmd,file,lcd)
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
function! s:Findcomplete(A,L,P)
let sep = pathogen#slash()
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
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 foldmethod=expr foldexpr=getline(v\:lnum)=~'^\"\ Section\:'?'>1'\:getline(v\:lnum)=~#'^fu'?'a1'\:getline(v\:lnum)=~#'^endf'?'s1'\:'=':

View file

@ -1,162 +0,0 @@
set background=light
hi clear
if exists("syntax_on")
syntax reset
endif
"""""""""""""""""""""""""""""
"
" Terminal colours cheatsheet
"
" 0: black
" 1: red (errors)
" 2: green (comments)
" 3: yellow (search)
" 4: blue
" 5: magenta (current)
" 4: cyan (scalars)
" 7: white (default)
"
" +8 for bright colours.
"
"""""""""""""""""""""""""""""
let g:colors_name = "maxbucknell"
" Make everything white by default
hi Normal cterm=NONE ctermfg=7 ctermbg=NONE
hi Type cterm=NONE ctermfg=7 ctermbg=NONE
hi Keyword cterm=NONE ctermfg=7 ctermbg=NONE
hi Operator cterm=NONE ctermfg=7 ctermbg=NONE
hi Special cterm=NONE ctermfg=7 ctermbg=NONE
hi Statement cterm=NONE ctermfg=7 ctermbg=NONE
hi Identifier cterm=NONE ctermfg=7 ctermbg=NONE
hi Constant cterm=NONE ctermfg=7 ctermbg=NONE
hi Define cterm=NONE ctermfg=7 ctermbg=NONE
hi Include cterm=NONE ctermfg=7 ctermbg=NONE
hi Macro cterm=NONE ctermfg=7 ctermbg=NONE
" Residual Less colors
hi lessFunction cterm=NONE ctermfg=7 ctermbg=NONE
hi lessCssAttribute cterm=NONE ctermfg=7 ctermbg=NONE
" Residual Vim colors
hi VimSet cterm=NONE ctermfg=7 ctermbg=NONE
hi VimOption cterm=NONE ctermfg=7 ctermbg=NONE
hi VimHiAttrib cterm=NONE ctermfg=7 ctermbg=NONE
" Residual Zsh colors
hi ZshDeref cterm=NONE ctermfg=7 ctermbg=NONE
hi ZshShortDeref cterm=NONE ctermfg=7 ctermbg=NONE
hi ZshSubstDelim cterm=NONE ctermfg=7 ctermbg=NONE
" Residual XML colors
hi xmlProcessingDelim cterm=NONE ctermfg=7 ctermbg=NONE
hi xmlAttribPunct cterm=NONE ctermfg=7 ctermbg=NONE
" Residual Markdown colors
hi markdownH1 cterm=NONE ctermbg=NONE ctermfg=7
hi markdownH2 cterm=NONE ctermbg=NONE ctermfg=7
hi markdownH3 cterm=NONE ctermbg=NONE ctermfg=7
hi markdownH4 cterm=NONE ctermbg=NONE ctermfg=7
hi markdownH5 cterm=NONE ctermbg=NONE ctermfg=7
hi markdownH4 cterm=NONE ctermbg=NONE ctermfg=7
hi markdownBlockQuote cterm=NONE ctermbg=NONE ctermfg=7
" Residual HTML
hi htmlTitle cterm=NONE ctermbg=NONE ctermfg=7
" Miscellaneous leftovers
hi helpNote cterm=NONE ctermfg=7 ctermbg=NONE
hi MatchParen cterm=NONE ctermfg=7 ctermbg=5
" Scalars are cyan
hi String cterm=NONE ctermfg=4 ctermbg=NONE
hi Number cterm=NONE ctermfg=4 ctermbg=NONE
hi Boolean cterm=NONE ctermfg=4 ctermbg=NONE
hi phpHereDoc cterm=NONE ctermfg=4 ctermbg=NONE
hi phpNowDoc cterm=NONE ctermfg=4 ctermbg=NONE
hi phpBackslashSequences cterm=NONE ctermfg=4 ctermbg=NONE
" Comments are green
hi Comment cterm=NONE ctermfg=2 ctermbg=NONE
" Todos are almost green
hi Todo cterm=NONE ctermfg=0 ctermbg=2
" Preprocessor statements aren't comments.
hi PreProc cterm=NONE ctermfg=7 ctermbg=NONE
" JSDoc comments are comments.
hi jsDocTags cterm=NONE ctermfg=2 ctermbg=NONE
hi jsDocType cterm=NONE ctermfg=2 ctermbg=NONE
hi jsDocParam cterm=NONE ctermfg=2 ctermbg=NONE
hi jsDocTypeNoParam cterm=NONE ctermfg=2 ctermbg=NONE
hi jsDocSeeTag cterm=NONE ctermfg=2 ctermbg=NONE
" PHPDoc comments are comments.
hi phpDocTags cterm=NONE ctermfg=2 ctermbg=NONE
hi phpDocCustomTags cterm=NONE ctermfg=2 ctermbg=NONE
" Line numbers are grey
hi LineNr cterm=NONE ctermfg=7 ctermbg=NONE
" Current search result yellow
hi Search cterm=NONE ctermfg=0 ctermbg=3
hi MBSearchNext cterm=NONE ctermfg=0 ctermbg=3
" Errors are red
" Make current line magenta
hi CursorLine cterm=NONE ctermfg=4 ctermbg=NONE
hi CursorLineNr cterm=NONE ctermfg=4 ctermbg=NONE
""""""""
" Visual
""""""""
hi Visual cterm=NONE ctermbg=7 ctermfg=0
"""""""""""""
" Status Line
"""""""""""""
hi StatusLine cterm=NONE ctermfg=7 ctermbg=4
hi StatusLineNC cterm=NONE ctermfg=0 ctermbg=7
"""""""
" Signs
"""""""
hi SignColumn cterm=NONE ctermbg=0 ctermfg=0
""""""""
" Vdebug
""""""""
hi DbgBreakptLine cterm=NONE ctermfg=5 ctermbg=NONE
hi DbgBreakptSign cterm=NONE ctermfg=5 ctermbg=5
hi DbgCurrentLine cterm=NONE ctermfg=7 ctermbg=5
hi DbgCurrentSign cterm=NONE ctermfg=5 ctermbg=5
"""""
" Ale
"""""
hi ALEWarningSign cterm=NONE ctermbg=3 ctermfg=3
hi ALEErrorSign cterm=NONE ctermbg=1 ctermfg=1
"""""""""""
" UltiSnips
"""""""""""
hi snipLeadingSpaces cterm=NONE ctermbg=0 ctermfg=NONE
hi snipTabStop cterm=NONE ctermbg=NONE ctermfg=4
hi snipTabStopDefault cterm=NONE ctermbg=NONE ctermfg=4
""""""""""""
" Long lines
""""""""""""
hi ColorColumn cterm=NONE ctermbg=1 ctermfg=NONE

View file

@ -1,96 +0,0 @@
" Language: xml
" Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change: 2012 Jul 25
" Notes: 1) does not indent pure non-xml code (e.g. embedded scripts)
" 2) will be confused by unbalanced tags in comments
" or CDATA sections.
" 2009-05-26 patch by Nikolai Weibull
" TODO: implement pre-like tags, see xml_indent_open / xml_indent_close
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
let s:keepcpo= &cpo
set cpo&vim
" [-- local settings (must come before aborting the script) --]
setlocal indentexpr=XmlIndentGet(v:lnum,1)
setlocal indentkeys=o,O,*<Return>,<>>,<<>,/,{,}
" [-- check if it's xml --]
fun! <SID>XmlIndentSynCheck(lnum)
if '' != &syntax
let syn1 = synIDattr(synID(a:lnum, 1, 1), 'name')
let syn2 = synIDattr(synID(a:lnum, strlen(getline(a:lnum)) - 1, 1), 'name')
if '' != syn1 && syn1 !~ 'xml' && '' != syn2 && syn2 !~ 'xml'
" don't indent pure non-xml code
return 0
elseif syn1 =~ '^xmlComment' && syn2 =~ '^xmlComment'
" indent comments specially
return -1
endif
endif
return 1
endfun
fun! XmlPrevLine(line)
" 'Checking previous line:'
if (match(a:line, '^<?.*?>') != -1)
" 'Doctype'
return 0
elseif (match(a:line, '/>') != -1) || (match(a:line, '</') != -1)
" 'Is closing tag line, no change below.'
return 0
elseif (match(a:line, '<') != -1) || (match(a:line, '>') != -1)
" 'Is opening tag, time to indent.'
return 1
else
" 'No change'
return 0
endif
endfun
fun! XmlCurrentLine(line)
" 'Checking current line:'
if (match(a:line, '^\s*/\{0,1}>') != -1) || (match(a:line, '^\s*</') != -1)
" 'Is closing tag line'
return -1
else
" 'Is normal line, no change'
return 0
endif
endfun
fun! XmlIndentGet(lnum, use_syntax_check)
" Find a non-empty line above the current line.
let lnum = prevnonblank(a:lnum - 1)
" Hit the start of the file, use zero indent.
if lnum == 0
return 0
endif
if a:use_syntax_check
let check_lnum = <SID>XmlIndentSynCheck(lnum)
let check_alnum = <SID>XmlIndentSynCheck(a:lnum)
if 0 == check_lnum || 0 == check_alnum
return indent(a:lnum)
elseif -1 == check_lnum || -1 == check_alnum
return -1
endif
endif
let cur = getline(a:lnum)
let pre = getline(lnum)
let ind = indent(lnum) + &sw * (XmlPrevLine(pre) + XmlCurrentLine(cur))
return ind
endfun
let &cpo = s:keepcpo
unlet s:keepcpo
" vim:ts=8

View file

@ -1,503 +1 @@
" Max's .vimrc
""""""""""""""""""""""
" Plugins
""""""""""""""""""""""
execute pathogen#infect()
""""""""""""""""""""""
" Basic editing config
""""""""""""""""""""""
set term=xterm-256color
set nocompatible
colorscheme maxbucknell
" Leader
"
" Using space as leader is actually a terrific idea. It's one of the
" easiest things to hit on the keyboard.
let mapleader = "\<space>"
" Don't wrap lines
"
" I look at a lot of CSV files and logs, which are generally the only
" times I see long lines. If code is too long, I shorten it. As such,
" having lines artificially wrapping only gets in my way.
set nowrap
" Line numbering
"
" This shows the real line number of the current line, and relative
" line numbers on the other lines. Relative line numbers are good to
" know how many lines to yank, delete, or move.
set number
set relativenumber
" Write before commands
"
" This means that if I have unsaved changes, they get saved before
" executing a git commit, or something like that.
set autowrite
" Open splits in better places
"
" This seems to be the most logical way to split, in the direction
" that we read, and in agreement with Tmux.
set splitbelow
set splitright
" Quicker window movement
"
" Just remove an extra keystroke
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Set editor shell to bash, for Syntastic compatibility
set shell=bash
" Allow visual block mode to select anywhere.
"
" I want to use this to manage my ascii drawings
set virtualedit=block
" Swap block and visual block
nnoremap v <C-V>
nnoremap <C-V> v
vnoremap v <C-V>
vnoremap <C-V> v
" Automatically read on update
set autoread
" I am always adding /g. No longer, suckers!
set gdefault
" Set comment line length
set tw=72
set fo=c
" Navigate to test, and back
" Find test counterpart.
"
" This works by replacing src/ with test/, and test/ with src/
function! FindTestFilename(filename)
" Replace src/ with t_est/
let first = substitute(a:filename, 'src/', 't_est/', '')
" Replace test/ with src/
let second = substitute(first, 'test/', 'src/', '')
" Replace t_est/ with test/
let third = substitute(second, 't_est/', 'test/', '')
return third
endfunction
nnoremap <c-t> :exec ":e " . FindTestFilename(expand('%')) <cr>
" Run a given vim command on the results of fuzzy selecting from a given shell
" command. See usage below.
function! SelectaCommand(choice_command, selecta_args, vim_command)
try
let selection = system(a:choice_command . " | selecta " . a:selecta_args)
catch /Vim:Interrupt/
" Swallow the ^C so that the redraw below happens; otherwise there will be
" leftovers from selecta on the screen
redraw!
return
endtry
redraw!
exec a:vim_command . " " . selection
endfunction
" Find all files in all non-dot directories starting in the working directory.
" Fuzzy select one of those. Open the selected file with :e.
nnoremap <leader>t :call SelectaCommand("find * -type f", "", ":e")<cr>
" Git blame
"
" I used to do this by just filling in my buffer, but this is nicer.
nnoremap <leader>a :Gblame<cr>
" Tab config options
"
" In general, I prefer spaces to tabs, and 2-space indentation. These
" settings just make that consistent, so I rarely have to think about
" it.
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
" Disable creation of swap files.
"
" Swap files serve a purpose, but not to me. I write often, and so
" these just get in the way.
set nobackup
set nowritebackup
set noswapfile
" What the hell is ex mode
"
" Whatever it is, I don't like it.
nnoremap Q <nop>
" Faster highlight removal than ;noh
"
" :noh is the command one should run to remove highlighted search
" terms. I search for things so often, that I got sick of typing it
" so much. So I made a short cut.
nnoremap <silent> <leader>/ :noh<cr>
" Remap semi-colon to colon.
"
" Colon is the starting point of a lot of actions in Vim. And I
" shouldn't have to hold a modifier key to access so much
" essential functionality.
noremap ; :
noremap ;; ;
" Quick exit insert mode
"
" Escape is at the far corner of my keyboard, and having it so far away
" was discouraging my from exiting insert mode. Qwerty users can remap
" jk to <esc>, which is a far better solution. The keys are next to each
" other, and it makes exiting insert mode a pleasant rolling motion.
" Moreover, when in normal mode, jk is a no-op.
"
" As a dvorak user, jk was too cumbersome, but there were no other
" suitable candidates. hh is inferior in that it is not a no-op in
" normal mode, but it is just as easy to type. The only caveat is when
" an edit ends with h, which is why hhh will expand to place an h in
" the buffer before exiting.
"
" To encourage me to adopt the new style, I disable escape. That one is
" sure to mess up someone not familiar with my setup.
inoremap hh <esc>
inoremap hhh h<esc>
" inoremap <esc> <nop>
inoremap uu \
" Bad arrow keys
"
" This will disable use of arrow keys in normal and insert modes. This
" is a good idea to get into the vim way. I dont really use the arrow
" keys anymore.
"
" That said, I have reservations about the apparently egregious nature
" of the arrow keys. On my MacBook, they are quite close. Still, I can
" understand that it is better to rely only on the core keys that you
" know are within reach, not just the ones that happen to be on one
" computer.
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
noremap <up> <nop>
noremap <down> <nop>
noremap <left> <nop>
noremap <right> <nop>
" Move lines up and down
"
" These are very useful commands, especially for re-ordering things. I
" would like to make it possible to move hunks of code with similar
" shortcuts, but I haven't thought it through yet. I would also like
" to have something automated, wherein I could sort a list of things
" alphabetically.
noremap - ddp
noremap _ ddkP
" Uppercase an entire word.
"
" This is handy for things like constants. I have no caps lock, and
" holding shift can be a pain.
nnoremap <leader>u viwU
" Show me when my lines are too long
"
" I wish to limit my lines to 80 characters long. However, Vim creates
" the n+1th character when you have n characters in a line. Hence, when
" my line is 80 characters long, I see the red line. So, this is set to
" 82, meaning that I only see the line when my lines actually are too long.
call matchadd('ColorColumn', '\%82v', 100)
" Prevent K from being annoying
noremap K <nop>
" Edit and Reload .vimrc files
"
" When I hit something that bugs me, I usually think about what I can
" do to make it better. Then I forget. This keeps happening and I keep
" getting annoyed. These commands make it simple to quickly edit my
" vimrc, and then reload it.
nmap <silent> <Leader>ev :e $MYVIMRC<CR>
nmap <silent> <Leader>es :so $MYVIMRC<CR>
" Search options
"
" Show partial matches while searching
set incsearch
" Highlight other matches in the file
set hlsearch
" Show the next search result.
" By Damian Conway.
"
" This rewires n and N to do their normal thing, and then call the
" HLNext routine. This temporarily adds a new style to the next
" highlight.
nnoremap <silent> n n:call HLNext(0.2)<cr>
nnoremap <silent> N N:call HLNext(0.2)<cr>
" Blink the next match
function! HLNext (blinktime)
let [bufnum, lnum, col, off] = getpos('.')
let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))
let target_pat = '\c\%#'.@/
let ring = matchadd('MBSearchNext', target_pat, 101)
redraw
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
call matchdelete(ring)
redraw
endfunction
" Disable match-paren
"
" It has really bad colours and it displays terribly.
" let loaded_matchparen = 1
" Make searches case sensitive only if an upper case character has been typed
set ignorecase smartcase
" Prevent Vim from clobbering the scrollback buffer.
"
" This means that all of Vim's output is shown in the terminal screen
" history. This is ugly, but it's saved my bacon a few times. See
" http://www.shallowsky.com/linux/noaltscreen.html
set t_ti= t_te=
" Highlight current line
"
" It's good to have a sense of place.
set cursorline
" Ensure that the cursor never touches top or bottom of screen
"
" This controls the distance that the current line must maintain
" between the top and bottom of the screen. Setting this to a very
" large number will always keep the cursor vertically centered.
"
" I don't do this, because sometimes I wish to see something at the
" bottom of the buffer, so I can copy it at the top.
set scrolloff=4
" Allow backspacing over everything in insert mode
"
" By default, Vim will stop when it gets to the beginning of a line,
" throw its arms in the air and give up.
set backspace=indent,eol,start
" Display incomplete commands and the lines they apply to.
set showcmd
" Allow hidden buffers
"
" If this is off, buffers are destroyed when they fade out of view. We
" have the memory to spare to keep them around.
set hidden
" Enable highlighting for syntax
syntax on
" 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
" Insert only one space when joining lines that contain
" sentence-terminating punctuation like `.`.
set nojoinspaces
" If a file is changed outside of vim, automatically reload it
set autoread
" Show trailing whitespace, since it's a crime
set list
set listchars=trail:·,tab:‣\
" Turn off code folding
"
" I hate code folding. It makes me mad. I just want a buffer with all
" of my text in it, no funny business.
set foldmethod=manual
set nofoldenable
let g:vim_markdown_folding_disabled=1
let g:vimtex_fold_enabled=0
" Always show status bar
set laststatus=2
" Pastetoggle to let Vim paste things without auto stuff
set pastetoggle=<F2>
""""""""""""""""""
" Ultisnips, y'all
""""""""""""""""""
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<S-tab>"
""""""""
" VDebug
""""""""
let g:vdebug_options={}
let g:vdebug_options['break_on_open']=1
let g:vdebug_options['ide_key']='docker'
let g:vdebug_options['port']=9000
let g:vdebug_options['timeout']=300
let g:vdebug_options['path_maps']={
\'/mnt/www': getcwd()
\}
"""""""""""""
" Local vimrc
"""""""""""""
" Just load automatically, never ask me.
let g:localvimrc_ask=0
""""""""
" Python
""""""""
let g:pymode_python = 'python3'
"""""""""""""""""
" Custom autocmds
"""""""""""""""""
augroup vimrcEx
" Clear all autocmds in the group
autocmd!
autocmd FileType text setlocal textwidth=78
" Jump to last cursor position unless it's invalid or in an event handler
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Language whitespace settings
autocmd FileType dockerfile,less,snippets,json,c,xml,java,php,python setl et sw=4 sts=4
autocmd FileType make,markdown setl noet sw=8 sts=8 ts=8
" Hard wrap prose
"
" This will automatically insert a new line in insert mode when a
" line gets too long (above 80 characters). I can also run gqap
" in normal mode to reflow a paragraph.
autocmd FileType
\ markdown,
\ setl tw=80 fo=t1
augroup END
" Make directories in a filename if they don't exist.
function! AskQuit (msg, options, quit_option)
if confirm(a:msg, a:options) == a:quit_option
exit
endif
endfunction
function! EnsureDirExists ()
let required_dir = expand("%:h")
if !isdirectory(required_dir)
try
call mkdir( required_dir, 'p' )
catch
echom "Could not create directory"
exit
endtry
endif
endfunction
augroup AutoMkdir
autocmd!
autocmd BufNewFile * :call EnsureDirExists()
augroup END
" Set the statusline.
" This shows something like:
"
" [vim/vimrc.symlink] [351,30] [vim]
set statusline=[%f] " filename
set statusline+=\ [%l,\ %c] "line and column number
set statusline+=\ %y " filetype
set statusline+=\ %{ALEGetStatusLine()}
" Ale
"
" An asynchronous linting engine.
let g:ale_lint_on_text_changed = 1
let g:ale_linters = {
\ 'javascript': [ 'eslint' ],
\ 'php': [ 'php', 'phpcs' ],
\ 'json': [ 'jsonlint' ]
\ }
" Hallelujah!
let g:ale_set_signs = 1
let g:ale_sign_column_always = 1
let g:ale_sign_error = '--'
let g:ale_sign_warning = '--'
let g:ale_php_phpcs_standard = 'PSR2'
let g:ale_javascript_eslint_options = '--no-ignore '
" Gitgutter
let g:gitgutter_realtime = 1
let g:gitgutter_eager = 1
" JSX in mah JavaScript
let g:jsx_ext_required = 0
" Copy visual selection to clipboard.
noremap <leader>y "*y
" Go to most recently edited file
nnoremap <leader><leader> <c-^>
" Disable syntax hiding in JSON
"
" Vim JSON provides a fancy way of viewing, where it hides quotes and
" just shows you data. I don't want that.
let g:vim_json_syntax_conceal = 0
" Show syntax highlighting groups for word under cursor
"
" This is useful for finding rogue elements I forgot in my colour
" scheme.
nnoremap <leader>\ :call <SID>SynStack()<CR>
function! <SID>SynStack()
if !exists("*synstack")
return
endif
echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")')
endfunc