EzDev.org

dotfiles

Shell Config


homesick: sync modified zsh themefiles

I am using homesick to push my dotfiles to github. I have made some modifications to the wedisagree theme for oh-my-zsh and would like to have this handled by homesick as well.

If a add this file in my homesick folder ~/dotfiles/.oh-my-zsh/themes/wedisagree-modified.themes and let homesick pull the newest version from github and afterwards symlink them, it overwrites the complete ~/.oh-my-zsh folder with my theme file being the only file left. This obviously breaks oh-my-zsh as all the files in the folder are now missing.

I guess I could add the complete .oh-my-zsh to git, although this seems like a waste. How can I add only this one file and let homesick handle the resolution?


Source: (StackOverflow)

Where should dotfiles go in a collection of chef cookbooks?

We're slowly moving our infrastructure over to chef and building a collection of cookbooks on the way.

One thing I'm not sure about is where node / role / user specific dotfiles should go.

For example, we could use the rbenv cookbook to install rbenv for several users,
User A may not want rdoc documentation so would want a custom .gemrc file.

Where should this go?
We could put the file contents in node / role specific JSON file, or in a data bag but this doesn't feel right.

Is there a way to include the actual file in a way that is not for the general cookbook, but rather for the specific node / user?


Source: (StackOverflow)

Why does .lesshst keep showing up in my ~

I never use less, and have always used more. It is what I was introduced to, which is probably why I use more more instead of using less more. ( Sorry, that is going to sound a bit of a mess :) )

I just tried less and couldn't even quit out of it, until I realized it took a vi/vim style command. At least, I believe that is what happened.

By in ~ there is always a .lesshst file, which I rm all the time, as I would prefer to use more or nano for simple stuff and I can use TextMate for simple text editing, or Sublime or whatever else I am in the mood for.

I also just noticed ".jbapps-myusername" is in ~ now as well. This showed up 2 days ago, and I don't recall installing anything strange. Any idea what it is? I have never jailbroken my phone, and don't install hacks on my machine. Those things that do go into that grey area are getting played with in a VM, not on the core of the machine I am working on as my main computer.

$file .jbapps-haneda 
.jbapps-haneda: ASCII text, with no line terminators

The contents of the .jbapps-* file are "483^@" with no leading or trailing newlines, carriage returns etc.

Then there is my git issue. I have a .config directory, inside it is a "git" dir, which inside that is a file called "ignore", which as far as I can tell, is near identical to .gitignore_global. Did git create .config, or is this a convention that other apps use as well?

That brings me to my final issue, in ~ I have .gitignore_global, .gitconfig, and also .config/git/ignore

Seems a mess to me, I would love to mv .gitignore_global .gitconfig .config/git Is there a config somewhere that I can define these locations? It's all just a mess of dot files, it would be so much nicer if ~ simply had .config and all the dot files were in there. I can live with .ssh as it is a directory, so there is at least an effort to not litter my home dir. But raw dot files kind of get in my way. I know I can ls -l and not show the dot files, but I think seeing all your files all the time is a good way to learn what has been created that you might not be aware of.

Thank you.

Suggestions?


Source: (StackOverflow)

In Eclipse 3.5 (and with the Aptana plugins), how do I get a view that I can use to show my project, including "dot" files?

I've managed to get the various project explorer views to show dot files, such as .htaccess, but if I ever close the project and reopen it, the dot files no longer show up in the view. Am I missing a view that lets me show the dot files or is there some kind of configuration option that I can toggle? I've tried a few things over the past few days, but I'm not sure what they were, since I really didn't keep track.

Suggestions?


Source: (StackOverflow)

Add newline after output of every bash command

I'm in the process of customizing my terminal.

Currently, I have the following:

http://d.pr/i/crBm

What I want is a newline after the output of every command, like this:

http://d.pr/i/NVX5

The only way I have been able to accomplish something close to this is by adding a newline at the beginning of my PS1. This works, but it annoys the hell out of me that the first time I open up a bash prompt, there is a newline above the very first line. Is there any other way to accomplish this?


Source: (StackOverflow)

Is It A Bad Practice to List Ruby Version in Both Gemfile and .ruby-version Dotfile?

My latest Rails project is more or less and experiment for me to break lots of things and learn in the process. I have the latest version of Ruby specified in my gemfile:

ruby '2.2.3'

And I also have a .ruby-version dotfile in the project, with the following contents:

