How to make files optional include in MainSection of NSIS installer - if-statement

MainSection of .nsi file contains the files name which are bundled along with the installer.
I need to make a file which should not get bundled when install type equals normal and that file should get bundled when type equals costume.
Section "MainSection" SEC01
- SetOutPath "$INSTDIR"
- SetOverwrite ifnewer
* if (installtype==custom)
* File "IncludeThisFile"
SectionEnd
How to achieve above in nsis.help is much appreciated!!

You usually just put optional things in another section but you can also do what you want:
!include LogicLib.nsh
!include FileFunc.nsh
var IsSpecialMode
Function .onInit
StrCpy $IsSpecialMode 0
${GetParameters} $0
ClearErrors
${GetOptions} $0 "/includespecial" $1
${IfNotThen} ${Errors} ${|} StrCpy $IsSpecialMode 1 ${|}
FunctionEnd
Page InstFiles
Section
SetOutPath "$instdir"
${If} $IsSpecialMode <> 0
File "${__FILE__}"
${EndIf}
SectionEnd
..and then run MySetup.exe /includespecial

Related

Rename multiple file with special characters in Fedora

I have several hundred files in the below format:
'[animalpics.com][977]bluejays.png'
'[animalpics.com][9]lions.jpg'
'[animalpics.com][99]colts.jpg'
I would like to rename all the files to just the description and file type:
bluejays.png
lions.jpg
colts.jpg
I have tried rename but it doesn't seem to like the command I'm using:
rename 's/[animalpics.com][*]//g' *.*
How can I edit my command to rename these files? I also have install mmv but it's not as intuitive as I thought.
rename 's/^.*\]//' *
Demo:
$ls -1
'[animalpics.com][977]bluejays.png'
'[animalpics.com][99]colts.jpg'
'[animalpics.com][9]lions.jpg'
file.txt
$rename 's/^.*\]//' *
$ls -1
bluejays.png
colts.jpg
file.txt
lions.jpg
$

Command Line - Remove in folder with regex windows

