Add a .gitignore file
David Blume

David Blume commited on 2015-11-30 19:56:09
Showing 5 changed files, with 58 additions and 13 deletions.

... ...
@@ -3,3 +3,5 @@
3 3
 	email = david.blume@gmail.com
4 4
 [push]
5 5
 	default = simple
6
+[core]
7
+	excludesfile = ~/.gitignore
... ...
@@ -0,0 +1,43 @@
1
+### C++ ###
2
+# Compiled Object files
3
+*.slo
4
+*.lo
5
+*.o
6
+*.obj
7
+
8
+# Precompiled Headers
9
+*.gch
10
+*.pch
11
+
12
+# Compiled Dynamic libraries
13
+*.so
14
+*.dylib
15
+*.dll
16
+*.a
17
+
18
+### Python ###
19
+# Byte-compiled / optimized / DLL files
20
+__pycache__/
21
+*.py[cod]
22
+*$py.class
23
+
24
+### SublimeText ###
25
+# cache files for sublime text
26
+*.tmlanguage.cache
27
+*.tmPreferences.cache
28
+*.stTheme.cache
29
+
30
+# workspace files are user-specific
31
+*.sublime-workspace
32
+
33
+# sftp configuration file
34
+sftp-config.json
35
+
36
+### Vim ###
37
+[._]*.s[a-w][a-z]
38
+[._]s[a-w][a-z]
39
+*.un~
40
+Session.vim
41
+.netrwhist
42
+*~
43
+
... ...
@@ -24,7 +24,7 @@ If you're not cloning the repo, then run the following:
24 24
     dotfiles$ tar -xvf dotfiles.tar
25 25
     dotfiles$ rm dotfiles.tar
26 26
 
27
-Then, when you run `setup.sh`, it'll backup your old files to `backup_of_orig_dotfiles_<date>`
27
+Then, when you run `setup.sh`, it'll backup your old files to `backup_of_dotfiles_<date>`
28 28
 and replace them with the ones here.
29 29
 
30 30
     dotfiles$ ./setup.sh
... ...
@@ -47,6 +47,7 @@ See [config.dlma.com](http://config.dlma.com) for more.
47 47
         7. [visual-star-search](http://got-ravings.blogspot.com/2008/07/vim-pr0n-visual-search-mappings.html), so * and # work in visual mode too.
48 48
         8. Assorted favorite colors like [desert](https://github.com/dblume/desert.vim).
49 49
 3. .gitconfig (but it needs vimdiff and github settings.)
50
+4. .gitignore
50 51
 
51 52
 #### What's not installed
52 53
 
... ...
@@ -1,22 +1,20 @@
1 1
 #!/usr/bin/env bash
2 2
 set -eu -o pipefail # See: https://sipb.mit.edu/doc/safe-shell/
3 3
 
4
-declare -r backup_dir=$HOME/backup_of_orig_dotfiles_`date "+%Y-%m-%d"`
4
+declare -r backup_dir=$HOME/backup_of_dotfiles_`date "+%Y-%m-%d"`
5
+declare -a dotfiles=(".bashrc" ".bash_profile" ".gitconfig" ".gitignore")
5 6
 
6 7
 if [ ! -d $backup_dir ]; then
7 8
     mkdir -p $backup_dir
8 9
 fi
9 10
 
10 11
 # Move original dot files to backup
11
-if [ -e $HOME/.bashrc ]; then
12
-    mv $HOME/.bashrc $backup_dir
13
-fi
14
-if [ -e $HOME/.bash_profile ]; then
15
-    mv $HOME/.bash_profile $backup_dir
16
-fi
17
-if [ -e $HOME/.gitconfig ]; then
18
-    mv $HOME/.gitconfig $backup_dir
12
+for i in "${dotfiles[@]}"
13
+do
14
+    if [ -e $HOME/"$i" ]; then
15
+        mv $HOME/"$i" $backup_dir
19 16
     fi
17
+done
20 18
 if [ -d $HOME/.vim ]; then
21 19
     mv $HOME/.vim $backup_dir
22 20
 fi
... ...
@@ -26,9 +24,10 @@ echo Note: Your old dotfiles are backed up to $backup_dir
26 24
 # Move new dot files in.
27 25
 # If you cloned the repo, consider making symbolic links instead,
28 26
 # to more easily keep this home directory current by pulling updates.
29
-cp .bashrc $HOME
30
-cp .bash_profile $HOME
31
-cp .gitconfig $HOME
27
+for i in "${dotfiles[@]}"
28
+do
29
+    cp "$i" $HOME
30
+done
32 31
 cp -r .vim $HOME
33 32
 
34 33
 # Make a directory for vim undo
35 34