Giter Site home page Giter Site logo

benknoble / dotfiles Goto Github PK

View Code? Open in Web Editor NEW
22.0 4.0 2.0 1.98 MB

dotfiles for configuration

License: MIT License

Shell 34.22% Python 1.85% Ruby 1.01% AppleScript 1.14% Perl 0.47% Common Lisp 0.03% Prolog 0.02% Vim Script 61.26%
dotfiles profile bash bashrc vim vimrc tmux

dotfiles's Introduction

dotfiles

This project is personal

My Dotfiles for configuration of different software and command-line programs

See also: my workflow

⚠️WARNING⚠️ Dotfiles are not meant to be forked: they are personal castles that you should construct yourself. That said, feel free to peruse mine and steal whatever you like.

In spite of the above warning, I have tried to make this repo relatively easy to fork and play with. Sourcing local files, such as ~/.gitconfig.local, is a large part of that.

Installing

First, clone the repo into your dotfiles directory (the name of the directory doesn't matter). If your git supports it, --jobs ... might be a good idea. You can skip the submodules if you choose, but you must have the plink submodule or a plink installation to build the makefile used for installation and maintenance. The submodule is the easiest route.

mkdir ~/Dotfiles
git clone --recurse-submodules https://github.com/benknoble/Dotfiles.git ~/Dotfiles
cd ~/Dotfiles

Next, run make to kick things off:

./dotfiles.plink
make install

This will do several things:

  1. Use Plink to generate the makefile.
  2. Executes make symlink, which removes old files and creates the symlinks :warning:No backups are made. Create your own prior to installing if you wish.⚠️
  3. (Optional) Executes make $(FEATURES). See the Makefile for supported options and the defaults. FEATURES=none can be used to skip this.

At this point, you may want to setup brew, so do

# Linux
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
# macOS
command -v brew

make brew_setup

The next time you start a shell (probably homebrewed zsh, since that's what make brew_setup sets it to), your new config files will load , giving you access to a whole host of new command-line fu.

reload is a helpful alias (defined for both bash and zsh) for when changes have been made to shell dotfiles: it essentially loads those changes into the environment. :Reload exists for vim, and there are reload bindings for both tmux and readline as well.

Keeping Up-to-date

make update should be all you need.

Other make things

Controlled via Plink and dotfiles.plink.

The Makefile is only guaranteed to work if run from the top-level of this repo.

  • provides useful targets (make prints a list)
  • customizable (see the top section of Makefile)
  • updates as needed

Documentation & Full Feature List

Check the code—this is where you should probably not use something until you understand what it is doing. Feel free to ask me questions.

The old docs have been eliminated. They can be found in the git history.

Misc

Theme

I am now using the Dracula themes for all my software. You can find some of them under the Dracula directory and some in a vim package. Some are hand-coded and not official. Additionally, if Dracula Pro is available, I'm using that instead. I usually use the regular variant, though the Van Helsing variant is also nice.

I'm using Victor Mono as a font. Cursive italics have grown on me.

Code of Conduct

Note that we also have a Code of Conduct that governs the behavioral expectations of the Dotfiles.

License

This project is licensed under the MIT License--see LICENSE for more information.

© 2016 David Ben Knoble

Acknowledgments

This project was inspired by a blog post from this guy.

I've also grabbed code from a number of places over the development of the project. I've tried to attribute you in the code where possible, but I can't hit everybody.

Thanks to Steve Losh for some Vim help and teaching.

Thanks further to the kind Internet for providing a wealth of resources when things go wonky.

dotfiles's People

Contributors

benknoble avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dotfiles's Issues

Move git config to installer to avoid calling it on each startup

If the git config is moved to an install file, it only has to be sourced once (and can optionally be sourced again to re-conf as needed). This also gives me the option to create a core.excludesfile on installation with my default content if one doesn't already exist (may have option to overwrite).

  • Move general git config to install file
  • Move core.excludesfile to install file
  • Create default core.excludesfile if not present
  • Give the user the option to overwrite the current core.excludesfile if present

Motd

Message of the day (cowsay, fortune, ponysay, lolcat?) in bashrc

use COW to control which cow, if set
use COLOR to control if colored

Also need to install those utils via brew

Note: which -s [command] can test for existence of command

Change the way appending to PATH is handled

Also what it says on the box. I think the code could benefit from this, preventing reload command from accidentally duplicating PATH elements.

See StackOverflow for discussion.

Relevant code:

pathadd() {
    if [ -d "$1" ] && [[ ":$PATH:" != *":$1:"* ]]; then
        PATH="${PATH:+"$PATH:"}$1"
    fi
}

Git prompt globbing expansion

When on a branch that is not a remote-tracking branch, with modified files, the prompt displays a * character. In PS1, this is treated normally; however, when used in the _build_PS1 algorithm to calculate the length, it was globbed due to a lack of quoting. It expanded into filenames, causing the calculated prompt length to be much longer than actuality. This caused unnecessary line splitting of the prompt.

Fix by double-quote escaping.

Toggle line numbers

" Toggle line numbers
nnoremap <leader>n :setlocal number!<CR>
" Toggle relative line numbers
nnoremap <leader>N :setlocal relativenumber!<CR>

/docs folder

Document the dotfiles, etc. beyond README's basic descriptions

'title' not set

When 'title' is set, Vim will display information in the window title of the terminal.

set title

Caveat: requires +title

'equalalways' is set

With 'equalalways' set, windows will equalize themselves when opening or closing windows. If I've laid them out a particular way, I don't want that to be totally overturned when I add something new to the mix.

set noequalalways

'showbreak' not set

'showbreak' controls what is displayed at the beginnings of lines that are continuations due to wrapping.

Good values:

set showbreak=»\ 
set showbreak==>\ 

Additionally, could set linebreak to break at word boundaries

set linebreak

Colors are for PS1 only

The current color definitions contain extra characters (namely \[ and \]) that are specific to the PS1 coloring.

It would be more useful if the colors lacked these characters and they appeared only in PS1 definition.

PS1 wrapping

Need a way to count the length of $PS1 and to insert a line-break between the info and the $ if longer than some number of characters.

N.B. tput cols can give the width of the terminal in characters.

Filetype-dependent settings need re-examined

This is a lengthy one.

It comes down to about 3 things:

  1. Tab settings are handled ok-ish by the default plugins. Remove 'global' settings. I'd really like to use expandtab, obviously. Consider shiftround as well. And don't forget shiftwidth (tabstop=8 always)
  2. Filetype autocommands can actually be moved to /.vim/ftplugin/<type>.vim to set local options and use <localleader> for mappings.
  3. Once 'global' settings are removed, keep an eye out for changes that need to be made and add them.

Plugin files are used for defining file-dependent settings.

Basically, what I want to do is eschew settings that are too global for different filetypes, move my personal prefs into filetype plugins, and then rely on the defaults until I decide I need to change something.

⚠️ 💥 This will likely require a :retab of all files! ❗️❗️

Make PS1 parts toggle-able

Create some simple stuff that builds PS1 based on what's set "on":

Example

function jobs {
    PS1="$PS1 $colors \j $colors"
}

function buildPS1 {
    if [[ "$jobs" = "$valueOn" ]]; then
        jobs
    fi
}

Tabs and spaces

This is one war I'm tired of, but at least for now I'm using spaces so I need to retab some things...

Consider 'smartcase' with 'ignorecase'

From the docs:

'ignorecase' 'ic'    Ignore case in special patterns
'smartcase' 'scs'    Override 'ignorecase' when the search pattern contains upper case characters

This is far easier than doing /\C<pattern> in Vim to get uppercase matching

Use proper bash config files

Currently, the state of .bash_profile, .profile, and .bashrc is not set up properly as per man bash. Needs fixed.

Implementing #2 will greatly aid this process, as config files can source the appropriate files when needed.

Hook to update `tree -L 3 --noreport` on commit

See title. It would be nice if, when a commit changed the file layout of the repository, the commands output was updated. It could perhaps be stored in a file docs/tree.md, linked to in README.md, and simply overwritten at commit time (and then of course added to the commit).

Hooks can probably be put in a .hooks directory and symlinked (~~~or copied?~~~ linked: changes properly) during setup/git-setup.sh

`getip` function has trailing newline

Current behavior

${PS1} $ getip 
xx.x.x.xx
                     # spaces added to show where newline is

Desired behavior

${PS1} $ getip 
xx.x.x.xx

Fix

Remove echo from function definition:

getip () 
{ 
    ipconfig getifaddr en0;
    # remove this # echo
}

Allow ~/.personal/ to contain personal override scripts

Any executable file in that directory will be sourced as a way to override defaults or create other personalizations. This prevents dreaded merge conflicts when updating this repo, and allows you to VCS your own personalization scripts, since they live in their own directory.

  1. Files must be executable to allow the inclusion of README's or other files in the directory.
  2. This currently doesn't allow a personal e.g. .inputrc for customizing that (but you can use bind in a script to interact with the readline library!)
  3. Best current usage of this is alias/function defs, setting COW and COLOR variables for MOTD (cf. #22) and other ENV variables

Uninstall script

Provide an uninstall.sh script to remove symlinks, restore backups if any, and clean out the git repo.

Version control/symlink .gitconfig files

Rather than requiring a script to properly configure the things, why not include them in the git repo and symlink them with other dotfiles? That's how this thing is supposed to work...

Would facilitate tracking changes to ~/.gitconfig, ~/.gitignore_global, and require a far less complicated gitconfig script that could be moved out of installers and become it's own setup script.

  • Move ~/.gitconfig, ~/.gitignore_global into Dotfiles repo
  • Add them to the symlinks script
  • Move gitconfig.bash out of installers; edit it to only change the coreexcludes, username, email
  • Move setup scripts (makesymlinks.sh, install-all.sh, gitconfig.bash) to setup directory
  • (Optional) Create a bootstrap script to execute setup scripts
  • Edit README

Should use 'list' and 'listchars' to control display of whitespace

See e.g. here.

Preferences so far (by experimentation)

set list listchars=tab\ ,trail:·,nbsp:⎵

» is <C-k>>>
· is <C-k>.M
⎵ is <C-v>u23B5

tab,trail, and nbsp are part of SpecialKey highlighting group (however the default highlighting is pretty visible). Set new colors using :hi SpecialKey ... (see :help :highlight for more info).

Move ~/bin into Dotfiles

Allow me to version control scripts I throw together, without having them in a separate spot.

vimrc

The whole derned thing needs work.

See examples and defaults.

Use 'undofile' for persistent history

If I work on a file, close it, and come back to it later, I'd like to be able to use the old undo tree.

set undofile undodir=~/.undo

if !isdirectory(expand(&undodir))
  call mkdir(expand(&undodir), "p")
endif

'pastetoggle' not set

Set up a useful mapping to toggle paste!

Ideas:

set pastetoggle=<F10>
set pastetoggle=<leader>p

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.