Add some windows stuff

This commit is contained in:
AdeAttwood 2016-11-30 09:35:05 +00:00
parent f1d9b1921b
commit f3cfa13ead
10 changed files with 661 additions and 5 deletions

Binary file not shown.

View file

@ -0,0 +1,172 @@
snippet input "Input with Label" w
<label for="${2:${1/[[:alpha:]]+|( )/(?1:_:\L$0)/g}}">$1</label><input type="${3:text/submit/hidden/button}" name="${4:$2}" value="$5"${6: id="${7:$2}"}`!p x(snip)`>
endsnippet
snippet input "XHTML <input>" w
<input type="${1:text/submit/hidden/button}" name="${2:some_name}" value="$3"${4: id="${5:$2}"}`!p x(snip)`>
endsnippet
snippet opt "Option" w
<option${1: value="${2:option}"}>${3:$2}</option>
endsnippet
snippet select "Select Box" w
<select name="${1:some_name}" id="${2:$1}"${3:${4: multiple}${5: onchange="${6:}"}${7: size="${8:1}"}}>
${0:${VISUAL}}
</select>
endsnippet
snippet textarea "XHTML <textarea>" w
<textarea name="${1:Name}" rows="${2:8}" cols="${3:40}">$0</textarea>
endsnippet
snippet mailto "XHTML <a mailto: >" w
<a href="mailto:${1:joe@example.com}?subject=${2:feedback}">${3:email me}</a>
endsnippet
snippet base "XHTML <base>" w
<base href="$1"${2: target="$3"}`!p x(snip)`>
endsnippet
snippet body "<body>"
<body>
${0:${VISUAL}}
</body>
endsnippet
snippet div "<div>" w
<div>
${0:${VISUAL}}
</div>
endsnippet
snippet div. "<div> with class" w
<div`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`>
${0:${VISUAL}}
</div>
endsnippet
snippet div# "<div> with ID & class" w
<div`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`>
${0:${VISUAL}}
</div>
endsnippet
snippet form "XHTML <form>" w
<form action="${1:`!p
snip.rv = (snip.basename or 'unnamed') + '_submit'
`}" method="${2:get}" accept-charset="utf-8">
${0:${VISUAL}}
</form>
endsnippet
snippet h1 "XHTML <h1>" w
<h1>${0:${VISUAL}}</h1>
endsnippet
snippet h2 "XHTML <h2>" w
<h2>${0:${VISUAL}}</h2>
endsnippet
snippet h3 "XHTML <h3>" w
<h3>${0:${VISUAL}}</h3>
endsnippet
snippet h4 "XHTML <h4>" w
<h4>${0:${VISUAL}}</h4>
endsnippet
snippet h5 "XHTML <h5>" w
<h5>${0:${VISUAL}}</h5>
endsnippet
snippet h6 "XHTML <h6>" w
<h6>${0:${VISUAL}}</h6>
endsnippet
snippet link "XHTML <link>" w
<link rel="${1:stylesheet}" href="${2:/css/master.css}" type="text/css" media="${3:screen}" title="${4:no title}" charset="${5:utf-8}"`!p x(snip)`>
endsnippet
snippet meta "XHTML <meta>" w
<meta name="${1:name}" content="${2:content}"`!p x(snip)`>
endsnippet
snippet scriptsrc "XHTML <script src...>" w
<script src="$1" type="text/javascript" charset="${3:utf-8}"></script>
endsnippet
snippet script "XHTML <script>" w
<script type="text/javascript" charset="utf-8">
${0:${VISUAL}}
</script>
endsnippet
snippet span "<span>" w
<span> ${0:${VISUAL}} </span>
endsnippet
snippet span. "<span> with class" w
<span`!p snip.rv=' class="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""`> ${0:${VISUAL}} </span>
endsnippet
snippet span# "<span> with ID & class" w
<span`!p snip.rv=' id="' if t[1] else ""`${1:name}`!p snip.rv = '"' if t[1] else ""``!p snip.rv=' class="' if t[2] else ""`${2:name}`!p snip.rv = '"' if t[2] else ""`> ${0:${VISUAL}} </span>
endsnippet
snippet style "XHTML <style>" w
<style type="text/css" media="screen">
${0:${VISUAL}}
</style>
endsnippet
snippet table "XHTML <table>" w
<table>
${0:${VISUAL}}
</table>
endsnippet
snippet a "Link" w
<a href="${1:http://www.${2:url.com}}"${3: target="_blank"}>${4:Anchor Text}</a>
endsnippet
snippet p "paragraph" w
<p>${0:${VISUAL}}</p>
endsnippet
snippet li "list item" w
<li>${0:${VISUAL}}</li>
endsnippet
snippet ul "unordered list" w
<ul>
${0:${VISUAL}}
</ul>
endsnippet
snippet td "table cell" w
<td>${0:${VISUAL}}</td>
endsnippet
snippet th "table header" w
<th>${0:${VISUAL}}</th>
endsnippet
snippet tr "table row" w
<tr>${0:${VISUAL}}</tr>
endsnippet
snippet title "XHTML <title>" w
<title>${1:`!p snip.rv = snip.basename or "Page Title"`}</title>
endsnippet
snippet fieldset "Fieldset" w
<fieldset id="${1/[\w\d]+|( )/(?1:_:\L$0\E)/g}" ${2:class="${3:}"}>
<legend>$1</legend>
${0:${VISUAL}}
</fieldset>
endsnippet

