[GIT] dotfiles: don't use a submodule any more (fixes #10)

This commit is contained in:
Jannik Beyerstedt 2020-03-27 23:13:20 +01:00
parent 44558263b0
commit 6750f1c370
8 changed files with 510 additions and 10 deletions

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "files/dotfiles"]
path = files/dotfiles
url = https://git.jannikbeyerstedt.de/jannik/_dotfiles.git

4
files/_gitignore_global Normal file
View File

@ -0,0 +1,4 @@
*~
.DS_Store
.gdb_history
.AppleDouble

View File

@ -0,0 +1,122 @@
# vim:ft=zsh ts=2 sw=2 sts=2
#
# oh-my-zsh theme of Jannik Beyerstedt, based on agnoster, ys and af-magic
# Features: git status, username/host (if not default), root indicator, python virtual environment
# indicator, display exit code on error
#
# Usage/ Customisation:
# - currently none
#
# Output: # $status, $venv, user@host $dir $git_status, exit_code
# $
### Prompt components
# Each component will draw itself, and hide itself if no information needs to be shown
# Status:
# - are there background jobs?
prompt_status() {
local -a symbols
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙%{$reset_color%}"
if [[ -n "$symbols" ]] && echo -n "$symbols"
}
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ -n "$SSH_CLIENT" ]]; then
if [[ "$USER" != "$DEFAULT_USER" ]]; then
echo -n "%{$terminfo[bold]%F{green}%}%n@%m%{$reset_color%}:"
else
echo -n "%{$terminfo[bold]%F{green}%}@%m%{$reset_color%}:"
fi
else
if [[ "$USER" != "$DEFAULT_USER" ]]; then
echo -n "%{$terminfo[bold]%F{green}%}%n%{$reset_color%}:"
fi
fi
}
# Dir: current working directory
prompt_dir() {
echo -n "%{%F{blue}%}%~%{$reset_color%} "
}
# Virtualenv: current working virtualenv
#disable promt manupulation by virtualenv's bin/activate
export VIRTUAL_ENV_DISABLE_PROMPT=1
prompt_virtualenv() {
local virtualenv_path="$VIRTUAL_ENV"
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
echo -n "%{%F{yellow}%}(`basename $virtualenv_path`)%{$reset_color%} "
fi
}
# Exit Code: display decimal exit code on error
prompt_exitcode() {
# echo -n "%(?,,C:%{%F{red}%}%?%{$reset_color%})"
[[ $RETVAL -ne 0 ]] && echo -n "C:%{%F{red}%}%?%{$reset_color%}"
}
# Git: branch/detached head, dirty status
prompt_git() {
(( $+commands[git] )) || return
if [[ "$(git config --get oh-my-zsh.hide-status 2>/dev/null)" = 1 ]]; then
return
fi
local ref dirty mode repo_path
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
repo_path=$(git rev-parse --git-dir 2>/dev/null)
dirty=$(parse_git_dirty)
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git rev-parse --short HEAD 2> /dev/null)"
if [[ -n $dirty ]]; then
echo -n "%{$terminfo[bold]%F{cyan}%}(%{%F{yellow}%}"
else
echo -n "%{$terminfo[bold]%F{cyan}%}(%{%F{green}%}"
fi
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
mode=" <B>"
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
mode=" >M<"
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
mode=" >R>"
fi
setopt promptsubst
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' get-revision true
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' stagedstr '✚'
zstyle ':vcs_info:*' unstagedstr '●'
zstyle ':vcs_info:*' formats ' %u%c'
zstyle ':vcs_info:*' actionformats ' %u%c'
vcs_info
echo -n "${ref/refs\/heads\//}${vcs_info_msg_0_%% }${mode}%{%F{cyan}%})%{$reset_color%} "
fi
}
## Main prompt
build_prompt() {
RETVAL=$?
prompt_status
prompt_virtualenv
prompt_context
prompt_dir
prompt_git
# prompt_hg
prompt_exitcode
}
PROMPT='
%{%f%b%k%}$(build_prompt)
%{$terminfo[bold]%F{blue}%}$ %{$reset_color%}%{%f%}'

38
files/_tmux.conf Normal file
View File