Objective
How can I remove all files within a folder (recursively) with regex on File Name?
From Windows 10, I can use PowerShell or git console with unix commands.
Required points
NOT Matches /.+?-dbg.*?\.js/
For a file to be matched it's required to match a "brother file" with the previous point pattern.
Example Test Folder contains
ActionMode.js
ActionMode-dbg.js
Component.js
Component-dbg.js
DualContribution.controller.js
DualContribution-dbg.controller.js
resources.js
manifest-json
Files that would be deleted
ActionMode.js
Component.js
DualContribution.controller.js
If you need more information please ask me. Thanks.
I don't know whether this really helps you, but here is a quick solution.
This Autoit code prints all files to console that you want to delete.
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
$allFiles = _FileListToArrayRec(#ScriptDir, '*.js', $FLTAR_FILES, $FLTAR_RECUR , $FLTAR_SORT, $FLTAR_FULLPATH )
If #error Then ConsoleWrite(#error & #crlf)
_ArrayDisplay($allFiles, "Sorted tree")
For $i = 0 to UBound($allFiles) -1
If StringInStr($allFiles[$i], '-dbg') <> 0 Then
If StringReplace($allFiles[$i], '-dbg', '') == $allFiles[$i-1] Then ConsoleWrite('Delete file: ' & $allFiles[$i-1] & #CRLF)
EndIf
Next

Can't enable phar writing

I am actually using wamp 2.5 with PHP 5.5.12 and when I try to create a phar file it returns me the following message :
Uncaught exception 'UnexpectedValueException' with message 'creating archive "..." disabled by the php.ini setting phar.readonly'
even if I turn to off the phar.readonly option in php.ini.
So how can I enable the creation of phar files ?
I had this same problem and pieced together from info on this thread, here's what I did in over-simplified explanation:
in my PHP code that's generating this error, I added echo phpinfo(); (which displays a large table with all sort of PHP info) and in the first few rows verify the path of the php.ini file to make sure you're editing the correct php.ini.
locate on the phpinfo() table where it says phar.readonly and note that it is On.
open the php.ini file from step 1 and search for phar.readonly. Mine is on line 995 and reads ;phar.readonly = On
Change this line to phar.readonly = Off. Be sure that there is no semi-colon at the beginning of the line.
Restart your server
Confirm that you're phar project is now working as expected, and/or search on the phpinfo()table again to see that the phar.readonly setting has changed.
phar.readonly can only be disabled in php.ini due to security reasons.
If you want to check that it's is really not done using other method than php.ini then in terminal type this:-
$ php -r "ini_set('phar.readonly',0);print(ini_get('phar.readonly'));"
If it will give you 1 means phar.readonly is On.
More on phar.configuration
Need to disable in php.ini file
Type which php
Gives a different output depending on machine e.g.
/c/Apps/php/php-7.2.11/php
Then open the path given not the php file.
E.g. /c/Apps/php/php-7.2.11
Edit the php.ini file
could do
vi C:\Apps\php\php-7.2.11\php.ini
code C:\Apps\php\php-7.2.11\php.ini
[Phar]
; http://php.net/phar.readonly
phar.readonly = Off
; http://php.net/phar.require-hash
phar.require_hash = Off
Save
Using php-cli and a hashbang, we can set it on the fly without messing with the ini file.
testphar.php
#!/usr/bin/php -d phar.readonly=0
<?php
print(ini_get('phar.readonly')); // Must return 0
// make sure it doesn't exist
#unlink('brandnewphar.phar');
try {
$p = new Phar(dirname(__FILE__) . '/brandnewphar.phar', 0, 'brandnewphar.phar');
} catch (Exception $e) {
echo 'Could not create phar:', $e;
}
echo 'The new phar has ' . $p->count() . " entries\n";
$p->startBuffering();
$p['file.txt'] = 'hi';
$p['file2.txt'] = 'there';
$p['file2.txt']->compress(Phar::GZ);
$p['file3.txt'] = 'babyface';
$p['file3.txt']->setMetadata(42);
$p->setStub('<?php
function __autoload($class)
{
include "phar://myphar.phar/" . str_replace("_", "/", $class) . ".php";
}
Phar::mapPhar("myphar.phar");
include "phar://myphar.phar/startup.php";
__HALT_COMPILER();');
$p->stopBuffering();
// Test
$m = file_get_contents("phar://brandnewphar.phar/file2.txt");
$m = explode("\n",$m);
var_dump($m);
/* Output:
* there
**/
✓ Must be set executable:
chmod +x testphar.php
✓ Must be called like this:
./testphar.php
// OUTPUT there
⚠️ Must not be called like this:
php testphar.php
// Exception, phar is read only...
⚠️ Won't work called from a CGI web server
php -S localhost:8785 testphar.php
// Exception, phar is read only...
For anyone who has changed the php.ini file, but just doesn't see any changes. Try to use the CLI version of the file. For me, it was in /etc/php/7.4/cli/php.ini
Quick Solution!
Check:
cat /etc/php/7.4/apache2/php.ini | grep phar.readonly
Fix:
sed -i 's/;phar.readonly = On/;phar.readonly = Off/g' /etc/php/7.4/apache2/php.ini

In search and replacing using VIM, how do I keep a grouped text and reuse it in the replacement part?

In VIM (edit MacVim snapshot 64), I am looking for a way to convert these lines of text
can_check_steps = 1
can_edit_work_type = 1
can_edit_vendor = 1
can_edit_place = 1
to
'can_check_steps': can_check_steps,
'can_edit_work_type': can_edit_work_type,
'can_edit_vendor': can_edit_vendor,
'can_edit_place': can_edit_place,
I know how to add the leading single quote and convert the = into : with multi-line character replacement (something I learned from this question) and basic search and replace, respectively.
But I can't really figure out how to repeat that the variable name per line. I'm also starting to think there should be a way to do this all in one command using like grouped expressions (using ( and ) to "capture" in regular expression).
I know how to do it in Python with lines of code, but I don't really know how to do it in VIM using the s/search_for_this/replace_that/options format.
EDIT:
After reading the answers, why doesn't this work?
^\s*(\w+) = 1\s*$/'\1': \1,/g
For #Jonathan Leffler, :set all in MacVim produces
--- Options ---
aleph=224 bufhidden= cscopequickfix= noerrorbells fsync includeexpr= nomacmeta omnifunc= report=2 showmatch tabline= nottimeout nowildignorecase
antialias buflisted nocscoperelative esckeys nofullscreen incsearch magic operatorfunc= norevins showmode tabpagemax=10 ttimeoutlen=-1 wildmenu
noarabic buftype= nocscopetag eventignore= nogdefault indentexpr= makeef= nopaste norightleft showtabline=1 tabstop=4 ttybuiltin wildmode=full
arabicshape cdpath=,, cscopetagorder=0 expandtab guifont= noinfercase makeprg=make pastetoggle= ruler sidescroll=0 tagbsearch nottyfast wildoptions=
noallowrevins cedit=^F nocscopeverbose noexrc guifontwide= noinsertmode matchtime=5 patchexpr= rulerformat= sidescrolloff=0 taglength=0 ttymouse= window=83
noaltkeymap charconvert= nocursorbind fileencoding= guipty isprint=#,161-255 maxcombine=2 patchmode= scroll=41 smartcase tagrelative ttyscroll=999 winheight=1
ambiwidth=single nocindent nocursorcolumn fileformat=unix guitablabel=%M%t joinspaces maxfuncdepth=100 nopreserveindent noscrollbind smartindent tags=./tags,tags undodir=. nowinfixheight
autochdir cinoptions= cursorline filetype= guitabtooltip= key= maxmapdepth=1000 previewheight=12 scrolljump=1 smarttab tagstack noundofile nowinfixwidth
autoindent cmdheight=1 debug= nofkmap helpheight=20 keymap= maxmem=751782 nopreviewwindow scrolloff=0 softtabstop=0 term=builtin_gui undolevels=1000 winminheight=1
noautoread cmdwinheight=7 nodelcombine foldclose= helplang=en keymodel= maxmemtot=751782 printdevice= nosecure nospell notermbidi undoreload=10000 winminwidth=1
noautowrite colorcolumn= dictionary= foldcolumn=0 nohidden keywordprg=man -s menuitems=25 printencoding= selectmode= spellfile= noterse updatecount=200 winwidth=20
noautowriteall columns=269 nodiff foldenable history=1000 langmap= modeline printfont=courier shell=/bin/bash spelllang=en textauto updatetime=4000 wrap
background=dark nocompatible diffexpr= foldexpr=0 nohkmap langmenu=none modelines=5 printmbcharset= shellcmdflag=-c spellsuggest=best notextmode verbose=0 wrapmargin=0
nobackup concealcursor= diffopt=filler foldignore=# nohkmapp laststatus=2 modifiable printmbfont= shellquote= nosplitbelow textwidth=0 verbosefile= wrapscan
backupcopy=auto conceallevel=0 nodigraph foldlevel=0 hlsearch nolazyredraw nomodified printoptions= shelltemp nosplitright thesaurus= virtualedit= write
backupext=~ completefunc= display= foldlevelstart=-1 icon nolinebreak more prompt shellxquote= startofline notildeop novisualbell nowriteany
balloondelay=600 noconfirm eadirection=both foldmethod=manual iconstring= lines=84 mouse=a pumheight=0 noshiftround suffixesadd= timeout warn writebackup
noballooneval nocopyindent noedcompatible foldminlines=1 noignorecase linespace=0 nomousefocus quoteescape=\ shiftwidth=4 swapfile timeoutlen=1000 noweirdinvert writedelay=0
balloonexpr= cpoptions=aABceFs encoding=utf-8 foldnestmax=20 noimcmdline nolisp mousehide noreadonly noshortname swapsync=fsync title whichwrap=b,s
nobinary cryptmethod=zip endofline formatexpr= imdisable nolist mousetime=500 redrawtime=2000 showbreak= switchbuf= titlelen=85 wildchar=<Tab>
nobomb cscopepathcomp=0 equalalways formatoptions=tcq iminsert=2 listchars=eol:$ number norelativenumber showcmd synmaxcol=3000 titlestring= wildcharm=0
browsedir=last cscopeprg=cscope equalprg= formatprg= imsearch=2 loadplugins numberwidth=4 remap noshowfulltag syntax= transparency=0 wildignore=
backspace=indent,eol,start
backupdir=.,~/tmp,~/
backupskip=/tmp/*,/var/folders/70/f8c54mjn4vg_wztz9bd17lp40000gn/T/*
breakat= ^I!#*-+;:,./?
casemap=internal,keepascii
cinkeys=0{,0},0),:,0#,!^F,o,O,e
cinwords=if,else,while,do,for,switch
clipboard=autoselect
comments=s1:/*,mb:*,ex:*/,://,b:#,:%,:XCOMM,n:>,fb:-
commentstring=/*%s*/
complete=.,w,b,u,t,i
completeopt=menu,preview
define=^\s*#\s*define
directory=.,~/tmp,/var/tmp,/tmp
errorfile=errors.err
errorformat=%*[^"]"%f"%*\D%l: %m,"%f"%*\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%-GIn file included from %f:%l:%c:,%-GIn file included from %f:%l:%c\,,%-GIn file included from %f:%l:%c,%-GIn file
included from %f:%l,%-G%*[ ]from %f:%l:%c,%-G%*[ ]from %f:%l:,%-G%*[ ]from %f:%l\,,%-G%*[ ]from %f:%l,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,"%f"\, line %l%*\D%c%*[^ ] %m,%D%*\a[%*\d]: Entering directory `%f',%X%*\a[%*\d]: Leaving directory `%f',%D%*\a: Entering directory `%f
',%X%*\a: Leaving directory `%f',%DMaking %*\a in %f,%f|%l| %m
fileencodings=ucs-bom,utf-8,default,latin1
fileformats=unix,dos
fillchars=vert:|,fold:-
foldmarker={{{,}}}
foldopen=block,hor,mark,percent,quickfix,search,tag,undo
foldtext=foldtext()
formatlistpat=^\s*\d\+[\]:.)}\t ]\s*
fuoptions=maxvert,maxhorz
grepformat=%f:%l:%m,%f:%l%m,%f %l%m
grepprg=grep -n $* /dev/null
guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
guioptions=egmrLtT
helpfile=/Applications/MacVim.app/Contents/Resources/vim/runtime/doc/help.txt
highlight=8:SpecialKey,#:NonText,d:Directory,e:ErrorMsg,i:IncSearch,l:Search,m:MoreMsg,M:ModeMsg,n:LineNr,r:Question,s:StatusLine,S:StatusLineNC,c:VertSplit,t:Title,v:Visual,V:VisualNOS,w:WarningMsg,W:WildMenu,f:Folded,F:FoldColumn,A:DiffAdd,C:DiffChange,D:DiffDelete
,T:DiffText,>:SignColumn,-:Conceal,B:SpellBad,P:SpellCap,R:SpellRare,L:SpellLocal,+:Pmenu,=:PmenuSel,x:PmenuSbar,X:PmenuThumb,*:TabLine,#:TabLineSel,_:TabLineFill,!:CursorColumn,.:CursorLine,o:ColorColumn
include=^\s*#\s*include
indentkeys=0{,0},:,0#,!^F,o,O,e
isfname=#,48-57,/,.,-,_,+,,,#,$,%,~,=
isident=#,48-57,_,192-255
iskeyword=#,48-57,_,192-255
lispwords=defun,define,defmacro,set!,lambda,if,case,let,flet,let*,letrec,do,do*,define-syntax,let-syntax,letrec-syntax,destructuring-bind,defpackage,defparameter,defstruct,deftype,defvar,do-all-symbols,do-external-symbols,do-symbols,dolist,dotimes,ecase,etypecase,eva
l-when,labels,macrolet,multiple-value-bind,multiple-value-call,multiple-value-prog1,multiple-value-setq,prog1,progv,typecase,unless,unwind-protect,when,with-input-from-string,with-open-file,with-open-stream,with-output-to-string,with-package-iterator,define-condition,h
andler-bind,handler-case,restart-bind,restart-case,with-simple-restart,store-value,use-value,muffle-warning,abort,continue,with-slots,with-slots*,with-accessors,with-accessors*,defclass,defmethod,print-unreadable-object
matchpairs=(:),{:},[:]
maxmempattern=1000
mkspellmem=460000,2000,500
mousemodel=popup_setpos
mouseshape=i-r:beam,s:updown,sd:udsizing,vs:leftright,vd:lrsizing,m:no,ml:up-arrow,v:rightup-arrow
nrformats=octal,hex
paragraphs=IPLPPPQPP TPHPLIPpLpItpplpipbp
path=.,/usr/include,,
printexpr=system('open -a Preview '.v:fname_in) + v:shell_error
printheader=%<%f%h%m%=Page %N
rightleftcmd=search
runtimepath=~/.vim,/Applications/MacVim.app/Contents/Resources/vim/vimfiles,/Applications/MacVim.app/Contents/Resources/vim/runtime,/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after,~/.vim/after
scrollopt=ver,jump
sections=SHNHH HUnhsh
selection=inclusive
sessionoptions=blank,buffers,curdir,folds,help,options,tabpages,winsize
shellpipe=2>&1| tee
shellredir=>%s 2>&1
shortmess=filnxtToO
spellcapcheck=[.?!]\_[\])'"^I ]\+
statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
suffixes=.bak,~,.o,.h,.info,.swp,.obj
termencoding=utf-8
titleold=Thanks for flying Vim
toolbar=icons,tooltips
toolbariconsize=small
ttytype=builtin_gui
viewdir=~/.vim/view
viewoptions=folds,options,cursor
viminfo='100,<50,s10,h
That should do the work:
%s/\v(\w+).*/'\1': \1,
I think your query doesn't work because the + symbols needs the slash \ before it.
In my query I used the \v 'very magic' option that allows me to skip some slashes.
see :h /magic
:s/^\([^ ]*\) .*$/'\1': \1,/
The match part starts at the beginning of the line and captures a sequence of non-blanks, followed by an uncaptured blank and anything else. The replace part starts with a quote, what you remembered, a quote, colon, blank, what you remembered again, and a comma.
Divergent behaviours in vim
Weird, backslashing ( and ) doesn't even match anything in my VIM, which is MacVim snapshot 64 (although it still says it's 7.3.390 by Bram Moolenar). Using the \v in #Tassos's answer seems to work.
On Mac OS X 10.7.4, I'm using the vim from /usr/bin which identifies itself as:
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jun 24 2011 20:00:09)
Compiled by root#apple.com
Normal version without GUI. Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile -python
-python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
-toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
-xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
I also use vim on Linux machines, and it behaves the same w.r.t regular expressions. One of those versions identifies itself, in part, as:
VIM - Vi IMproved 7.0 (2006 May 7, compiled Nov 5 2008 11:07:46)
Included patches: 1, 3-4, 7-9, 11, 13-17, 19-26, 29-31, 34-44, 47, 50-56, 58-64, 66-73, 75, 77-92, 94-107, 109, 202, 234-235, 237
Modified by <bugzilla#redhat.com>
Compiled by <bugzilla#redhat.com>
Huge version without GUI.
I'm not sure if there's anything worth showing from :set all. This is the output from the Mac version of Vim:
ambiwidth=single foldclose= omnifunc= syntax=
noautochdir foldcolumn=0 operatorfunc= tabline=
autoindent foldenable nopaste tabpagemax=10
autoprint foldexpr=0 pastetoggle= tabstop=4
noautoread foldignore=# patchexpr= tagbsearch
noautowrite foldlevel=0 patchmode= taglength=0
noautowriteall foldlevelstart=-1 nopreserveindent tagrelative
background=light foldmethod=manual previewheight=12 tags=./tags,tags
backspace=2 foldminlines=1 nopreviewwindow tagstack
nobackup foldnestmax=20 printdevice= term=xterm-color
backupcopy=auto formatexpr= printencoding= termencoding=
backupext=~ formatoptions=tcq printfont=courier noterse
nobeautify formatprg= printmbcharset= textauto
nobinary fsync printmbfont= notextmode
nobomb nogdefault printoptions= textwidth=0
bufhidden= helpheight=20 prompt thesaurus=
buflisted helplang=en pumheight=0 notildeop
buftype= nohidden quoteescape=\ timeout
cedit=^F history=20 noreadonly timeoutlen=1000
charconvert= nohlsearch redrawtime=2000 notitle
nocindent noicon norelativenumber titlelen=85
cinoptions= iconstring= remap titlestring=
cmdheight=1 noignorecase report=2 nottimeout
cmdwinheight=7 iminsert=0 noruler ttimeoutlen=-1
colorcolumn= imsearch=0 rulerformat= ttybuiltin
columns=80 includeexpr= scroll=32 ttyfast
nocompatible noincsearch noscrollbind ttymouse=xterm
completefunc= indentexpr= scrolljump=1 ttyscroll=999
noconfirm noinfercase scrolloff=0 undodir=.
nocopyindent noinsertmode nosecure noundofile
cpoptions=aABceFs isprint=#,161-255 selectmode= undolevels=1000
cryptmethod=zip joinspaces shell=/bin/sh undoreload=10000
cscopepathcomp=0 key= shellcmdflag=-c updatecount=200
cscopeprg=cscope keymodel= shellquote= updatetime=4000
cscopequickfix= keywordprg=man -s shelltemp verbose=0
nocscopetag langmenu= shellxquote= verbosefile=
cscopetagorder=0 laststatus=1 noshiftround virtualedit=
nocscopeverbose nolazyredraw shiftwidth=4 novisualbell
nocursorbind nolinebreak noshortname warn
nocursorcolumn lines=66 showbreak= noweirdinvert
nocursorline nolisp noshowcmd whichwrap=b,s
debug= nolist noshowfulltag wildchar=<Tab>
nodelcombine listchars=eol:$ showmatch wildcharm=0
dictionary= loadplugins showmode wildignore=
nodiff magic showtabline=1 nowildmenu
diffexpr= makeef= sidescroll=0 wildmode=full
diffopt=filler makeprg=make sidescrolloff=0 wildoptions=
nodigraph matchtime=5 nosmartcase window=0
directory=/tmp maxcombine=2 nosmartindent winheight=1
display= maxfuncdepth=100 nosmarttab nowinfixheight
eadirection=both maxmapdepth=1000 softtabstop=0 nowinfixwidth
noedcompatible maxmem=450298 nospell winminheight=1
encoding=utf-8 maxmemtot=450298 spellfile= winminwidth=1
endofline menuitems=25 spelllang=en winwidth=20
equalalways modeline spellsuggest=best wrap
equalprg= modelines=0 nosplitbelow wrapmargin=0
noerrorbells modifiable nosplitright wrapscan
esckeys nomodified startofline write
eventignore= more statusline= nowriteany
expandtab mouse= suffixesadd= writebackup
noexrc mousemodel=extend swapfile writedelay=0
fileencoding= mousetime=500 swapsync=fsync
fileformat=unix number switchbuf=
filetype= numberwidth=4 synmaxcol=3000
The behaviour you're describing sounds as if there are PCRE (Perl-Compatible Regular Expressions) in use. Maybe the -perl in the configuration is relevant there. I don't see anything in the settings shown that could alter the regex patterns. Maybe you can run your MacVim and show the output of macvim --version and then the output from : set all. Oh, drat, you don't have enough privileges to edit them into this message. I found an 80-column window sensible for the :set all information and pasting to SO; I normally use 120 column windows.
Please find my email in my profile and send me the data. I am curious to know what's different about the MacVim settings (if only so I can set them back to 'normal' if I ever get around to using it).
From vimregex.com:
You can group parts of the pattern expression enclosing them with "("
and ")" and refer to them inside the replacement pattern by their
special number \1, \2 ... \9. Typical example is swapping first two
words of the line:
s:(\w+)(\s+)(\w+):\3\2\1:
where \1 holds the first word, \2 -
any number of spaces or tabs in between and \3 - the second word. How
to decide what number holds what pair of () ? - count opening "("
from the left.