2.2.3

Other than the obvious duplication, what is wrong with this? What is the purpose of both conventions? If I should only have one convention for listing my Ruby version, why should I have one (Gemfile) over the other (dotfile)?

Is it perfectly fine to have both conventions in a project?

I am going to be the only maintainer of this experimental project, and dont feel it will be an issue having to maintain this one subtle duplication. I dont intend to upgrade Ruby for this project, and if I do, I wont have an issue remembering to do it in both places. Other than this detail, I certainly avoid any such duplication in my applications' codebases.


Source: (StackOverflow)

Terminal Mathias’s dotfiles .functions

I recently got Mathias’s dotfiles on my terminal, and I mainly have two questions about this repo.

First: I can't make my custom aliases / functions get to work. I writing them in the default location of Mathias’s dotfiles, in .aliases / .functions. I do reload .bash_profile after I added and saved the code.

Second: How can I keep up to date with updates automatically while in the meanwhile I have custom aliases and functions setup in .aliases / .functions at the default location of Mathias’s repo. ( /Users/TheSpiritMolecule/dotfiles )


Source: (StackOverflow)

How to treat a local dotfile repository?

As many others, I want to have a git repository with my configuration files and also upload a backup of it to a hosting site. My question is how to treat the dotfiles of the local repo.

Let's say that I have my zshrc/bashrc in the dotfiles repo. I can put the line 'source /path/to/local/repo/zshrc' to my ~/.zshrc file and everything's fine. Same thing with vimrc.

But what about those dotfiles that doesn't support such a command? Should I have the same content in both ~/.conffile and /pathtolocalrepo/conffile and when I make a change to one of them update the other file? Or is there a smarter way?

What's the common practice?

Also where this local repository is located usually (on Linux)? I don't think home folder is the right place to put it (config files should be available to other users too), but which place suits it best?

Thanks in advance.


Source: (StackOverflow)

Partial branch or partial merge or other way to help me to sync dotfiles?

I don't know how to make my requirement short in title, sorry if it is not meaningful. I will explain here:

Many people put their dotfiles on bitbucket or github, to ease later installation or configuration, sync over different pc. I did the same, however I want to do something special, I am not sure how mecurial/git could help.

What I have:

I have 3 machines, say Home, Office and Client, all linux OS (could be different distributions). To make the example simple, say I just want to put one file the .zshrc into repo. The problem is, the three OS have different system variables(or other settings). e.g.

  • Office has JBOSS installed, then in .zshrc I need export JBOSS_HOME var.
  • Client has Oracle installed, then export different set of vars.
  • Office has to export HTTP_PROXY, but HOME not, Client needs it too, but different proxy value etc.

Now what I did is, I extract those machine specific settings (mostly export, alias statement) to another file, say myVar.sh. and source it at the end of the .zshrc.

So 3 machines have common part (same .zshrc), and different parts (myVar.sh).

What I want:

  • on any machine, if I found some nice settings, I change the .zshrc file (common part) and push. The changes should be easily sync to other machines (by pull, for example)

  • if I changed the myVar.sh (different part) on HOME, and push, it should not affect Office's myVar.sh if I do pull on Office machine.

What I am doing:

now I have one Repo on bitBucket, and three branches (H,O,C). On Home PC, I just play with Home branch. Same for Office, Client.

The problem is, if I changed the common part on one pc, the change is in its own branch, a little bit difficult to sync to the other two. Because I would never merge those branches.

I also think about to mk different directories for different pc. e.g.

/.zshrc
|--/HOME/myVar.sh
|--/Office/myVar.sh
|--/Client/myVar.sh

and write shell script, e.g. check $HOST to decide writing myVar.sh to which directory. but I doubt that if it is the best way to achieve my goal. And when I look my dotfiles dir, I see all 3 pcs' setting. I should be careful and enter the correct one to read the file.

In real world, the common part contains much more than .zhsrc (tmux,vimrc,xdefault..), so does the different part.

I don't know can we somehow make a partial branch or do a partial merge on a repository...

I use hg much more than git, if hg can solve it I would prefer hg, if not, git is also acceptable. I don't have much git experience except for clone, push, pull, up, merge,ci.

now, how should I do?

and, thank you for reading this...


EDIT more about the different part