@ -0,0 +1,38 @@
# remap prefix to Ctrl + a
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf
# shorter timing
set -g repeat-time 200
# configure mouse
setw -g mouse on
# don't rename windows automatically
set-option -g allow-rename off
# set some other options
setw -g mode-keys vi
set -g default-terminal "screen-256color"
# use index from 1 for easier typing/ switching
set -g base-index 1
setw -g pane-base-index 1
# status bar
#set -g status-right '#[fg=white]#(hostname)@#(host `hostname` | cut -d " " -f 4)'
set-window-option -g status-left " #S "
set-window-option -g status-left-style fg=black,bg=white
set-window-option -g status-right " %H:%M %Y-%m-%d | #(hostname) "
set-window-option -g status-right-style fg=black,bg=white
set-window-option -g window-status-format " #I: #W "
set-window-option -g window-status-current-format " #I: #W "
set-window-option -g window-status-current-style fg=green,bg=black

332
files/_vimrc Normal file
View File

@ -0,0 +1,332 @@
set rtp+=~/.fzf
" ----------------------------------------------------------------------------
" KEY MAPS
" ----------------------------------------------------------------------------
nmap \A :set formatoptions+=a<CR>:echo "autowrap enabled"<CR>
nmap \M :set noexpandtab tabstop=8 softtabstop=4 shiftwidth=4<CR>
nmap \T :set expandtab tabstop=8 shiftwidth=8 softtabstop=4<CR>
nmap \a :set formatoptions-=a<CR>:echo "autowrap disabled"<CR>
" Search for the word under the cursor in the current directory
nmap <M-k> mo:Ack! "\b<cword>\b" <CR>
nmap <Esc>k mo:Ack! "\b<cword>\b" <CR>
nmap ˚ mo:Ack! "\b<cword>\b" <CR>
nmap <M-S-k> mo:Ggrep! "\b<cword>\b" <CR>
nmap <Esc>K mo:Ggrep! "\b<cword>\b" <CR>
" Fix annoyances in the QuickFix window, like scrolling too much
autocmd FileType qf setlocal number nolist scrolloff=0
autocmd Filetype qf wincmd J " Makes sure it's at the bottom of the vim window
" Commands to send common keystrokes using tmux
let g:tmux_console_pane = '0:0.0'
let g:tmux_server_pane = '0:0.0'
function TmuxPaneRepeat()
write
silent execute ':!tmux send-keys -t' g:tmux_console_pane 'C-p' 'C-j'
redraw!
endfunction
function TmuxPaneClear()
silent execute ':!tmux send-keys -t' g:tmux_server_pane 'C-j' 'C-j' 'C-j' 'C-j' 'C-j' 'C-j' 'C-j'
redraw!
endfunction
" ----------------------------------------------------------------------------
" ABBREVATIONS
" ----------------------------------------------------------------------------
" Typing `$c` on the command line expands to `:e` + the current path, so it's easy to edit a file in
" the same directory as the current file.
cnoremap $c e <C-\>eCurrentFileDir()<CR>
function! CurrentFileDir()
return "e " . expand("%:p:h") . "/"
endfunction
" ----------------------------------------------------------------------------
" OPTIONS
" ----------------------------------------------------------------------------
set autoindent " Carry over indenting from previous line
set autoread " Don't bother me when a file changes
set autowrite " Write on :next/:prev/^Z
set backspace=indent,eol,start
" Allow backspace beyond insertion point
set cindent " Automatic program indenting
set cinkeys-=0# " Comments don't fiddle with indenting
set cino= " See :h cinoptions-values
set commentstring=\ \ #%s " When folds are created, add them to this
set copyindent " Make autoindent use the same chars as prev line
set directory-=. " Don't store temp files in cwd
set encoding=utf8 " UTF-8 by default
set expandtab " No tabs
set fileformats=unix,dos,mac " Prefer Unix
set fillchars=vert:\ ,stl:\ ,stlnc:\ ,fold:-,diff:┄
" Unicode chars for diffs/folds, and rely on
" Colors for window borders
silent! set foldmethod=marker " Use braces by default
set formatoptions=tcqn1 " t - autowrap normal text
" c - autowrap comments
" q - gq formats comments
" n - autowrap lists
" 1 - break _before_ single-letter words
" 2 - use indenting from 2nd line of para
set hidden " Don't prompt to save hidden windows until exit
set history=200 " How many lines of history to save
set hlsearch " Hilight searching
set ignorecase " Case insensitive
set incsearch " Search as you type
set infercase " Completion recognizes capitalization
set laststatus=2 " Always show the status bar
set linebreak " Break long lines by word, not char
set list " Show whitespace as special chars - see listchars
set listchars=tab:»\ ,extends:,precedes:,nbsp,trail" Unicode characters for various things
set matchtime=2 " Tenths of second to hilight matching paren
set modelines=5 " How many lines of head & tail to look for ml's
silent! set mouse=nvc " Use the mouse, but not in insert mode
set nobackup " No backups left after done editing
set number " Show line numbers to start
set visualbell t_vb= " No flashing or beeping at all
set nowritebackup " No backups made while editing
set ruler " Show row/col and percentage
set scroll=4 " Number of lines to scroll with ^U/^D
set scrolloff=15 " Keep cursor away from this many chars top/bot
set sessionoptions-=options " Don't save runtimepath in Vim session (see tpope/vim-pathogen docs)
set shiftround " Shift to certain columns, not just n spaces
set shiftwidth=2 " Number of spaces to shift for autoindent or >,<
set shortmess+=A " Don't bother me when a swapfile exists
set showbreak= " Show for lines that have been wrapped, like Emacs
set showmatch " Hilight matching braces/parens/etc.
set sidescrolloff=3 " Keep cursor away from this many chars left/right
set smartcase " Lets you search for ALL CAPS
set softtabstop=2 " Spaces 'feel' like tabs
set suffixes+=.pyc " Ignore these files when tab-completing
set tabstop=2 " The One True Tab
set textwidth=100 " 100 is the new 80
set notitle " Don't set the title of the Vim window
set wildmenu " Show possible completions on command line
set wildmode=list:longest,full " List all options and complete
set wildignore=*.class,*.o,*~,*.pyc,.git,node_modules " Ignore certain files in tab-completion
" Essential for filetype plugins.
filetype plugin indent on
" ----------------------------------------------------------------------------
" CUSTOM COMMANDS AND FUNCTIONS
" ----------------------------------------------------------------------------
" ----------------------------------------------------------------------------
" PLUGIN SETTINGS
" ----------------------------------------------------------------------------
" Use Pathogen for plugin management. See update.sh in this directory.
runtime bundle/vim-pathogen/autoload/pathogen.vim
call pathogen#infect()
call pathogen#helptags()
" GitGutter styling to use · instead of +/-
let g:gitgutter_sign_added = '∙'
let g:gitgutter_sign_modified = '∙'
let g:gitgutter_sign_removed = '∙'
let g:gitgutter_sign_modified_removed = '∙'
" ALE
let g:ale_sign_warning = '▲'
let g:ale_sign_error = '✗'
highlight link ALEWarningSign String
highlight link ALEErrorSign Title
" Lightline
let g:lightline = {
\ 'colorscheme': 'wombat',
\ 'active': {
\ 'left': [['mode', 'paste'], ['filename', 'modified']],
\ 'right': [['lineinfo'], ['percent'], ['readonly', 'linter_warnings', 'linter_errors', 'linter_ok']]
\ },
\ 'component_expand': {
\ 'linter_warnings': 'LightlineLinterWarnings',
\ 'linter_errors': 'LightlineLinterErrors',
\ 'linter_ok': 'LightlineLinterOK'
\ },
\ 'component_type': {
\ 'readonly': 'error',
\ 'linter_warnings': 'warning',
\ 'linter_errors': 'error'
\ },
\ }
function! LightlineLinterWarnings() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf('%d ◆', all_non_errors)
endfunction
function! LightlineLinterErrors() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf('%d ✗', all_errors)
endfunction
function! LightlineLinterOK() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '✓ ' : ''
endfunction
" Update and show lightline but only if it's visible (e.g., not in Goyo)
autocmd User ALELint call s:MaybeUpdateLightline()
function! s:MaybeUpdateLightline()
if exists('#lightline')
call lightline#update()
end
endfunction
" ----------------------------------------------------------------------------
" COLORS
" ----------------------------------------------------------------------------
" Make sure colored syntax mode is on, and make it Just Work with 256-color terminals.
set background=dark
let g:rehash256 = 1 " Something to do with Molokai?
" colorscheme molokai
if !has('gui_running')
if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
set t_Co=256
elseif has("terminfo")
colorscheme default
set t_Co=8
set t_Sf=[3%p1%dm
set t_Sb=[4%p1%dm
else
colorscheme default
set t_Co=8
set t_Sf=[3%dm
set t_Sb=[4%dm
endif
" Disable Background Color Erase when within tmux - https://stackoverflow.com/q/6427650/102704
if $TMUX != ""
set t_ut=
endif
endif
syntax on
" Window splits & ruler are too bright, so change to white on grey (non-GUI)
highlight StatusLine cterm=NONE ctermbg=blue ctermfg=white
highlight StatusLineTerm cterm=NONE ctermbg=blue ctermfg=white
highlight StatusLineNC cterm=NONE ctermbg=black ctermfg=white
highlight StatusLineTermNC cterm=NONE ctermbg=black ctermfg=white
highlight VertSplit cterm=NONE ctermbg=black ctermfg=white
" taglist.vim's filenames is linked to LineNr by default, which is too dark
highlight def link MyTagListFileName Statement
highlight def link MyTagListTagName Question
" Turn off horrible coloring for CDATA in XML
highlight def link xmlCdata NONE
" Some custom spell-checking colors
"highlight SpellBad term=underline cterm=underline ctermbg=NONE ctermfg=205
"highlight SpellCap term=underline cterm=underline ctermbg=NONE ctermfg=33
"highlight SpellRare term=underline cterm=underline ctermbg=NONE ctermfg=217
"highlight SpellLocal term=underline cterm=underline ctermbg=NONE ctermfg=72
" The Ignore color should be... ignorable
silent! highlight Ignore cterm=bold ctermfg=black ctermbg=bg
highlight clear FoldColumn
highlight def link FoldColumn Ignore
highlight clear Folded
highlight link Folded Ignore
highlight clear LineNr
highlight! def link LineNr Ignore
" Custom search colors
highlight clear Search
highlight Search term=NONE cterm=NONE ctermfg=white ctermbg=black
" Make hilighted matching parents less annoying
highlight clear MatchParen
highlight link MatchParen Search
" Custom colors for NERDTree
highlight def link NERDTreeRO NERDTreeFile
" Make trailing spaces very visible
"highlight SpecialKey ctermbg=Yellow guibg=Yellow
" Make menu selections visible
highlight PmenuSel ctermfg=black ctermbg=magenta
" The sign column slows down remote terminals
highlight clear SignColumn
highlight link SignColumn Ignore
" Markdown could be more fruit salady
highlight link markdownH1 PreProc
highlight link markdownH2 PreProc
highlight link markdownLink Character
highlight link markdownBold String
highlight link markdownItalic Statement
highlight link markdownCode Delimiter
highlight link markdownCodeBlock Delimiter
highlight link markdownListMarker Todo
" ----------------------------------------------------------------------------
" FILE TYPE TRIGGERS
" ----------------------------------------------------------------------------
" Reset all autocommands
augroup vimrc
autocmd!
au BufNewFile,BufRead *.cson set ft=coffee
au BufNewFile,BufRead *.glsl setf glsl
au BufNewFile,BufRead *.gyp set ft=python
au BufNewFile,BufRead *.html setlocal nocindent smartindent
au BufNewFile,BufRead *.i7x setf inform7
au BufNewFile,BufRead *.ini setf conf
au BufNewFile,BufRead *.input setf gnuplot
au BufNewFile,BufRead *.json set ft=json tw=0
au BufNewFile,BufRead *.less setlocal ft=less nocindent smartindent
au BufNewFile,BufRead *.md setlocal ft=markdown nolist
au BufNewFile,BufRead *.md,*.markdown setlocal foldlevel=999 tw=0 nocin
au BufNewFile,BufRead *.ni setlocal ft=inform nolist ts=2 sw=2 noet
au BufNewFile,BufRead *.plist setf xml
au BufNewFile,BufRead *.rb setlocal noai
au BufNewFile,BufRead *.rxml setf ruby
au BufNewFile,BufRead *.sass setf sass
au BufNewFile,BufRead *.ttml setf xml
au BufNewFile,BufRead *.vert,*.frag set ft=glsl
au BufNewFile,BufRead *.xml setlocal ft=xml ts=2 sw=2 et
au BufNewFile,BufRead *.zone setlocal nolist ts=4 sw=4 noet
au BufNewFile,BufRead *.zsh setf zsh
au BufNewFile,BufRead *templates/*.html setf htmldjango
au BufNewFile,BufRead .git/config setlocal ft=gitconfig nolist ts=4 sw=4 noet
au BufNewFile,BufRead .gitconfig* setlocal ft=gitconfig nolist ts=4 sw=4 noet
au BufNewFile,BufRead .vimlocal,.gvimlocal setf vim
au BufNewFile,BufRead .zshlocal setf zsh
au BufNewFile,BufRead /tmp/crontab* setf crontab
au BufNewFile,BufRead COMMIT_EDITMSG setlocal nolist nonumber
au BufNewFile,BufRead Makefile setlocal nolist
au FileType gitcommit setlocal nolist ts=4 sts=4 sw=4 noet
au FileType inform7 setlocal nolist tw=0 ts=4 sw=4 noet foldlevel=999
au FileType json setlocal conceallevel=0 foldmethod=syntax foldlevel=999
au FileType make setlocal nolist ts=4 sts=4 sw=4 noet
au FileType markdown syn sync fromstart
au Filetype gitcommit setlocal tw=80
augroup END
" ----------------------------------------------------------------------------
" HOST-SPECIFIC VIM FILE
" ----------------------------------------------------------------------------
" Now load specifics to this host
if filereadable(expand("~/.vimlocal"))
source ~/.vimlocal
endif
" vim:set tw=100:

@ -1 +0,0 @@
Subproject commit 4f8802334f8793e056dfe842657c67765d1fae9f

10
files/vim.md Normal file
View File

@ -0,0 +1,10 @@
# Notes on VIM customization
basics copied from <https://statico.github.io/vim3.html>
## used VIM plugins:
- Pathogen https://github.com/tpope/vim-pathogen
- Lightline: see https://vimawesome.com/plugin/lightline-vim
- ALE: see https://vimawesome.com/plugin/ale
- vim-gitgutter: see https://vimawesome.com/plugin/vim-gitgutter
- vim-polyglot: see https://vimawesome.com/plugin/vim-polyglot
- commentery: see https://vimawesome.com/plugin/commentary-vim

View File

@ -42,16 +42,14 @@
src: "{{ item.src }}"
dest: "{{ item.dest }}"
with_items:
- { src: "{{ role_path }}/files/dotfiles/_gitignore_global", dest: ".gitignore_global" }
- { src: "{{ role_path }}/files/dotfiles/_tmux.conf", dest: ".tmux.conf" }
- { src: "{{ role_path }}/files/dotfiles/_vimrc", dest: ".vimrc" }
- { src: "{{ role_path }}/files/dotfiles/_oh-my-zsh/custom/themes/agnoster.zsh-theme", dest: ".oh-my-zsh/custom/themes/agnoster.zsh-theme" }
- { src: "{{ role_path }}/files/dotfiles/_oh-my-zsh/custom/themes/jtbx.zsh-theme", dest: ".oh-my-zsh/custom/themes/jtbx.zsh-theme" }
- { src: "{{ role_path }}/files/_gitignore_global", dest: ".gitignore_global" }
- { src: "{{ role_path }}/files/_tmux.conf", dest: ".tmux.conf" }
- { src: "{{ role_path }}/files/_vimrc", dest: ".vimrc" }
- { src: "{{ role_path }}/files/_oh-my-zsh/jtbx.zsh-theme", dest: ".oh-my-zsh/custom/themes/jtbx.zsh-theme" }
- name: usersettings - Set zshrc
template:
src: "{{ role_path }}/templates/_zshrc.j2"
dest: "{{ ansible_user_dir }}/.zshrc"
when: usersetup_gitconfig == true
- name: usersettings - Set global gitconfig
template:
src: "{{ role_path }}/templates/_gitconfig.j2"