View file

@ -0,0 +1,43 @@
snippet php "php tag" i
<?php $1 ?>
endsnippet
snippet phpe "php echo tag" i
<?= $1 ?>
endsnippet
snippet phpif "php if statment" b
<?php if($1): ?>
$2
<?php endif; ?>
endsnippet
snippet phpife "php if else statment" b
<? if ($1): ?>
$2
<? else: ?>
$3
<? endif; ?>
endsnippet
snippet phpifeif "php if else if statment" b
<? if ($1): ?>
$2
<? elseif ($3): ?>
$4
<? else: ?>
$5
<? endif; ?>
endsnippet
snippet phpfe "php foreach" b
<?php foreach(${1:$array} as ${2:$key}=>${3:$value}): ?>
$4
<?php endforeach; ?>
endsnippet
snippet phpf "php for loop" b
<?php for ($i = ${1:1}; $i <= ${2:count}; $i++): ?>
$3
<?php endfor; ?>
endsnippet

View file

@ -0,0 +1,187 @@
snippet - "" i
->$1
endsnippet
snippet = "" i
=>
endsnippet
snippet this "Description" b
$this->$1
endsnippet
snippet pr "Dumb debug helper in HTML"
echo '<pre>' . var_export($1, 1) . '</pre>';$0
endsnippet
snippet pub "Public function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
public function ${1:name}(${2:$param})
{
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pro "Protected function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
protected function ${1:name}(${2:$param})
{
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pri "Private function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
private function ${1:name}(${2:$param})
{
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pubs "Public static function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
public static function ${1:name}(${2:$param})
{
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pros "Protected static function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
protected static function ${1:name}(${2:$param})
{
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet pris "Private static function" b
/**
* ${3:undocumented function}
*
* @return ${4:void}
*/
private static function ${1:name}(${2:$param})
{
${VISUAL}${5:return null;}
}
$0
endsnippet
snippet new "New class instance" b
$${1:variableName} = new ${2:${1/\w+\s*/\u$0/}}($3);
$0
endsnippet
snippet ns "namespace declaration" b
namespace ${1:`!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
endsnippet
snippet class "Class declaration template" b
<?php
namespace ${1:`!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
/**
* Class ${1:`!p snip.rv=snip.basename`}
* @author ${2:`!v g:snips_author`}
*/
class $1
{
}
endsnippet
snippet interface "Interface declaration template" b
<?php
namespace ${1:`!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
/**
* Interface ${1:`!p snip.rv=snip.basename`}
* @author ${2:`!v g:snips_author`}
*/
interface $1
{
public function ${3:someFunction}();$4
}
endsnippet
snippet construct "__construct()" b
/**
* @param $2mixed ${1/, /\n * \@param mixed /g}
*/
public function __construct(${1:$dependencies})
{${1/\$(\w+)(, )*/\n $this->$1 = $$1;/g}
}
$0
endsnippet
# PHPUnit snippets
snippet testcase "class XYZTest extends \PHPUnit_Framework_TestCase { ... }"
<?php
namespace `!p
relpath = os.path.relpath(path)
m = re.search(r'[A-Z].+(?=/)', relpath)
if m:
snip.rv = m.group().replace('/', '\\')
`;
/**
* @author `!v g:snips_author`
*/
class `!p
snip.rv = re.match(r'.*(?=\.)', fn).group()
` extends \PHPUnit_Framework_TestCase
{
public function test${1}()
{
${0:${VISUAL}}
}
}
endsnippet

View file

@ -0,0 +1,43 @@
snippet php "php tag" i
<?php $1 ?>
endsnippet
snippet phpe "php echo tag" i
<?= $1 ?>
endsnippet
snippet phpif "php if statment" b
<?php if($1): ?>
$2
<?php endif; ?>
endsnippet
snippet phpife "php if else statment" b
<? if ($1): ?>
$2
<? else: ?>
$3
<? endif; ?>
endsnippet
snippet phpifeif "php if else if statment" b
<? if ($1): ?>
$2
<? elseif ($3): ?>
$4
<? else: ?>
$5
<? endif; ?>
endsnippet
snippet phpfe "php foreach" b
<?php foreach(${1:$array} as ${2:$key}=>${3:$value}): ?>
$4
<?php endforeach; ?>
endsnippet
snippet phpf "php for loop" b
<?php for ($i = ${1:1}; $i <= ${2:count}; $i++): ?>
$3
<?php endfor; ?>
endsnippet

View file

@ -0,0 +1,14 @@
snippet yiifk "migration foreign key" b
/*
* FOREIGN KEY : ${1:Table}.${2:Field}
* REFERENCES : ${3:Reference Table}.${4:Reference Field}
*/
$this->addForeignKey(
'fk-$1-$2',
'$1',
'$2',
'$3',
'$4',
'CASCADE'
);
endsnippet

View file

@ -0,0 +1,17 @@
# We use a little hack so that the snippet is expanded
# and parsed correctly
snippet snip "Snippet definition" b
`!p snip.rv = "snippet"` ${1:Tab_trigger} "${2:Description}" ${3:b}
$0
`!p snip.rv = "endsnippet"`
endsnippet
snippet global "Global snippet" b
`!p snip.rv = "global"` !p
$0
`!p snip.rv = "endglobal"`
endsnippet
snippet vis "${VISUAL}" i
\$\{VISUAL${1:${2:default}${3:/transform/}}\}
endsnippet

View file

@ -128,14 +128,10 @@ set encoding=utf-8
" plugins
" --------------------------------------------------------------------------------
" php complete
let $PATH=$PATH . ':' . expand('~/.config/composer/vendor/bin')
let g:padawan#composer_command = "composer"
" ultisnips
let g:UltiSnipsSnippetsDir = "~/.vim/UltiSnips"
let g:snips_author = "AdeAttwood"
let g:snips_email = "attwood16@gmail.com"
let g:snips_email = "attwood16@googlemail.com"
" vimwiki
let g:vimwiki_list = [{

184
dotfiles/vimrc_win Normal file
View file

@ -0,0 +1,184 @@
" important
" --------------------------------------------------------------------------------
call pathogen#infect()
set nocompatible
set runtimepath^=%homepath%\vimfiles\bundle\ctrlp.vim
filetype plugin off
set t_Co=256
" --------------------------------------------------------------------------------
" not sorted
" --------------------------------------------------------------------------------
autocmd BufNewFile,BufRead *.phtml set ft=html
set guifont=Consolas:h12:cANSI
colorscheme desert
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
set showmatch
set incsearch
set hlsearch
" --------------------------------------------------------------------------------
" tags
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" displaying text
" --------------------------------------------------------------------------------
set linebreak
set nowrap
set nu
set rnu
" --------------------------------------------------------------------------------
" highlighting and spelling
" --------------------------------------------------------------------------------
set cursorline
syntax on
" --------------------------------------------------------------------------------
" multiple windows
" --------------------------------------------------------------------------------
set laststatus=2
" --------------------------------------------------------------------------------
" multiple tab pages
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" terminal
" --------------------------------------------------------------------------------
set title
" --------------------------------------------------------------------------------
" using the mouse
" --------------------------------------------------------------------------------
"set mouse=a
" --------------------------------------------------------------------------------
" printing
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" messages and info
" --------------------------------------------------------------------------------
set ruler
set showcmd
" --------------------------------------------------------------------------------
" selecting text
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" editing text
" --------------------------------------------------------------------------------
set matchpairs+=<:>
" --------------------------------------------------------------------------------
" tabs and indenting
" --------------------------------------------------------------------------------
set tabstop=4
set shiftwidth=4
set expandtab
set autoindent
filetype plugin indent on
" --------------------------------------------------------------------------------
" folding
" --------------------------------------------------------------------------------
set foldmethod=indent
set foldlevel=1
set foldnestmax=2
"set nofen
" --------------------------------------------------------------------------------
" diff mode
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" mapping
" --------------------------------------------------------------------------------
inoremap EE <esc>$a
inoremap ;; <esc>$a;
inoremap jj <esc>:w<cr>
nnoremap <Leader>p :set paste<CR>o<esc>"*]p:set nopaste<cr>"
nnoremap <Leader>b :ls<CR>:b
nmap <silent> <Leader>o :NERDTreeToggle<CR>
nmap <silent> <Leader>s ]sz=
nmap <Leader>r :BLReloadPage<cr>
nnoremap <silent> <Right> :vertical resize +5<cr>
noremap <silent> <Left> :vertical resize -5<cr>
nnoremap <silent> <Up> :resize +5<cr>
nnoremap <silent> <Down> :resize -5<cr>
nnoremap <leader>d :call pdv#DocumentWithSnip()<cr>
nnoremap <leader>t :! vendor/bin/phpunit<cr>
nnoremap <leader>tf :! vendor/bin/phpunit %<cr>
" --------------------------------------------------------------------------------
" reading and writing files
" --------------------------------------------------------------------------------
set autoread
" --------------------------------------------------------------------------------
" the swap file
" --------------------------------------------------------------------------------
set noswapfile
" --------------------------------------------------------------------------------
" command line editing
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" executing external commands
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" running make and jumping to errors
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" language specific
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" multi-byte characters
" --------------------------------------------------------------------------------
set fileencoding=utf-8
set encoding=utf-8
" --------------------------------------------------------------------------------
" variousexecute
" --------------------------------------------------------------------------------
" --------------------------------------------------------------------------------
" plugins
" --------------------------------------------------------------------------------
" git gutter
"let g:gitgutter_git_executable="C:\tools\cmder\vendor\git-for-windows\bin\git.exe"
"
"let g:sparkupExecuteMapping='<C-D>'
"let g:sparkupExecuteMapping = '<c-d>'
" ultisnips
let g:UltiSnipsJumpForwardTrigger="<c-j>"
let g:UltiSnipsJumpBackwardTrigger="<c-k>"
let g:UltiSnipsSnippetsDir = "%homepath%\vimfiles\UltiSnips"
let g:snips_author = "AdeAttwood"
let g:snips_email = "attwood16@googlemail.com"
" vimwiki
let g:vimwiki_list = [{
\ 'path': '%homepath%\vimwiki\',
\ 'template_path': '%homepath\vimwiki\templates',
\ 'template_default': 'default',
\ 'template_ext': '.html',
\ 'auto_toc': 1}]
au BufRead,BufNewFile *.wiki set filetype=vimwiki
function! ToggleCalendar()
execute ":Calendar"
if exists("g:calendar_open")
if g:calendar_open == 1
execute "q"
unlet g:calendar_open
else
g:calendar_open = 1
end
else
let g:calendar_open = 1
end
endfunction
autocmd FileType calendar nmap <buffer> <CR> :<C-u>call vimwiki#diary#calendar_action(b:calendar.day().get_day(), b:calendar.day().get_month(), b:calendar.day().get_year(), b:calendar.day().week(), "V")<CR>
" vim-airline
let g:airline#extensions#branch#enabled=1
let g:airline_theme='bubblegum'
" browserlink
let g:bl_pagefiletype = ['html', 'javascript', 'css', 'scss', 'sass', 'php', 'phtml']
" pdv
let g:pdv_template_dir = "C:/Users/ade/vimfiles/bundle/pdv/templates_snip"
" indent-guides
let g:indent_guides_auto_colors = 1
" --------------------------------------------------------------------------------
" functions
" --------------------------------------------------------------------------------