I've created a symbolic link to my WordPress theme root from my system root - so in / I have
mytheme -> /Applications/MAMP/htdocs-wordpress/wp-content/themes/mytheme
I use this all the time to quickly get to my theme root in Terminal. But I very often also want to navigate from there up to a higher directory in the WordPress hierarchy, like wp-content. When I run cd .. Terminal takes me back up to /. Is there any easy way to jump up the file hierarchy instead of to the "parent" of the symbolic link? Or any way to get an alias of my theme root that will allow this?
I would go with an alias, it makes things easier. Put this into your $HOME/.bashrc or $HOME/.bash_profile file:
alias mytheme="cd /Applications/MAMP/htdocs-wordpress/wp-content/themes/mytheme"
After that, either source it in your current terminal source $HOME/.bashrc or open a new Terminal window. This is available for any Terminal window you open and you can navigate easily from there. Another advantage is, that you don't have this symlink in your / directory.
Jumping into the directory of your theme is done by calling the name of the alias:
user#machine> mytheme
And if you want to navigate one directory back, just do it the usual way:
user#machine> cd ..
user#machine> pwd
/Applications/MAMP/htdocs-wordpress/wp-content/themes
Related
I have started using Mac for the first time and I am trying to set up flutter. One of the steps is to add path in file .zshrc. For this I have to first create this file. In Windows, whenever I had to create file, I used Git Bash and use touch <filename> in any directory and the file was created. Some websites mention that touch works in Mac terminal also.
How to create this file in home directory? I tried going to the home directory using cd ~ and then touch .zshrc and touch ~/.zshrc but they don't seem to work. I also tried to save file with this extension using TextEdit but doesn't work either. I have checked Show all filename extensions in Finder > Preferences > Advanced.
So what is the way to create this file in home directory either using Finder or terminal?
Sublime Text editor has in DMG file link to Applications dir (blue icons with arrow). It has small size.
How to make such link on my own folder? It must work in all Macs.
Open the terminal, use cd to open the folder where you want to create the symbolic link (this is how that kind of link is called, in case you want to research a bit more about it). Example:
cd /Users/MyUser/Desktop/
Note: In case the path has spaces, write it with backslashes before each space, like that:
cd /Users/MyUser/Desktop/My\ Folder/
Then, use that command to create it:
ln -s /Applications/ Applications
It will create a symbolic link which opens the path /Applications/, which means that it will work in any macOS computer.
Reference:
https://apple.stackexchange.com/a/115648
I'm using MacVim with the ctrlp plug in for a file finder. It's supposed to load files in just the current directory to the file buffer. For example, I used to be able to cd into a directory, and then type mvim at the command line. That would load all the files in the current directory and only that directory, which was awesome for, say, a Rails project. Then my file finds would only search in that directory.
Recently, though, when I type mvim in a certain directory, the vim file buffer is all the files on my computer, rather than in the current directory, so finding the exact index.html.haml I need is impossible.
The weird thing is that when I say mvim ., it only tells me the files and folders in the current directory, which I would expect. And when I type :pwd, it tells me that the path I'm in is the current directory (a Rails project). But when I type ,t to find a file, it's all the files on my computer.
Here is a screenshot. I've cded into a Rails project and have typed ,t to bring up the file navigator using the ctrlp plugin, and I typed config.rb which should only bring up that directory's config.rb file, but instead, it's all the config.rb's on my system!
I went to the GitHub page for ctrlp to file an issue and came across this issue. The suggested fix for an issue was to turn off starting in the current directory as a default behavior, so I just explicitly added the default to ~/.vimrc, which fixed it:
let g:ctrlp_working_path_mode = 0
EDIT
While adding that line to my ~/.vimrc did indeed fix the problem, it didn't address the root cause of this issue. The creator of the ctrlp suggested that I had created a git repository in my home folder (which ctrlp was looking in), which I somehow had. So another, more root fix for this issue was to just remove the .git directory in my home folder:
$ rm -r ~/.git
Try this:
let g:ctrlp_cmd = 'CtrlP .'
Within the finder I can view the contents of User/Library and can see many folders there, however I cannot see a folder called LaunchDaemons.
However if I navigate to the Library folder from the terminal command line then LaunchDaemons is visible.
How can I make it appear in the Finder?
I've tried this command but it didn't have any effect
defaults write com.apple.Finder AppleShowAllFiles YES
There is (at least by default) no LaunchDaemons folder in the user Library. You may be navigating to one of the other Library folders in Terminal. You can check this with the commands pwd (which prints the full path to the current folder -- if it doesn't start with /Users/youraccountname/Library, you aren't in your user Library) and open . (which opens the current folder in the Finder -- and again, I'm pretty sure it won't be inside your user Library).
I downloaded color sample pack from http://vim.sourceforge.net/scripts/script.php?script_id=625
it says i should unzip and place it into ~/.vim but where is this folder? I tried unzip it to my usr/share/.vim folder but it is not working, I don't see themes added to gvim Edit>color scheme menu, and i tried "colorscheme sometheme", "color sometheme" in my gvimrc. Both not working for new themes
Isn't the ~/.vim should be the .vim folder in use/share? or I should create a new folder under home?
Note:there is a folder vim73 in my .vim, I guess this doesn't affect anything
thanks for any help!
First of all, open vim, and get help from :help colorscheme
:colo[rscheme] {name} Load color scheme {name}. This searches 'runtimepath'
for the file "colors/{name}.vim. The first one that
is found is loaded.
After reading the manual above.
Take the following steps maybe help you:
find runtimepath
:set runtimepath?
It will print out run-time paths:
runtimepath=~/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim71,/usr/share/vim/vimfiles/after,~/.vim/after
create directory called colors under one of them if not exist(for example: ~/.vim)
$ ls ~/.vim
ls: cannot access /root/.vim: No such file or directory <== we need create it!!!
$ mkdir -p ~/.vim/colors
copy your color.vim to your colors directory
$ cp /path/to/your/color.vim ~/.vim/colors
restart vim to use new colorscheme
:colorscheme color
(optional) put command above to ~/.vimrc file to make it permanent
In UNIX parlance, ~ represents your home folder which is /Users/<username> in Mac OS X.
You are supposed to put all your custom scripts/colorschemes/whatever in a .vim folder situated in your home folder. In Terminal.app, type each line (without the $) then hit Enter:
$ cd
to be sure you are in your home folder
$ mkdir .vim
here you'll have an error message if ~/.vim already exists; if you don't receive a message it means that the folder is created
$ cd .vim
to move into it
$ open .
to open a Finder window here. At this point you should follow specific indications.