dot files and you · what are dotfiles? files and folders with names that start with . are hidden...

56
Dot Files and You By Dan Ivovich September 28, 2016 1

Upload: others

Post on 12-Aug-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Dot Files and YouBy Dan Ivovich

September 28, 2016

1

Page 2: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

DisclaimerThis is not a ⛪ battle

This is also not !

2

Page 3: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

This is what I usefind what you like

share the coolness!!!

3

Page 4: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

If you have an opinionKeep it to yourself

!We can share at the end

I promise

4

Page 5: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

What are dotfiles?Files and folders with names that start with . are hidden

on *nix systems

5

Page 6: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

ExamplesFolders

» .ssh

» .rbenv

Files

» .vimrc

» .bashrc

» .zshrc

6

Page 7: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Why?

» Configuration Settings

» Resource files (i.e. your SSH Key or authorized keys file)

» Plugins

7

Page 8: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

So what⁉

8

Page 9: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

What can we! control?! customize?

9

Page 10: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Your shell

!

10

Page 11: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Your shell

>_

11

Page 12: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

zshThe good parts of bash with some

other stuff

12

Page 13: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Oh My Zsh!

13

Page 14: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Oh My Zsh is an open source, community-driven framework for managing your zsh configuration.

— Oh My Zsh Readme

14

Page 15: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Why?Themes

15

Page 16: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Why?PluginsGet useful aliases and smarter tab completion

» bundler

» git

» rails

16

Page 17: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

How does it do it?

17

Page 18: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

I don't care

!It works, and it works wellMost importantly, it doesn't get in my way

All upside from my point of view !

18

Page 19: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Do whatever you wantJust ! your "

Don't ! your "

19

Page 20: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmuxTerminal Multiplexer

⁉20

Page 21: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

It lets you switch easily between several programs in one terminal,

detach them (they keep running in the background) and reattach them to a

different terminal— tmux website

21

Page 22: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

If you thought your ! couldn't get any better

YOU WERE WRONG !

22

Page 23: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

What is better than ! awesome "?

23

Page 24: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Multiplexed awesome !!! "

!

24

Page 25: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

25

Page 26: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

.tmux.conf

set -g prefix C-aunbind %bind | split-window -hbind - split-window -vbind h select-pane -Lbind j select-pane -Dbind k select-pane -Ubind l select-pane -R

26

Page 27: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Sidebar!

Map Caps Lock to ControlYou aren't an animal

You don't need Caps Lock

Unless you ! a lot "

27

Page 28: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmux tips

» I keep a full screen tmux running

» Server processes either in the left hand split or another tmux window

» I keep tmux sessions running per project

» Right hand side is usually vim

28

Page 29: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmux keyboard tips

» prefix - c (control - a, c) # create new window

» prefix - n (control - a, n) # go to next window

» prefix - p (control - a, p) # go to previous window

» prefix - z (control - a, z) # focus pane

» prefix - s (control - a, s) # show session list

» prefix - d (control - a, d) # detach session

29

Page 30: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmux review

30

Page 31: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmux and zshtls (){ tmux ls}

t (){ if (($# == 1)); then tmux_attach_or_create $1 else tmux_attach_or_create $(basename $(pwd)) fi}

31

Page 32: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmux and zshtmux_attach_or_create () { if (($# == 1)); then tmux has -t $1 && tmux attach -t $1 || tmux new -s $1 else echo "Must provide a session name" fi}

_t() { local line local -a sessions tmux ls | cut -d : -f 1 | while read -A line; do sessions=($line $sessions) done _values $sessions && ret=0}compdef _t t

32

Page 33: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Show Me!

33

Page 34: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

tmux and zsh!

34

Page 35: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Vim

35

Page 36: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Learn it !! Use itLove it ❤

Full discolosure, I learned emacs first !

36

Page 37: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

.vimrc basics

set tabstop=2set smarttabset softtabstop=2set shiftwidth=2set autoindentset expandtablet mapleader = ","

37

Page 38: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Don't use the arrow keys

map <Left> :echo "no!"<cr>map <Right> :echo "no!"<cr>map <Up> :echo "no!"<cr>map <Down> :echo "no!"<cr>

38

Page 39: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Better split management

" use ,v to make a new vertical split, ,s for horiz, ,x to close a splitnoremap <leader>v <c-w>v<c-w>lnoremap <leader>s <c-w>s<c-w>jnoremap <leader>x <c-w>c"map <c-j> <c-w>jmap <c-k> <c-w>kmap <c-l> <c-w>lmap <c-h> <c-w>h

39

Page 40: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Handy tips

" fast switching between two recent buffersnnoremap <leader><leader> <C-^>

" Map a shortcut to close a buffermap <leader>. :bd<CR>

" Shortcut for viewing open buffersmap <leader>m :BufExplorer<CR>

40

Page 41: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Fast file opening

" Map ,e and ,v to open files in the same directory as the current filecnoremap %% <C-R>=expand('%:h').'/'<cr>map <leader>e :edit %%map <leader>v :view %%

au BufRead,BufNewFile {Gemfile,Rakefile,Vagrantfile,config.ru,Guardfile} set ft=ruby

41

Page 42: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Plugins!

42

Page 43: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Vundle

set rtp+=~/.vim/bundle/Vundle.vim/call vundle#begin()

" Vundle setupPlugin 'gmarik/Vundle.vim'

43

Page 44: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Language Plugins

Plugin 'vim-ruby/vim-ruby'Plugin 'fatih/vim-go'Plugin 'derekwyatt/vim-scala'Plugin 'plasticboy/vim-markdown'Plugin 'kchmck/vim-coffee-script'Plugin 'groenewege/vim-less'Plugin 'elixir-lang/vim-elixir'Plugin 'pangloss/vim-javascript'Plugin 'mxw/vim-jsx'

44

Page 45: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

The tpope section

Plugin 'tpope/vim-rake'Plugin 'tpope/vim-rails'Plugin 'tpope/vim-bundler'Plugin 'tpope/vim-cucumber'Plugin 'tpope/vim-haml'Plugin 'tpope/vim-repeat'Plugin 'tpope/vim-surround'Plugin 'tpope/vim-endwise'Plugin 'tpope/vim-fugitive'

45

Page 46: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Utils

Plugin 'bufexplorer.zip'Plugin 'scrooloose/nerdtree'Plugin 'scrooloose/nerdcommenter'Plugin 'sjl/gundo.vim'Plugin 'kien/ctrlp.vim'

46

Page 47: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Themes

Plugin 'altercation/vim-colors-solarized'set t_Co=16set background=lightcolorscheme solarized

47

Page 48: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Your dotfiles should help you

!

48

Page 49: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Don't add stuff you won't use

49

Page 50: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Remove things you don't use

!

50

Page 51: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

They shouldn't get in your way

!

51

Page 52: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Watch out for time sink

'What was the original problem you were trying to fix?''Well, I noticed one of the tools I was using had an inefficiency that was wasting my time.'

52

Page 53: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Questions?

❓! No Opinions !

(⏰ Your time is coming ⏰)

53

Page 54: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Thanks!!

54

Page 55: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

OK, Now....

55

Page 56: Dot Files and You · What are dotfiles? Files and folders with names that start with . are hidden on *nix systems 5

Opinions?

! " #

56