removed un-needed files

This commit is contained in:
Sohrab Behdani 2024-05-01 10:01:59 +03:30
parent 039306a48f
commit 50d7e462be
50 changed files with 0 additions and 839 deletions

21
aliases
View file

@ -1,21 +0,0 @@
# Unix
alias ll="ls -al"
alias ln="ln -v"
alias mkdir="mkdir -p"
alias e="$EDITOR"
alias v="$VISUAL"
# Bundler
alias b="bundle"
# Rails
alias migrate="bin/rails db:migrate db:rollback && bin/rails db:migrate db:test:prepare"
alias s="rspec"
# Pretty print the path
alias path='echo $PATH | tr -s ":" "\n"'
# Include custom aliases
if [[ -f ~/.aliases.local ]]; then
source ~/.aliases.local
fi

1
asdfrc
View file

@ -1 +0,0 @@
legacy_version_file = yes

View file

@ -1,15 +0,0 @@
#!/bin/sh
# Search your bundle for the provided pattern
# Requires bundler 1.8+ for execution as a bundler subcommand.
# Examples:
# bundle search Kernel.warn
# bundle search current_user clearance
# bundle search "Change your password" clearance
#
# Arguments:
# 1. What to search for
# 2. Which gem names to search (defaults to all gems)
pattern="$1"; shift
ag "$pattern" $(bundle show --paths "$@")

View file

@ -1,15 +0,0 @@
#!/bin/sh
# Kills the process running on the provided port
#
# clear-port 3000
if [ -n "$1" ]; then
port_num="$(lsof -ti4TCP:"$1")"
if [ $? -eq 0 ]; then
kill "$port_num"
fi
else
echo >&2 Usage: clear-port port-number
exit 1
fi

View file

@ -1,3 +0,0 @@
#!/bin/sh
git commit --amend -v --date="$(date +%Y-%m-%dT%H:%M:%S)"

View file

@ -1,6 +0,0 @@
#!/bin/sh
set -e
git fetch origin "pull/$1/head:pr/$1"
git checkout "pr/$1"

View file

@ -1,9 +0,0 @@
#!/bin/sh
set -e
git push origin "HEAD:refs/heads/$1"
git fetch origin
git branch --track "$1" "origin/$1"
cd .
git checkout "$1"

View file

@ -1,6 +0,0 @@
#!/bin/sh
set -e
[ -f .git/hooks/ctags ] || git init
.git/hooks/ctags

View file

@ -1,5 +0,0 @@
#!/bin/sh
set -e
git rev-parse --abbrev-ref HEAD

View file

@ -1,6 +0,0 @@
#!/bin/sh
set -e
git push origin :refs/heads/"$1"
git branch --delete "$1"

View file

@ -1,26 +0,0 @@
#!/bin/sh
set -e
if git symbolic-ref --short refs/remotes/origin/HEAD >/dev/null; then
main_branch="$(git symbolic-ref --short refs/remotes/origin/HEAD | sed 's@^origin/@@')" "$@"
else
echo "You don't have a primary branch reference set for your origin remote.
Use:
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/{name_of_your_primary_branch}
to set the reference and then try merging again."
exit 1
fi
git fetch origin
line_count=$(git diff origin/$main_branch..$main_branch | wc -l)
if [ $line_count -gt 0 ]; then
printf "failed: $main_branch is not up to date with origin/$main_branch\n"
exit 1
fi
git checkout $main_branch
git merge "@{-1}"

View file

@ -1,8 +0,0 @@
#!/bin/sh
set -e
old=$(git current-branch)
git branch -m "$old" "$1"
git push origin --set-upstream "$1"
git push origin --delete "$old"

View file

@ -1,3 +0,0 @@
#!/bin/sh
mkdir -p .git/safe

View file

@ -1,16 +0,0 @@
#!/bin/sh
set -e
git fetch origin
if git symbolic-ref --short refs/remotes/origin/HEAD >/dev/null; then
git fetch origin
git rebase "$(git symbolic-ref --short refs/remotes/origin/HEAD)" "$@"
else
echo "You don't have a primary branch reference set for your origin remote.
Use:
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/{name_of_your_primary_branch}
to set the reference and then try rebasing again."
fi

View file

