From 41cefe2dc164aee2f83bf807071f2bd15c08826a Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Mon, 22 Oct 2012 12:01:42 +0400 Subject: [PATCH] Refactoring and some tweaks. --- Readme.md | 4 ++++ .../{bash_aliases.sh => bash_aliases.bash} | 0 ...{bash_functions.sh => bash_functions.bash} | 0 includes/{bash_prompt.sh => bash_prompt.bash} | 0 sublime/User/SublimeLinter.sublime-settings | 6 ++++- sync.py | 24 ++++++++++++------- bash_profile => tilde/bash_profile.bash | 2 +- bashrc => tilde/bashrc.bash | 0 gitattributes => tilde/gitattributes | 0 gitconfig => tilde/gitconfig | 0 gitignore => tilde/gitignore | 0 hushlogin => tilde/hushlogin | 0 inputrc => tilde/inputrc.bash | 0 13 files changed, 25 insertions(+), 11 deletions(-) rename includes/{bash_aliases.sh => bash_aliases.bash} (100%) rename includes/{bash_functions.sh => bash_functions.bash} (100%) rename includes/{bash_prompt.sh => bash_prompt.bash} (100%) rename bash_profile => tilde/bash_profile.bash (98%) rename bashrc => tilde/bashrc.bash (100%) rename gitattributes => tilde/gitattributes (100%) rename gitconfig => tilde/gitconfig (100%) rename gitignore => tilde/gitignore (100%) rename hushlogin => tilde/hushlogin (100%) rename inputrc => tilde/inputrc.bash (100%) diff --git a/Readme.md b/Readme.md index eae93fc..ad5a96a 100644 --- a/Readme.md +++ b/Readme.md @@ -31,6 +31,10 @@ cd ~/dotfiles && git pull && ./sync.py * My magic project opener (`bin/opener.py`) * [Mac OS apps I use](https://github.com/sapegin/dotfiles/wiki/Mac-OS-Apps) +## Notes + +You can use any file extensions in `tilde/` to invoke proper syntax highlighting in code editor. + ## Further customization * Add any Bash profile customizations to `~/.bashlocal`. diff --git a/includes/bash_aliases.sh b/includes/bash_aliases.bash similarity index 100% rename from includes/bash_aliases.sh rename to includes/bash_aliases.bash diff --git a/includes/bash_functions.sh b/includes/bash_functions.bash similarity index 100% rename from includes/bash_functions.sh rename to includes/bash_functions.bash diff --git a/includes/bash_prompt.sh b/includes/bash_prompt.bash similarity index 100% rename from includes/bash_prompt.sh rename to includes/bash_prompt.bash diff --git a/sublime/User/SublimeLinter.sublime-settings b/sublime/User/SublimeLinter.sublime-settings index 765b300..da0140d 100644 --- a/sublime/User/SublimeLinter.sublime-settings +++ b/sublime/User/SublimeLinter.sublime-settings @@ -2,5 +2,9 @@ "sublimelinter_delay": 1, "sublimelinter_mark_style": "none", "sublimelinter_gutter_marks": true, - "sublimelinter_notes": true + "sublimelinter_notes": true, + "pep8_ignore": [ // https://github.com/jcrocholl/pep8/blob/master/pep8.py + "E501", // Line too long + "W191" // Indentation contains tabs + ] } \ No newline at end of file diff --git a/sync.py b/sync.py index e00ca4c..203565b 100755 --- a/sync.py +++ b/sync.py @@ -2,34 +2,39 @@ """ Dotfiles syncronization. -Makes symlinks for all files: ./bashrc will by available as ~/.bashrc. -Source: https://gist.github.com/490016 +Makes symlinks for all files: ./tilde/bashrc.bash => ~/.bashrc. +Based on https://gist.github.com/490016 """ import os import glob +import shutil + +SOURCE_DIR = 'tilde' +EXCLUDE = [] +NO_DOT_PREFIX = [] -EXCLUDE = ['tools', 'color', 'setup', 'sublime', ' sync.py', 'Readme.md', '.gitignore'] -NO_DOT_PREFIX = ['bin'] def force_remove(path): if os.path.isdir(path) and not os.path.islink(path): - shutil.rmtree(path, False, on_error) + shutil.rmtree(path, False) else: os.unlink(path) -def is_link_to(link, dest): + +def is_link_to(link, dest): is_link = os.path.islink(link) is_link = is_link and os.readlink(link).rstrip('/') == dest.rstrip('/') return is_link + def main(): - os.chdir(os.path.dirname(os.path.abspath(__file__))) + os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), SOURCE_DIR)) for filename in [file for file in glob.glob('*') if file not in EXCLUDE]: dotfile = filename if filename not in NO_DOT_PREFIX: dotfile = '.' + dotfile - dotfile = os.path.join(os.path.expanduser('~'), dotfile) + dotfile = os.path.join(os.path.expanduser('~'), os.path.splitext(dotfile)[0]) source = os.path.relpath(filename, os.path.dirname(dotfile)) # Check that we aren't overwriting anything @@ -47,5 +52,6 @@ def main(): os.symlink(source, dotfile) print "%s => %s" % (dotfile, source) + if __name__ == '__main__': - main() \ No newline at end of file + main() diff --git a/bash_profile b/tilde/bash_profile.bash similarity index 98% rename from bash_profile rename to tilde/bash_profile.bash index cedbf1e..d7a6b77 100644 --- a/bash_profile +++ b/tilde/bash_profile.bash @@ -38,7 +38,7 @@ export PATH # Load prompt and aliases for file in ~/dotfiles/includes/{bash_prompt,bash_aliases,bash_functions}; do - [ -r "$file" ] && source "$file" + [ -r "$file.bash" ] && source "$file.bash" done unset file diff --git a/bashrc b/tilde/bashrc.bash similarity index 100% rename from bashrc rename to tilde/bashrc.bash diff --git a/gitattributes b/tilde/gitattributes similarity index 100% rename from gitattributes rename to tilde/gitattributes diff --git a/gitconfig b/tilde/gitconfig similarity index 100% rename from gitconfig rename to tilde/gitconfig diff --git a/gitignore b/tilde/gitignore similarity index 100% rename from gitignore rename to tilde/gitignore diff --git a/hushlogin b/tilde/hushlogin similarity index 100% rename from hushlogin rename to tilde/hushlogin diff --git a/inputrc b/tilde/inputrc.bash similarity index 100% rename from inputrc rename to tilde/inputrc.bash