I am currently using MacVim, and I would like to print all the files in the working tree. Is there a way to do this, perhaps using the hardcopy command?
hardcopy
A convenient way to execute a command for a group of files is to collect a list of their names, define it as a new argument list (see :help arglist ), and then repeat the command on these files in the argument list.
:help arglist
To complete the first step, use the command :args using the pattern matching the desired files. For instance,
:args
:args ./**/*
sets the argument list to the names of all files in the current directory and its subdirectories; Similarly
:args /tmp/**/*.{c,h}
selects all .c and .h files in /tmp and its subdirectories. For more information on wildcard syntax, see :help wildcard .
.c
.h
/tmp
:help wildcard
If the path to the root of the subtree containing the files to print is unknown in advance and the script is built, use the command
:exe 'args' join(map(split(glob(p . '/**/*'), '\n'), 'fnameescape(v:val)'))
where it is assumed that the variable p contains the path to its root directory.
p
To send files to the printer argument list, execute :hardcopy for these files using the command :argdo ,
:hardcopy
:argdo
:argdo hardcopy!
Specifier ! suppresses the modal print options dialog box.
!
A more sophisticated command can be used to print each file into a separate PostScript document located in the same directory as the file.
:argdo hardcopy! >%:p.ps
Here the name of the print file is combined with the suffix .ps to get the name of the corresponding PostScript file (see :help cmdline-special ).
.ps
:help cmdline-special
To speed up the command :argdo -argument Vim ignores the Syntax auto-command event, adding it to the eventignore list. This means that if Syntax autocommands were not run for the file in the argument list before the command :hardcopy :argdo ne, the syntax will not be highlighted in the corresponding printed document (in the case of syntax:y set to printoptions ). To run the Syntax auto command for all files in the argument list, use the following first.
Syntax
eventignore
syntax:y
printoptions
:argdo set ei-=Syntax | do Syntax
To do this at the same start as printing, combine the commands:
:argdo set ei-=Syntax | do Syntax | hardcopy! >%:p.ps
Edit Sorry, I did not understand before.
To print everything, say the php and C # files in your working directory:
:args ./*.{cs,php} **/*.{cs,php} :argdo ha
Source: https://habr.com/ru/post/899751/More articles:adding gestures without creating gestures - javaDisable map controls in google maps - google-mapshttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/899748/why-does-maven-use-my-internal-repository-before-my-local-repository&usg=ALkJrhjasNv_rgRnJwUwk9pK1EteVBPqzADownload multiple files from one large file and unzip through socket - iphoneDesign template to avoid multiple ifs - javaCan Runnable return a value? - androidDynamically add V3 markers to Google Map using jQuery - javascriptOutOfMemoryException when creating a large ZIP file using System.IO.Packaging - c #Linq that automatically eliminates duplicates (single line) - optimizationUsing image.complete to find if the image will be cached to chrome? - javascriptAll Articles