@ -1,22 +0,0 @@
#!/bin/sh
#
# Find and replace by a given list of files.
#
# replace foo bar **/*.rb
find_this="$1"
shift
replace_with="$1"
shift
if command -v rg &>/dev/null ; then
items=$(rg -l --color never "$find_this" "$@")
else
items=$(ag -l --nocolor "$find_this" "$@")
fi
temp="${TMPDIR:-/tmp}/replace_temp_file.$$"
IFS=$'\n'
for item in $items; do
sed "s/$find_this/$replace_with/g" "$item" > "$temp" && mv "$temp" "$item"
done

31
bin/tat
View file

@ -1,31 +0,0 @@
#!/bin/sh
#
# Attach or create tmux session named the same as current directory.
path_name="$(basename "$PWD" | tr . -)"
session_name=${1-$path_name}
not_in_tmux() {
[ -z "$TMUX" ]
}
session_exists() {
tmux has-session -t "=$session_name"
}
create_detached_session() {
(TMUX='' tmux new-session -Ad -s "$session_name")
}
create_if_needed_and_attach() {
if not_in_tmux; then
tmux new-session -As "$session_name"
else
if ! session_exists; then
create_detached_session
fi
tmux switch-client -t "$session_name"
fi
}
create_if_needed_and_attach

View file

@ -1,16 +0,0 @@
#!/bin/sh
# List process running on provided port
#
# whats-in-port 3000
#
# output:
# COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
# ruby 25583 root 11u IPv4 0xee20607697a79bf7 0t0 TCP *:irdmi (LISTEN)
if [ -n "$1" ]; then
lsof -ni4TCP:"$1"
else
echo >&2 Usage: whats-in-port port-number
exit 1
fi

23
ctags
View file

