Customizing Zsh + Oh My Zsh but can't get updates - terminal

I am a newbie with Zsh + Oh My Zsh and have my prompt set to randomly choose between a couple of themes.
ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "kafeitu" "avit")
However, I've customized these a bit to make them more like the way I want them.
A side-effect of this is that now, when I get prompted to update Zsh, I cannot:
[oh-my-zsh] Would you like to update? [Y/n] Y
Updating Oh My Zsh
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
There was an error updating. Try again later?
How can I have customized themes and still maintain the repo such that I can pull down updates?
Thanks.

It turns out there's a custom folder at ~/.oh-my-zsh/custom directory just for this purpose.
To customize one of the many themes, you just copy a theme in the main theme directory at ~/.oh-my-zsh/themes to ~/.oh-my-zsh/custom/themes and edit it as you like. The setting in .zshrc for ZSH_THEME="[theme name]" will look into this custom area first before looking in the main themes folder.
Documentation: https://github.com/ohmyzsh/ohmyzsh/wiki/Customization#overriding-and-adding-themes

Related

Activate/deactivate conda virtualenvs on entering/leaving directories

pyenv-virtualenv offers a nice way of activating the environment on the very instant of entering or leaving the directory which contains a .python-version text file which specifies the environment to activate. It works for the directory it is in and all directories contained in it.
The environment is deactivated once we change the directory to something above it. This allows to easily switch between projects or analyses using different python versions (just by changing the directories).
Is there a way of achieving the same behaviour with (ana)conda?
Edit: added bash tag, because - as far as I understand - pyenv achieves this by hooking a custom script into .bashrc (which allows it to monitor the directory changes). If there is no build-in way in conda, how to create a script which would make it possible?
As mentioned in my comment, this is currently not supported. There is however an open issue on conda's GitHub asking for this feature.
In the meantime you could use autoenv, a small tool that'll automatically run the code in a .env file when entering a directory and that in a .env.leave when leaving the directory (supports bash/zsh and a couple others).
A simple example taken from their readme which illustrates the feature quite nicely:
$ echo "echo 'whoa'" > project/.env
$ cd project
whoa
To load a conda environment your .env would simply look like this:
conda activate <my_env>
Note 1: Check out the Configuration section of their GitHub readme before you start using it.
Note 2: The author of autoenv actually suggests trying direnv instead. However I've never used it, so I can't comment on it.
From autoenv's readme:
you should probably use direnv instead. Simply put, it is higher quality software. But, autoenv is still great, too. Maybe try both? :)

Suddenly can't commit using GIT desktop

For some apparent reason i can't commit to a new repo which i just made.
Git for desktop says the following:
Trying the first line in cmd gives the following error...
There indeed is no folder in Roaming called 'SPB_Data', nor would i know what it is for or why git even gets pointed that way..
I've tried a lot of things already and can't find anything that seems to help.
It seems that the git installation got messed up for some reason, i think...
How do i fix this?
I'm on windows 10
Some software set probably set you %HOME variable wrongly. Refer to the comment on this answer. And then you probably have to set your %HOME to the correct directory, as explained in this answer to the same question.
As said in my comment :
have you tried to re-install git, maybe your installation failed? and for the
first error its normal , git just wants you to specify your username and email
to show who comited on the repository
To clarify the problem: your git installation normally set a %HOME% Variable but its pretty unreliable and probably the root of your problem. As shown in your error message git can't find the config files with your %HOMe% variable so you need to manually change it or re-install git.
As seen in this answer https://stackoverflow.com/a/4051282/7141618 , you can verify where your %HOME% path points to and if its the wrong directory you can change it using the windows tool like in this link: https://www.computerhope.com/issues/ch000549.htm , to sum it up open you settings, then click on advanced system setting, open the advanced tab and there should be a environement variable button that you can click to edit them.Finally just edit the %HOME% path to fit your git installation folder

Source ~/.vim directory from another location than home directory