VisualSVN post-commit hook with batch file

I'm running VisualSVN on a Windows server.
I'm trying to add a post-commit hook to update our staging project whenever a commit happens.
In VisualSVN, if I type the command in the hook/post-commit dialog, everything works great.
However, if I make a batch file with the exact same command, I get an error that says the post-commit hook has failed. There is no additional information.
My command uses absolute paths.
I've tried putting the batch file in the VisualSVN/bin directory, I get the same error there.
I've made sure VisualSVN has permissions for the directories where the batch file is.
The only thing I can think of is I'm not calling it correctly from VisualSVN. I'm just replacing the svn update command in the hook/post-commit dialog with the batch file name ("c:\VisualSVN\bin\my-batch-file.bat") I've tried it with and without the path (without the path it doesn't find the file at all).
Do I need to use a different syntax in the SVNCommit dialog to call the batch file? What about within the batch file (It just has my svn update command. It works if I run the batch file from the command line.)
Ultimately I want to use a batch file because I want to do a few more things after the commit.
When using VisualSVN > Select the Repo > Properties > Hooks > Post-commit hook.
Where is the code I use for Sending an Email then running a script, which has commands I want to customize
"%VISUALSVN_SERVER%\bin\VisualSVNServerHooks.exe" ^
commit-notification "%1" -r %2 ^
--from support#domainname.com --to "support#domainname.com" ^
--smtp-server mail.domainname.com ^
--no-diffs ^
--detailed-subject
--no-html
set PWSH=%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe
%PWSH% -command $input ^| C:\ServerScripts\SVNScripts\post-commit-wp.ps1 %1 %2
if errorlevel 1 exit %errorlevel%
The script file is located on C:\ServerScripts\SVNScripts\
post-commit-wp.ps1 and I pass in two VisualSVN variables as %1 and %2
%1 = serverpathwithrep
%2 = revision number
The script file is written in Windows PowerShell
# PATH TO SVN.EXE
$svn = "C:\Program Files\VisualSVN Server\bin\svn.exe"
$pathtowebistesWP = "c:\websites-wp\"
# STORE HOOK ARGUMENTS INTO FRIENDLY NAMES
$serverpathwithrep = $args[0]
$revision = $args[1]
# GET DIR NAME ONLY FROM REPO-PATH STRING
# EXAMPLE: C:\REPOSITORIES\DEVHOOKTEST
# RETURNS 'DEVHOOKTEST'
$dirname = ($serverpathwithrep -split '\\')[-1]
# Combine ServerPath with Dir name
$exportpath = -join($pathtowebistesWP, $dirname);
# BUILD URL TO REPOSITORY
$urepos = $serverpathwithrep -replace "\\", "/"
$url = "file:///$urepos/"
# --------------------------------
# SOME TESTING SCRIPTS
# --------------------------------
# STRING BUILDER PATH + DIRNAME
$name = -join($pathtowebistesWP, "testscript.txt");
# CREATE FILE ON SERVER
New-Item $name -ItemType file
# APPEND TEXT TO FILE
Add-Content $name $pathtowebistesWP
Add-Content $name $exportpath
# --------------------------------
# DO EXPORT REPOSITORY REVISION $REVISION TO THE ExportPath
&"$svn" export -r $revision --force "$url" $exportpath
I added comments to explain each line and what it does. In a nutshell, the scripts:
Gets all the parameters
Build a local dir path
Runs SVN export
Places files to a website/publish directory.
Its a simple way of Deploying your newly committed code to a website.
Did you try to execute batch file using 'call' command? I mean:
call C:\Script\myscript.bat
I was trying the same thing and found that you also must have the script in the hooks folder.. the bat file that is.