I would thank you all guys for giving me answers. As I said above, the different part in my real machines is not as simple as myVar.sh. For example, I take my company-laptop (Office) to different clients (There are about 6 clients, not all clients provide us PCs, it is good because I could work with Linux everywhere), and configured printers for each by cups. I would put those configurations in Repo too. Because if one day I have to refresh my system, or harddisk failed, I could setup those printers very easy. Other things that belongs to different part but I cannot simply "source xxx" like

  • Xorg.conf for trackpoint
  • .hgrc file (since in company we have our own repo, uid, pwd, proxy..)
  • some pre-configured systemd modules, basically .conf files. But machine specific, e.g. radeon.conf only for my Home laptop. And Client pc has no systemd installed at all.

    That's why I thought about different directory for PCs.

As I said right now I am with 3 branches way, and have a myConf directory, within this directory I have getConf.sh, to copy dotfiles, different confs etc to myConf. In fact the getConf.sh belongs to different part too, because the script is not same for all pcs.

Therefore I think the if-else/switch then source may not work in this case.

Yesterday I just took the .zshrc, and try to make the example simple. If it mislead you guys, sorry about that.


Source: (StackOverflow)

What is a proper way to pass a parameter to Set-Alias in powershell?

A little background:

I use PowerShell on windows xp at work and I set a bunch of useful shortcuts in Microsoft.PowerShell_profile.ps1 in My Documents, trying to emulate Mac environment inspired by Ryan Bates's shortcuts

I have things like:

Set-Alias rsc Rails-Console
function Rails-Console {Invoke-Expression "ruby script/console"}

Which works just fine when in command prompt I say:

rsc #it calls the proper command

However this doesn't work properly

Set-Alias rsg Rails-Generate
function Rails-Generate {Invoke-Expression "ruby script/generate"}

So when I do :

rsg model User

which is supposed to call

ruby script/generate model User

all it calls is

ruby script/generate  #Dumping  my params

So how would I properly modify my functions to take params I send to functions?

Thank you!!


Source: (StackOverflow)

Using bash to automate dotfiles

I want to create my own automated dotfiles folder. (I'll be using git to use version control on my dotfiles, but that's irrelevant for the question)

What i simply want is to symbolically link all the files and folders in ~/dotfiles to my home folder. Being not good at all with bash I can't do this. Please help me with this.

I would also appreciate the following features if possible.

  • Folders are only shallowly linked
  • My files could be in the dotfiles folder without the actual dot in the file-name (like ~/dotfiles/vimrc rather than ~/dotfiles/.vimrc)
  • It should be able to ignore some files, like my .git file which are stored in the same folder

Of course if you already know a service providing this, that is at least as good as providing some do-myself commands. Note how I specifically want it to be bash or something that most likely exists on all unix machines (so i guess commands using g++ are fine).


Source: (StackOverflow)

Should I use quotes in environment path names?

I'm in the process of cleaning up all my config files in an attempt to make them as readable as possible. I've been looking for a style guide on the use of quotes while exporting paths in, for example, a ~/.bashrc file:

export PATH="/users/me/path:$PATH"

vs

export PATH=/users/me/path:$PATH

The Google shell style guide suggests avoiding quotes for path names. In contrast, a lot of the popular dotfiles repos (such as Zach Holman's here) use quotes. Are there any situations when it is an advantage to use quotes in the path?


Source: (StackOverflow)

Bash find, exclude parent?

I have a folder with some dotfiles I would like to make symlinks for. I cannot see an easy way to do this.

ls -a ~/dotfiles will include the dotfiles, but also . and ..

find ~/dotfiles -maxdepth 1 will include the dotfiles, but also ~/dotfiles


Source: (StackOverflow)

Ruby list directory with Dir['*'] including dotfiles but not . and

How do I get Dir['*'] to include dotfiles, e.g., .gitignore, but not . and ..?

I.e., is there a better way to do:

`ls -A`.split "\n"

perhaps with Dir? The following solutions are close but both include . & ..:

Dir.glob('*', File::FNM_DOTMATCH)
Dir['{.*,*}']

So, the following works:

Dir.glob('*', File::FNM_DOTMATCH) - ['.', '..']

But, is there still a better way to do this?

I'm wondering this to fix line 9 of a Meteor Homebrew Formula.


Source: (StackOverflow)

Is there a guideline for Unix config files [closed]

Most config files are ini files (format: name=value\n). Is there any documentation or an article/guideline on this matter.

Or is anyone supposed to keep close to this format on good will?


Source: (StackOverflow)