@ -1,23 +0,0 @@
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/
--regex-ruby=/^[ \t]*attr_(reader|writer|accessor) (:[a-z0-9_]+, )*:([a-z0-9_]+)/\3/A,attr/
--langdef=Elixir
--langmap=Elixir:.ex.exs
--regex-Elixir=/^[ \t]*def(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\2/f,functions,functions (def ...)/
--regex-Elixir=/^[ \t]*defcallback[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/c,callbacks,callbacks (defcallback ...)/
--regex-Elixir=/^[ \t]*defdelegate[ \t]+([a-z_][a-zA-Z0-9_?!]*)/\1/d,delegates,delegates (defdelegate ...)/
--regex-Elixir=/^[ \t]*defexception[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/e,exceptions,exceptions (defexception ...)/
--regex-Elixir=/^[ \t]*defimpl[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/i,implementations,implementations (defimpl ...)/
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-z_][a-zA-Z0-9_?!]*)\(/\2/a,macros,macros (defmacro ...)/
--regex-Elixir=/^[ \t]*defmacro(p?)[ \t]+([a-zA-Z0-9_?!]+)?[ \t]+([^ \tA-Za-z0-9_]+)[ \t]*[a-zA-Z0-9_!?!]/\3/o,operators,operators (e.g. "defmacro a <<< b")/
--regex-Elixir=/^[ \t]*defmodule[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/m,modules,modules (defmodule ...)/
--regex-Elixir=/^[ \t]*defprotocol[ \t]+([A-Z][a-zA-Z0-9_]*\.)*([A-Z][a-zA-Z0-9_?!]*)/\2/p,protocols,protocols (defprotocol...)/
--regex-Elixir=/^[ \t]*Record\.defrecord[ \t]+:([a-zA-Z0-9_]+)/\1/r,records,records (defrecord...)/
--regex-Elixir=/^[ \t]*test[ \t]+\"([a-z_][a-zA-Z0-9_?! ]*)\"*/\1/t,tests,tests (test ...)/
--exclude=bower_components
--exclude=node_modules
--exclude=vendor
--languages=-javascript
--langdef=js
--langmap=js:.js
--langmap=js:+.jsx
--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/

View file

@ -1,9 +0,0 @@
--regex-ruby=/(^|[:;])[ \t]*([A-Z][[:alnum:]_]+) *=/\2/c,class,constant/
--exclude=bower_components
--exclude=node_modules
--exclude=vendor
--languages=-javascript
--langdef=js
--langmap=js:.js
--langmap=js:+.jsx
--regex-js=/[ \t.]([A-Z][A-Z0-9._$]+)[ \t]*[=:][ \t]*([0-9"'\[\{]|null)/\1/n,constant/

1
gemrc
View file

@ -1 +0,0 @@
gem: --no-document

View file

@ -1,7 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/commit-msg
if [ -f "$local_hook" ]; then
. "$local_hook"
fi

View file

@ -1,10 +0,0 @@
#!/bin/sh
set -e
PATH="/usr/local/bin:$PATH"
dir="$(git rev-parse --git-dir)"
trap 'rm -f "$dir/$$.tags"' EXIT
git ls-files | \
"${CTAGS:-ctags}" --tag-relative=yes -L - -f"$dir/$$.tags" --languages=-javascript,sql
mv "$dir/$$.tags" "$dir/tags"

View file

@ -1,9 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/post-checkout
if [ -f "$local_hook" ]; then
. "$local_hook";
fi
.git/hooks/ctags >/dev/null 2>&1 &

View file

@ -1,9 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/post-commit
if [ -f "$local_hook" ]; then
. "$local_hook";
fi
.git/hooks/ctags >/dev/null 2>&1 &

View file

@ -1,9 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/post-merge
if [ -f "$local_hook" ]; then
. "$local_hook";
fi
.git/hooks/ctags >/dev/null 2>&1 &

View file

@ -1,4 +0,0 @@
#!/bin/sh
case "$1" in
rebase) exec .git/hooks/post-merge ;;
esac

View file

@ -1,7 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/pre-commit
if [ -f "$local_hook" ]; then
. "$local_hook"
fi

View file

@ -1,7 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/pre-push
if [ -f "$local_hook" ]; then
. "$local_hook"
fi

View file

@ -1,7 +0,0 @@
#!/bin/sh
local_hook="$HOME"/.git_template.local/hooks/prepare-commit-msg
if [ -f "$local_hook" ]; then
. "$local_hook"
fi

View file

@ -1,6 +0,0 @@
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

View file

@ -1,30 +0,0 @@
[init]
defaultBranch = main
templatedir = ~/.git_template
[push]
default = current
[color]
ui = auto
[alias]
aa = add --all
ap = add --patch
branches = for-each-ref --sort=-committerdate --format=\"%(color:blue)%(authordate:relative)\t%(color:red)%(authorname)\t%(color:white)%(color:bold)%(refname:short)\" refs/remotes
ci = commit -v
co = checkout
pf = push --force-with-lease
st = status
[core]
excludesfile = ~/.gitignore
autocrlf = input
[merge]
ff = only
[commit]
template = ~/.gitmessage
[fetch]
prune = true
[rebase]
autosquash = true
[include]
path = ~/.gitconfig.local
[diff]
colorMoved = zebra

View file

@ -1,17 +0,0 @@
*.pyc
*.sw[nop]
.DS_Store
.bundle
.byebug_history
.env
.git/
/bower_components/
/log
/node_modules/
/tmp
/vendor
db/*.sqlite3
log/*.log
rerun.txt
tmp/**/*
/tags

View file

@ -1,16 +0,0 @@
# 50-character subject line
#
# 72-character wrapped longer description. This should answer:
#
# * Why was this change necessary?
# * How does it address the problem?
# * Are there any side effects?
#
# Include a link to the ticket, if any.
#
# Add co-authors if you worked on this code with others:
#
# Co-authored-by: Full Name <email@example.com>
# Co-authored-by: Full Name <email@example.com>

View file

@ -1,35 +0,0 @@
#!/bin/sh
touch "$HOME"/.psqlrc.local
if [ -e "$HOME"/.vim/autoload/plug.vim ]; then
vim -E -s +PlugUpgrade +qa
else
curl -fLo "$HOME"/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
vim -u "$HOME"/.vimrc.bundles +PlugUpdate +PlugClean! +qa
reset -Q
if [ -f "$HOME/.git_template/HEAD" ] && \
[ "$(cat "$HOME/.git_template/HEAD")" = "ref: refs/heads/main" ]; then
echo "Removing ~/.git_template/HEAD in favor of defaultBranch" >&2
rm -f ~/.git_template/HEAD
fi
# detect old OS X broken /etc/zshenv and suggest rename
if grep -qw path_helper /etc/zshenv 2>/dev/null; then
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P)
cat <<MSG >&2
Warning: \`/etc/zshenv' configuration file on your system may cause unexpected
PATH changes on subsequent invocations of the zsh shell. The solution is to
rename the file to \`zprofile':
sudo mv /etc/{zshenv,zprofile}
(called from ${dir}/post-up:${LINENO})
MSG
fi

View file

View file

@ -1,66 +0,0 @@
#!/usr/bin/env zsh
## root privileges
alias doas="doas --"
## vim and emacs
alias vi=vim
alias em="/usr/bin/emacs -nw"
alias emacs="emacsclient -c -a 'emacs'"
## doomemacs
alias doomsync="~/.emacs.d/bin/doom sync"
alias doomdoctor="~/.emacs.d/bin/doom doctor"
alias doomupgrade="~/.emacs.d/bin/doom upgrade"
alias doompurge="~/.emacs.d/bin/doom purge"
## add color to grep(s)
alias grep='grep --color=auto'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
## confirm before overwriting something
alias cp="cp -i"
alias mv='mv -i'
alias rm='rm -i'
# alias "l" to exa with icons
alias l='exa -lah --git --icons'
## cp/mv with progress bar
alias cpg="cpg -g"
alias mvg="mvg -g"
## human-readable sizes
alias free='free -h'
alias df='df -h'
alias du='du -h'
## xdg
alias open='xdg-open'
## Terminals' command
if [ -f `which kitty` ]; then
## show img in terminal
alias icat="kitty +kitten icat"
## connect via ssh
alias issh="kitty +kitten ssh"
fi
# youtube-dl
alias yta-aac="youtube-dl --extract-audio --audio-format aac "
alias yta-best="youtube-dl --extract-audio --audio-format best "
alias yta-flac="youtube-dl --extract-audio --audio-format flac "
alias yta-m4a="youtube-dl --extract-audio --audio-format m4a "
alias yta-mp3="youtube-dl --extract-audio --audio-format mp3 "
alias yta-opus="youtube-dl --extract-audio --audio-format opus "
alias yta-vorbis="youtube-dl --extract-audio --audio-format vorbis "
alias yta-wav="youtube-dl --extract-audio --audio-format wav "
alias ytv-best="youtube-dl -f bestvideo+bestaudio "
# switch between shells
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"

View file

@ -1,6 +0,0 @@
#!/usr/bin/env zsh
## BASH INSULTER (works in zsh though)
if [ -f /etc/bash.command-not-found ]; then
. /etc/bash.command-not-found
fi

28
psqlrc
View file

@ -1,28 +0,0 @@
-- Official docs: http://www.postgresql.org/docs/9.3/static/app-psql.html
-- Unofficial docs: http://robots.thoughtbot.com/improving-the-command-line-postgres-experience
-- Don't display the "helpful" message on startup.
\set QUIET 1
\pset null '[NULL]'
-- http://www.postgresql.org/docs/9.3/static/app-psql.html#APP-PSQL-PROMPTING
\set PROMPT1 '%[%033[1m%]%M %n@%/%R%[%033[0m%]%# '
-- PROMPT2 is printed when the prompt expects more input, like when you type
-- SELECT * FROM<enter>. %R shows what type of input it expects.
\set PROMPT2 '[more] %R > '
-- Show how long each query takes to execute
\timing
-- Use best available output format
\x auto
\set VERBOSITY verbose
\set HISTFILE ~/.psql_history- :DBNAME
\set HISTCONTROL ignoredups
\set COMP_KEYWORD_CASE upper
\unset QUIET
-- psql can't check for a file's existence, so we'll provide an empty local
-- file that users can override with their custom dotfiles. To set your own
-- personal settings, place your own file in ~/.psqlrc.local
\i ~/.psqlrc.local

3
rcrc
View file

@ -1,3 +0,0 @@
EXCLUDES="*.md LICENSE"
DOTFILES_DIRS="$HOME/dotfiles-local $HOME/dotfiles"
COPY_ALWAYS="git_template/HEAD"

2
rspec
View file

@ -1,2 +0,0 @@
--colour
--order random

View file

@ -1,41 +0,0 @@
# improve colors
set -g default-terminal 'screen-256color'
# act like vim
setw -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
set -g prefix2 C-s
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# soften status bar color from harsh green to light gray
set -g status-style bg='#666666',fg='#aaaaaa'
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''
# increase scrollback lines
set -g history-limit 10000
# prefix -> back-one-character
bind-key C-b send-prefix
# prefix-2 -> forward-incremental-history-search
bind-key C-s send-prefix -2
# don't suspend-client
unbind-key C-z
# Local config
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'

View file

@ -1 +0,0 @@
setlocal iskeyword+=-

View file

@ -1,4 +0,0 @@
" Automatically wrap at 72 characters and spell check commit messages
autocmd BufNewFile,BufRead PULLREQ_EDITMSG set syntax=gitcommit
setlocal textwidth=72
setlocal spell

View file

@ -1,6 +0,0 @@
let g:go_fmt_command = "goimports"
setlocal listchars=tab:\ \ ,trail,nbsp
setlocal noexpandtab
compiler go

View file

@ -1,5 +0,0 @@
" Enable spellchecking
setlocal spell
" Automatically wrap at 80 characters
setlocal textwidth=80

View file

@ -1 +0,0 @@
setlocal iskeyword+=-

View file

@ -1 +0,0 @@
setlocal iskeyword+=-

View file

@ -1,22 +0,0 @@
" Exclude Javascript files in :Rtags via rails.vim due to warnings when parsing
let g:Tlist_Ctags_Cmd="ctags --exclude='*.js'"
" Index ctags from any project, including those outside Rails
function! ReindexCtags()
let l:ctags_hook_file = "$(git rev-parse --show-toplevel)/.git/hooks/ctags"
let l:ctags_hook_path = system("echo " . l:ctags_hook_file)
let l:ctags_hook_path = substitute(l:ctags_hook_path, '\n\+$', '', '')
if filereadable(expand(l:ctags_hook_path))
exec '!'. l:ctags_hook_file
else
exec "!ctags -R ."
endif
endfunction
" to stop this mapping from being added, put this in $MYVIMRC:
" let g:thoughtbot_ctags_mappings_enabled = 0
let g:thoughtbot_ctags_mappings_enabled = get(g:, 'thoughtbot_ctags_mappings_enabled', 1)
if g:thoughtbot_ctags_mappings_enabled != 0
nmap <Leader>ct :call ReindexCtags()<CR>
endif

182
vimrc
View file

@ -1,182 +0,0 @@
set encoding=utf-8
" Leader
let mapleader = " "
set backspace=2 " Backspace deletes like most programs in insert mode
set nobackup
set nowritebackup
set noswapfile " http://robots.thoughtbot.com/post/18739402579/global-gitignore#comment-458413287
set history=50
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
set incsearch " do incremental searching
set laststatus=2 " Always display the status line
set autowrite " Automatically :write before running commands
set modelines=0 " Disable modelines as a security precaution
set nomodeline
" Switch syntax highlighting on, when the terminal has colors
" Also switch on highlighting the last used search pattern.
if (&t_Co > 2 || has("gui_running")) && !exists("syntax_on")
syntax on
endif
if filereadable(expand("~/.vimrc.bundles"))
source ~/.vimrc.bundles
endif
" Load matchit.vim, but only if the user hasn't installed a newer version.
if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# ''
runtime! macros/matchit.vim
endif
filetype plugin indent on
augroup vimrcEx
autocmd!
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufRead,BufNewFile .{jscs,jshint,eslint}rc set filetype=json
autocmd BufRead,BufNewFile
\ aliases.local,
\zshenv.local,zlogin.local,zlogout.local,zshrc.local,zprofile.local,
\*/zsh/configs/*
\ set filetype=sh
autocmd BufRead,BufNewFile gitconfig.local set filetype=gitconfig
autocmd BufRead,BufNewFile tmux.conf.local set filetype=tmux
autocmd BufRead,BufNewFile vimrc.local set filetype=vim
augroup END
" ALE linting events
augroup ale
autocmd!
if g:has_async
autocmd VimEnter *
\ set updatetime=1000 |
\ let g:ale_lint_on_text_changed = 0
autocmd CursorHold * call ale#Queue(0)
autocmd CursorHoldI * call ale#Queue(0)
autocmd InsertEnter * call ale#Queue(0)
autocmd InsertLeave * call ale#Queue(0)
else
echoerr "The thoughtbot dotfiles require NeoVim or Vim 8"
endif
augroup END
" When the type of shell script is /bin/sh, assume a POSIX-compatible
" shell for syntax highlighting purposes.
let g:is_posix = 1
" Softtabs, 2 spaces
set tabstop=2
set shiftwidth=2
set shiftround
set expandtab
" Display extra whitespace
set list listchars=tab:»·,trail,nbsp
" Use one space, not two, after punctuation.
set nojoinspaces
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
if executable('ag')
" Use Ag over Grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in fzf for listing files. Lightning fast and respects .gitignore
let $FZF_DEFAULT_COMMAND = 'ag --literal --files-with-matches --nocolor --hidden -g ""'
nnoremap \ :Ag<SPACE>
endif
" Make it obvious where 80 characters is
set textwidth=80
set colorcolumn=+1
" Numbers
set number
set numberwidth=5
" Tab completion
" will insert tab at beginning of line,
" will use completion if not at beginning
set wildmode=list:longest,list:full
function! InsertTabWrapper()
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<Tab>"
else
return "\<C-p>"
endif
endfunction
inoremap <Tab> <C-r>=InsertTabWrapper()<CR>
inoremap <S-Tab> <C-n>
" Switch between the last two files
nnoremap <Leader><Leader> <C-^>
" Get off my lawn
nnoremap <Left> :echoe "Use h"<CR>
nnoremap <Right> :echoe "Use l"<CR>
nnoremap <Up> :echoe "Use k"<CR>
nnoremap <Down> :echoe "Use j"<CR>
" vim-test mappings
nnoremap <silent> <Leader>t :TestFile<CR>
nnoremap <silent> <Leader>s :TestNearest<CR>
nnoremap <silent> <Leader>l :TestLast<CR>
nnoremap <silent> <Leader>a :TestSuite<CR>
nnoremap <silent> <Leader>gt :TestVisit<CR>
" Run commands that require an interactive shell
nnoremap <Leader>r :RunInInteractiveShell<Space>
" Treat <li> and <p> tags like the block tags they are
let g:html_indent_tags = 'li\|p'
" Set tags for vim-fugitive
set tags^=.git/tags
" Open new split panes to right and bottom, which feels more natural
set splitbelow
set splitright
" Quicker window movement
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Move between linting errors
nnoremap ]r :ALENextWrap<CR>
nnoremap [r :ALEPreviousWrap<CR>
" Map Ctrl + p to open fuzzy find (FZF)
nnoremap <c-p> :Files<cr>
" Set spellfile to location that is guaranteed to exist, can be symlinked to
" Dropbox or kept in Git and managed outside of thoughtbot/dotfiles using rcm.
set spellfile=$HOME/.vim-spell-en.utf-8.add
" Autocomplete with dictionary words when spell check is on
set complete+=kspell
" Always use vertical diffs
set diffopt+=vertical
" Local config
if filereadable($HOME . "/.vimrc.local")
source ~/.vimrc.local
endif

View file

@ -1,56 +0,0 @@
if &compatible
set nocompatible
end
" Remove declared plugins
function! s:UnPlug(plug_name)
if has_key(g:plugs, a:plug_name)
call remove(g:plugs, a:plug_name)
endif
endfunction
command! -nargs=1 UnPlug call s:UnPlug(<args>)
let g:has_async = v:version >= 800 || has('nvim')
call plug#begin('~/.vim/bundle')
" Define bundles via Github repos
Plug 'christoomey/vim-run-interactive'
" If fzf has already been installed via Homebrew, use the existing fzf
" Otherwise, install fzf. The `--all` flag makes fzf accessible outside of vim
if isdirectory("/usr/local/opt/fzf")
Plug '/usr/local/opt/fzf'
else
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
endif
Plug 'junegunn/fzf.vim'
Plug 'elixir-lang/vim-elixir'
Plug 'fatih/vim-go'
Plug 'janko-m/vim-test'
Plug 'pangloss/vim-javascript'
Plug 'pbrisbin/vim-mkdir'
Plug 'slim-template/vim-slim'
Plug 'tpope/vim-bundler'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-projectionist'
Plug 'tpope/vim-rails'
Plug 'tpope/vim-rake'
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-surround'
Plug 'vim-ruby/vim-ruby'
Plug 'vim-scripts/tComment'
if g:has_async
Plug 'dense-analysis/ale'
endif
if filereadable(expand("~/.vimrc.bundles.local"))
source ~/.vimrc.bundles.local
endif
call plug#end()