How can I have sublime show hidden files in macOS? - macos

I already have finder showing hidden files by using
defaults write com.apple.finder AppleShowAllFiles YES
However, sublime text will not allow me to open hidden files still.
I'm looking for a programmatic way to accomplish this. So that I don't have to type a special key combination for each dialog.

Press "Command" + "Shift" + "." (dot) to show hidden files in the Mac OSX file chooser dialog.
You can also modify the folder_exclude_patterns setting. The default value for this is "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"]. In your case, you would want to make it "folder_exclude_patterns": [".svn", ".hg", "CVS"] You can access user settings by going to Preferences -> Settings - User

The defaults write command you entered only sets AppleShowAllFiles to true (or YES, they're equivalent) for Finder. To enable showing hidden files in all programs, enter
defaults write -g AppleShowAllFiles YES
The -g flag means "global", setting the AppleShowAllFiles attribute to true for all programs.
You'll have to restart Sublime after entering this command.

Related

MacOS how to hide the folders and files located on the desktop

I have folders and files on the desktop, I would like to make sure that when I take a screenshot or video recording of a program, the folders and files I have on the desktop are not seen.
Is there any command on the terminal that allows me to do this?
I need to hide everything only when I do the screen or the recording, and then return everything as before.
How can I do?
defaults write com.apple.finder CreateDesktop false && killall Finder
will hide all Files and Mounts, with
defaults write com.apple.finder CreateDesktop true && killall Finder
you can display them.
You have to invoke the commands from terminal
Tested wit Monterey 12.3

Why doesn’t my Laravel project show the .env file on a Mac?

Why doesn’t my Laravel project show the .env file on a Mac?
How to fix it?
If you would like to see hidden file in Finder just press CMD + SHIFT + .
you'r not showing hidden files
Open Terminal found in Finder > Applications > Utilities
In Terminal, paste the following: defaults write com.apple.finder
AppleShowAllFiles YES
Press return
Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock
and click Relaunch.
This will show all hidden files
here you can find how to show them on mac

How to see usr folder in mac when selecting files to open?

I need to open files in Xcode in the /usr but its invisible.
I already tried
defaults write com.apple.finder AppleShowAllFiles YES.
and restarted my finder but that didn't seem to work.
What should I do?
In the open file dialog box, you can hit Command-Shift-G and enter /usr in the Go To sheet.

Programmatically 'auto hide menubar' in El capitan

I really love the 'auto hide menubar' option in El Capitan, but sometimes I like it (private) sometimes I don't (work). Is there a way to show/hide it programmatically by changed it's value in a plist file? If so, in which plist file is that setting found? Any help is appreciated.
As answered by Rich Trouton on apple.stackexchange.com
Here's how you can set the menubar to be hidden and unhidden using defaults:
To hide:
defaults write NSGlobalDomain _HIHideMenuBar -bool true
To show:
defaults write NSGlobalDomain _HIHideMenuBar -bool false
Once run, logout and log back in. Alternatively, you can run the following command as the logged-in user to restart Finder and show the changes:
killall Finder
MacOs Sierra
As trevordmiller points out in the comment below, in Sierra it seems you have to close your terminal first to make the change have any effect.
As of 10.12.5 I am finding that #trevordmiller is only partially correct; Every application seems to need to be individually restarted to register the new setting. In other words, If I use:
defaults write NSGlobalDomain _HIHideMenuBar -bool false
killall Finder
this only shows the menu bar while Finder is active. To show it in other apps, I have to restart them. Killall Finder is not required in any way other than that it restarts Finder app and registers the setting for it. Same for restarting any terminal app.
From AppKit release notes:
NSApplication (New since WWDC Seed)
10.11 supports a new type of menubar behavior that hides the menubar during normal non-fullscreen interaction. The menubar shows itself
automatically when the mouse moves into a hot area at the top of each
display. When this mode is enabled, the
NSApplication.presentationOptions property will include the
NSApplicationPresentationAutoHideMenuBar value.
Prior to 10.11, the SetSystemUIMode API provided by HIToolbox, and the
setPresentationOptions API of NSApplication provided by AppKit, did
not allow explicitly enabling an auto-hiding menubar without also
hiding the Dock. -setPresentationOptions now allows the options to
contain AutoHideMenuBar without also including HideDock or
AutoHideDock. To ensure compatibility with existing applications, the
SetSystemUIMode API will only allow applications linked on 10.11 and
later to pass the combination of kUIModeNormal and
kUIOptionAutoShowMenuBar; if this combination is specified by an
application linked on Yosemite or earlier, the AutoShowMenuBar option
is ignored
You are looking for this bit. Flip it as you need.
typedef NS_OPTIONS(NSUInteger, NSApplicationPresentationOptions) {
/* Flags that comprise an application's presentationOptions */
NSApplicationPresentationAutoHideMenuBar = (1 << 2),
} NS_ENUM_AVAILABLE_MAC(10_6);
Too late. If it helps someone else, a shortcut could make it handy.
Open Automator -> Select Service -> Service receives selected text -> Select no input in any application -> Add Run Shell Script action -> Add the following lines.
bool=$(defaults read NSGlobalDomain _HIHideMenuBar)
if [ "$bool" == 0 ]; then
defaults write NSGlobalDomain _HIHideMenuBar -bool true
else
defaults write NSGlobalDomain _HIHideMenuBar -bool false
fi
Save it. (These steps creates a service that runs whenever the system boots.)
To give a shortcut,
Go to System Preferences -> KeyBoard -> Shortcuts -> Services -> Scroll to last to find General section -> Set a preferred shortcut for the service.
❯ /usr/bin/defaults write NSGlobalDomain _HIHideMenuBar -bool [true|false]
But you'll have to close instances of the Finder application, and fire it up again:
# `-g` don't bring app to foreground, `-a` specify app name
❯ killall Finder && open -ga /System/Library/CoreServices/Finder.app/
As a hotkey triggered script to toggle it on/off (hide/unhide):
if (( `/usr/bin/defaults read NSGlobalDomain _HIHideMenuBar` == 0 ));
then
/usr/bin/defaults write NSGlobalDomain _HIHideMenuBar -bool true \
&& killall Finder \
&& open -ga /System/Library/CoreServices/Finder.app/
else
/usr/bin/defaults write NSGlobalDomain _HIHideMenuBar -bool false \
&& killall Finder \
&& open -ga /System/Library/CoreServices/Finder.app/
fi
can be used with Alfred workflows, Hammerspoon, Keyboard maestro, Automator, etc.

Show system files / Show git ignore in osx

By default it is not possible to see .gitignore files in osx. What is command to reveal these files?
Open the terminal and type
on OS X 10.8:
defaults write com.apple.Finder AppleShowAllFiles TRUE
on OS X 10.9:
defaults write com.apple.finder AppleShowAllFiles TRUE
Then you must relaunch finder:
killall Finder
Any file name in OS X prefixed with a '.' is considered "hidden".
You can use the shortcut in Finder:
Command + Shift + .
It will show the hidden files.
To hide the files again, use the same shortcut.
⌘⇧. will toggle the AppleShowAllFiles setting.
This key combo will work from open/save dialogue boxes in all apps, not just the finder. Use this and you’ll never be confused when on someone else’s Mac or a new Mac, and you can avoid mucking around with defaults write.
I use the nemonic of “use a dot to show a dot file” to remember it, because of hidden dot files in unix.
if you just want to look at them you can always use the command line:
ls -al path/to/dir
If you want to always view all files from the finder you can do:
defaults write com.apple.Finder AppleShowAllFiles YES
If you just want to view a .gitignore from the finder you can:
chflags nohidden /path/to/dir/.gitignore
But youll have to call that command on every .gitignore its not global.
(more recent, for 10.10.2:)
The above commands didn't work for me. I'm using OSX Yosemite: 10.10.2.
This worked though:
defaults write com.apple.finder AppleShowAllFiles -boolean true;
killall Finder;
Source:
http://www.idownloadblog.com/2014/08/04/how-to-show-hidden-files-folders-finder-mac/
You can edit hidden file in terminal using this command
open -a TextEdit .gitignore
If you just want to view a .gitignore from the console just type "nano .gitignore" in that directory. This command "nano" simply opens any textfile in nano console environment for viewing or editing
In addition to the accepted answer, you can create an alias to easily show/hide the hidden files in Terminal. This is how I set it up (tested/working on macOS Mojave 10.14.1).
In my user directory I created a new file .custom_aliases and wrote this in:
# Show/hide files
alias showall='defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder'
alias hideall='defaults write com.apple.finder AppleShowAllFiles -boolean false; killall Finder'
Next I opened .bash-profile (should also be in your user directory, if not just create it there) and added this to the top of the file:
# Load custom aliases
source ~/.custom_aliases
And that's it! Now whenever I need to view the hidden files I just type showall in Terminal and hideall when I'm done. You could also define the aliases directly in the .bash_profile, but I have some other stuff so I like to keep all the aliases together in a separate file.
Show hide file and folder on MacOs Mojave 10.14.4
Apply at Terminal
defaults write com.apple.finder AppleShowAllFiles -boolean true;
killall Finder;
It's possible you might just not have a .gitignore file. If you don't have one, you can create it like this:
>touch ~/.gitignore
And then edit it however you'd like. Git will automatically check this file, without any additional configuration!

Resources