To install ~/.vimrc on a system-wide level, I execute vim --version and look where I can put it.
But what steps do I have to take in order to change the location of the /.vim directory containing e.g. autoload with pathogen, plugins, etc.? The more I think about it, the less I understand why it is sourced at startup anyhow.
take a look the /etc/vimrc and /usr/share/vim or /usr/share/vim74 But it is not good to change those files. Because next time you upgrade vim, those files could be overwritten by your package manager, unless you do this manually or never update vim.
edit
Just noticed that the question was tagged with osx.... the above text is based on linux. If it doesn't help, I am gonna remove it.

Rake w/Git says 'fatal: Will not add file alias' but I can do it manually?

I've got an odd problem. Using Octopress on OS X, which uses a Rakefile (ruby) to setup deployment folders and such with a unique Git repository structure.
The problem is this line:
system "git add -A"
...in the Rakefile generates this error:
fatal: Will not add file alias 'blog/{obmitted-dir-name}/index.html' ('blog/{OMITTED-DIR-NAME}/index.html' already exists in index)
Ok, so this sounds like a casing issue and I should issue:
$ git config core.ignorecase false
Nope, still the same error and I've verified it is set to false now. So then I issue:
$ git config --global core.ignorecase false
Still no go.
And now for the odd part... I can manually change directories to my _deploy/ dir and issue the command manually:
_deploy/$ git add -A
No problem!
I've verified this numerous times... The Ruby Rakefile cannot issue git add -A, whereas I can do it manually.
I even stopped the script directly on that step and did it manually.
Does Ruby have a different Git environment it runs from?
Is OSX case insensitive even with setting that git flag? If so, that's my problem and I'll never be able to deploy from OSX (just like I can't deploy from Windows): I have upper and lower case aliases for 404s to redirect.
It turns out the issue is indeed that OSX is case-insensative (I didn't know this!) - which in turn doesn't allow git to perform the aliases of different casing.
That's the same issue I had on Windows and is why I moved to Linux. Looks like I'll have to keep a Linux VM handy to handle updates to my static blog (Octopress/Jekyll) cause I do have traffic on both casing of the urls.
If you are reading this and want to remain on OSX with mixed-case blog posts, the answer would be to create a virtual disk that has case sensitivity, mount it permanently and move your Octopress/Jekyll install to it. See: https://gist.github.com/dixson3/8360571
As mentioned in the other answer: macOS (standard hard drive partition) is case insensitive. That means your local git should be the same too.
So, do not do git config core.ignorecase false as that will mess up the things more. Also, if you rename a folder to uppercase, git doesn't track the change, except if you change the files included. So, it is very easy to miss that.
The solution that worked for me is:
Copy all the folder in your case "blog" to a safe place.
Delete with git rm -rf both folders ({obmitted-dir-name} and {OMITTED-DIR-NAME}).
Add and commit the changes.
Create the blog folder again and paste your content with the folder name you want to keep.
Add and commit the changes.
You will need to do that in all related branches too.

How to initialize sparkup plugin in Vim for MacOS?

Im new to Vim and am having trouble installing the sparkup plugin found at https://github.com/rstacruz/sparkup. I've copied the contents of the zip into the ftplugin folder and have tried to expand the div tag by pressing command e but appears.
Im stumped, any assistance would be appreciated
Make sure you have filetype detection enabled. That was the issue I ran into a while back on sparkup, with similar symptoms.
Try adding the following to your ~/.vimrc:
filetype indent plugin on
Most of the time, vim plugins come with specific help files, it does not seem to be the case for that one...
You can check the following things :
This a "file type" plugin : so it will only trigger when you are editing a *.html file. So make sure you're not doing your test on a new buffer but on a previously saved .html file.
Regarding your installation and the path of the sparkup files, make sure than sparkup.py and sparkup.vim are in ~/.vim/ftplugin/html (and not something like ~/vim/vim/ftplugin/html) or it won't work
Type :scriptnames it will list all loaded plugin : so somewhere in that list you should see sparkup.vim, if not it means it is not correctly installed or detected by Vim.
Regarding the shortcut to invoke sparkup, it seems to be <CTRL>e.
You can use vim version of Sparkup tailored for easy installation https://github.com/pyp/vim-sparkup.
With Pathogen
cd ~/.vim/bundle
git clone 'https://github.com/pyp/vim-sparkup.git'
With Vundle. Add this to .vimrc:
Bundle 'pyp/vim-sparkup'

Resources