When I update nano using Homebrew, the /usr/local/share/nano directory is overwritten and all of my custom .nanorc files are removed.
Is there a place where custom user .nanorc files should go where they can be protected from updates?
Yes, you can copy your custom syntax definition files such as perl.nanorc in a dedicated directory such as ~/nanorc and then include each of them from the .nanorc with an include directive.
In the sample.nanorc, you can see:
## If you wish, you may put your syntax definitions in separate files.
## You can make use of such files as follows:
##
## include "/path/to/syntax_file.nanorc"
Related
In Haskell: Given an existing directory tree (with sub-directors) of source files.
Is there a way to get a .cabal or .stack file, created automatically, with all the necessary dependents (references to the import files that are embedded inside the source file) embedded in the command file,with no need to manualy editing the command file.
In other words, get a command file that I will be able to run "straight out of the box" without the regular methods of stack new/stack build etc,commands?
cabal init will create a file that lists all the modules in your sourcedir for you. But you will still need to provide the package dependencies yourself. This is because a module Foo.Bar.Baz may come from multiple packages -- hence the package you intend to import must be explicitly specified.
Using visual studio and the Umbraco NuGet package, I'd like to setup a basic Umbraco installation containing:
some umbraco packages, such as Optimus
some individual document types
This should be wrapped by a git repo.
Where possible, I'd like to exclude generated/compiled files by adding the affected paths/file extensions to the .gitignore file.
I started off using the official umbraco .gitignore which has the following entries:
# Note: VisualStudio gitignore rules may also be relevant
# Umbraco
# Ignore unimportant folders generated by Umbraco
**/App_Data/Logs/
**/App_Data/[Pp]review/
**/App_Data/TEMP/
**/App_Data/NuGetBackup/
# Ignore Umbraco content cache file
**/App_Data/umbraco.config
# Don't ignore Umbraco packages (VisualStudio.gitignore mistakes this for a NuGet packages folder)
# Make sure to include details from VisualStudio.gitignore BEFORE this
!**/App_Data/[Pp]ackages/
!**/[Uu]mbraco/[Dd]eveloper/[Pp]ackages
# ImageProcessor DiskCache
**/App_Data/cache/
However, this would not include the database nor installed packages, so I also added the following entries*:
!**/Aa]pp_[Dd]ata/packages
!**/Aa]pp_[Dd]ata/Umbraco.sdf
!**/[Bb]in/*.pdb
!**/[Uu]mbraco/[Cc]onfig
see discussion here
Using this configuration, ReSharper would list 3 errors which occur in the global web.config file:
my-umbraco-project\Web.config:87 Cannot resolve symbol 'Providers'
my-umbraco-project\Web.config:87 Cannot resolve symbol 'DefaultSessionStateProvider'
my-umbraco-project\Web.config:87 Invalid module qualification: Failed to resolve assembly System.Web.Providers
However, I can compile, log-in to my umbraco instance and even the pre-installed plugin would appear.
This basically leaves 2 questions:
What do I additionally have to include in order to fix the 3 errors?
Are there more compiled/generated files I could exclude?
So here's the .gitignore we use without any issues:
[Oo]bj/
[Bb]in/
.nuget/
.vs/
_ReSharper.*
packages/
artifacts/
*.user
*.suo
*.userprefs
*.dbmdl
*DS_Store
*.sln.ide
# Umbraco
# Ignore unimportant folders generated by Umbraco
**/App_Data/Logs/
**/App_Data/[Pp]review/
**/App_Data/TEMP/
**/App_Data/NuGetBackup/
# Ignore Umbraco content cache file
**/App_Data/umbraco.config
# Don't ignore Umbraco packages (VisualStudio.gitignore mistakes this for a NuGet packages folder)
# Make sure to include details from VisualStudio.gitignore BEFORE this
!**/App_Data/[Pp]ackages/
!**/[Uu]mbraco/[Dd]eveloper/[Pp]ackages
!*UmbracoModelsBuilder.user
# ImageProcessor DiskCache
**/App_Data/cache/
I've already used devtools to create my package skeleton, then added a bunch of R code, metadata, documentation, etc. I would like to use rstan within this package. I understand that rstan::rstan.package.skeleton creates a package skeleton to facilitate this. So what is the best practice for augmented an existing package with the structure necessary to use rstan from that package? Thank you.
I would say to use rstan.package.skeleton to create the skeleton in a temporary directory and then copy the relevant stuff it creates into the package you created by devtools. This would include
cleanup and cleanup.win in the root of the directory
the tools directory
the exec directory
the inst/chunks subdirectory
the src directory
the R/stanmodels.R file
the DESCRIPTION file in the root of the directory
For the DESCRIPTION file, you may just have to combine it by hand with whatever DESCRIPTION file you have currently.
I created a new app and the Dart Editor (M4) created a slew of files and folders. Now I'm not sure which I can safely put in the gitignore. Here's the tree:
app/.buildlog
app/build.dart
app/packages/analyzer_experimental
app/packages/args
app/packages/browser
app/packages/csslib
app/packages/html5lib
app/packages/js
app/packages/logging
app/packages/meta
app/packages/pathos
app/packages/source_maps
app/packages/unittest
app/packages/web_ui
app/pubspec.lock
app/pubspec.yaml
app/web/app.css
app/web/app.dart
app/web/app.html
app/web/out/app.css
app/web/out/app.dart
app/web/out/app.dart.map
app/web/out/app.html
app/web/out/app.html_bootstrap.dart
app/web/out/packages
app/web/out/xclickcounter.dart
app/web/out/xclickcounter.dart.map
app/web/packages
app/web/xclickcounter.dart
app/web/xclickcounter.html
I assume the following files can be ignored:
app/.buildlog
app/packages/*
app/web/out/*
app/web/packages
Is that correct?
From What Not to Commit on dartlang.org:
# files and directories created by pub
.dart_tool/
.packages
.pub/
build/
pubspec.lock # Except for application packages
# API documentation directory created by dartdoc
doc/api/
# files and directories created by other development environments
*.iml # IntelliJ
*.ipr # IntelliJ
*.iws # IntelliJ
.idea/ # IntelliJ
.DS_Store # Mac
# generated JavaScript files
*.dart.js
*.info.json # Produced by the --dump-info flag.
*.js # When generated by dart2js. Don't specify *.js if your
# project includes source files written in JavaScript.
*.js_
*.js.deps
*.js.map
Don’t commit the following files and directories created by pub, Dart Editor, and dart2js:
packages/
pubspec.lock // Except for application packages
.project
.buildlog
*.js_
*.js.deps
*.js.map
Don’t commit files and directories dropped by other development environments. For example:
.project // Eclipse
*.iml // IntelliJ
*.ipr // IntelliJ
*.iws // IntelliJ
.idea/ // IntelliJ
.DS_Store // Mac
Avoid committing generated JavaScript files:
*.dart.js
For more details, read https://www.dartlang.org/tools/private-files.html.
Dart default
.packages # mapping file from package names to local path
packages # until `--no-package-symlinks` is the default
build/ # contains the output of `pub build`
.pubspec.lock # controversial - Dart guideline is to only commit
# for applications but not for packages
.pub/ # cache files generated by `pub`
# .pub was moved to .dart_tool/.pub
build The new https://github.com/dart-lang/build package introduces a
.dart_tool/
directory which should be excluded.
When it comes to generated files it is generally best to not submit them to source control, but a specific Builder may provide a recommendation otherwise.
IDE
.idea # IntelliJ, WebStorm
bazel
/bazel-*
.bazelify
packages.bzl
BUILD
WORKSPACE
See also
https://github.com/github/gitignore/blob/master/Dart.gitignore
https://www.dartlang.org/guides/libraries/private-files
An up to date sample Dart .gitignore is available in the gitignore repo on Github:
https://github.com/github/gitignore/blob/master/Dart.gitignore
Note that this does not contain IDE or editor files, just Dart files. You can find IDE and editor .gitignores in the same repo.
I include doc/api in my .gitignore. I tend to write substantial documentation comments and I like to use dartdoc to generate the documentation for review.
I want to share a latex document via git with many other people.
Therefore we decided to put all the special sty files, that are not present in everyones latex-installation, into a resources directory. It would be cool, if this dir would be a superdir. of the actual working directory
How exactly can I import those style files?
It is important that even the dependencies of those remote styles are resolved with other remote styles.
You can import a style file (mystyle.sty) into your document in two ways:
If you have it in your path or in the same folder as the .tex file, simply include this line in your preamble: \usepackage{mystyle}
If you have it in a different folder, you can access using its full path as \usepackage{/path/to/folder/mystyle}
That said, if you're not sure if the style file is in everyone's installation, simply include it in the same directory and make sure you do git add mystyle.sty and track it along with the rest of your files (although most likely there won't be any changes to it). There is no need for a parent directory. But if you insist on a different directory, see option 2 above.
It would be better if it were in a subdirectory than in a parent directory, as you can still call the file as \usepackage{subdir/mystyle} and be certain that you are invoking your style file. However, if you escape out to the parent directory, you never know if the other users have a similarly named folder that is not part of your package, which can result in errors.
This probably isn't relevant to you any more, but here is another way to do what you want.
Set up your git repository like this:
mystyle.sty
project/
makefile
project.tex
and put \usepackage{mystyle} in the preamble of project.tex.
Compiling project.tex manually won't work, of course, because mystyle.sty is not in the same directory as project.tex.
However, if makefile contains something along the lines of:
project.pdf: mystyle.sty project.tex
pdflatex project
mystyle.sty: ../mystyle.sty
cp ../$# $#
then running make from within the project directory will cause mystyle.sty to be copied to the correct place before project.tex is (this time successfully) compiled.
This way might seem a little bit over the top, but it does combine the best features of other methods.
If several projects in the same repository require mystyle.sty then having a common mystyle.sty sitting above them all makes more sense than having a copy in each project directory; all these copies would have to be maintained.
The compilation is portable, in the sense that if you gave me your copies of mystyle.sty and project.tex then I would (in theory at least) be able to compile manually without needing to modify the files you gave me.
For example, I would not have to replace \usepackage{/your/path/mystyle} with \usepackage{/my/path/mystyle}.
You can use Makefiles as suggested above. Another option is CMake. I didn't test for parent directories.
If you have the following file structure:
├── CMakeLists.txt
├── cmake
│ └── UseLATEX.cmake
├── img
│ └── logo.jpg
├── lib
│ └── framed.sty
└── main.tex
you should have CMake installed, instructions on CMake resources
UseLATEX.cmake can be downloaded from here
then inside the CMakeLists.txt
╚═$ cat CMakeLists.txt
cmake_minimum_required (VERSION 2.6)
set(PROJECT_NAME_STR myProject)
project(${PROJECT_NAME_STR})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(UseLATEX)
ADD_LATEX_DOCUMENT(main.tex
IMAGE_DIRS img
DEFAULT_PDF
MANGLE_TARGET_NAMES)
Some example content for main.tex (note the image)
╚═$ cat main.tex
\documentclass{report}
\begin{document}
\begin{center}
\includegraphics[width=300px]{img/logo.jpg}
\end{center}
\end{document}
The lib directory has the *.sty files
You can now compile:
cd /directory/that/has/CMakeLists.txt/
mkdir build
cd build
cmake ..
make
you can then view main.pdf which is in the build directory.
When you use TeX distribution that uses kpathsea, you can use the TEXINPUTS environment variable to specify where TeX is looking for files. The variable needs to be used in the following way.
The paths in TEXINPUTS are separated by :. An empty path will include the default search paths, i.e., just the colon. Two consecutive slashes means that the directory and all sub-directories are searched.
Thus, e.g., to build a file document.pdf which uses files in the current directory, all sub-directories of the resources directory and the default directories, you can use the following Makefile.
document.pdf: document.tex
TEXINPUTS=.:./resources//: pdflatex document.tex
To speed up the filename lookup, you can build a ls-R database using the mktexlsr command.
For all the details on kpathsea take a look at the manual.
You can use latexmk and its facilities
There is a feature documented under Utility subroutines on page 48 here in latexmk which can update TEXINPUTS during a run. If you can consider to use the .latexmkrc file to configure your chain and options, you can add ensure_path() to the file:
Here is an example:
# .latexmkrc
ensure_path('TEXINPUTS', './path/to/something//', '/full/path/to/something/else//')
# [...] Other options goes here.
$pdf_update_method = 3;
$xelatex = 'xelatex -synctex=1 -interaction=nonstopmode -file-line-error %O %S';
$pdf_previewer = 'start "%ProgramFiles%/SumatraPDF/SumatraPDF.exe" %O %S';
$out_dir = 'build/';
Notice the // at the end of a path, This will aid LaTeX to search for files in the specified directory and in all subdirectories.
Please note that while this is an amazing feature, you need to take good care of your naming scheme. If you use the same file name several places, you can run into trouble when importing them with, say \include{somefile}.