latest greatest
This commit is contained in:
@@ -1,19 +1,22 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es2021": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": "standard-with-typescript",
|
"extends": "standard-with-typescript",
|
||||||
"parserOptions": {
|
"overrideConfig": {
|
||||||
"ecmaVersion": "latest",
|
"env": {
|
||||||
"sourceType": "module"
|
"browser": true,
|
||||||
},
|
"es2021": true,
|
||||||
"rules": {
|
"node": true
|
||||||
"indent": ["error", 4],
|
},
|
||||||
"semi": ["error", "always"],
|
"rules": {
|
||||||
"quotes": ["error", "double"],
|
"indent": ["error", 4],
|
||||||
"comma-dangle": ["error", "only-multiline"],
|
"semi": ["error", "always"],
|
||||||
"space-before-function-paren": ["error", "never"]
|
"quotes": ["error", "double"],
|
||||||
|
"comma-dangle": ["error", "only-multiline"],
|
||||||
|
"space-before-function-paren": ["error", "never"],
|
||||||
|
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 2 }]
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": "latest",
|
||||||
|
"sourceType": "module"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,5 +3,6 @@
|
|||||||
"tabWidth": 4,
|
"tabWidth": 4,
|
||||||
"semi": true,
|
"semi": true,
|
||||||
"singleQuote": false,
|
"singleQuote": false,
|
||||||
"spaceBeforeFunctionParen": false
|
"spaceBeforeFunctionParen": false,
|
||||||
|
"printWidth": 120
|
||||||
}
|
}
|
||||||
|
|||||||
26
README.md
26
README.md
@@ -1,26 +0,0 @@
|
|||||||
# Purpose
|
|
||||||
|
|
||||||
Get up and going in Linux with some nice bash aliases, neovim configuration + plugins, and tmux.
|
|
||||||
|
|
||||||
# Prerequisites
|
|
||||||
|
|
||||||
- tmux
|
|
||||||
- npm or nvm
|
|
||||||
- neovim 0.8+
|
|
||||||
|
|
||||||
# Installation
|
|
||||||
|
|
||||||
Symlink the config files to `~/.config/nvim` and `~`, respectively, OR just run `./install.sh` which will do that for you.
|
|
||||||
|
|
||||||
> ln -s $HOME/repos/dotfiles/init.lua $HOME/.config/nvim/init.lua
|
|
||||||
> ln -s $HOME/repos/dotfiles/vimrc.vim $HOME/.config/nvim/vimrc.vim
|
|
||||||
> ln -s $HOME/repos/dotfiles/bash_aliases $HOME/.bash_aliases
|
|
||||||
> ln -s $HOME/repos/dotfiles/tmux.conf $HOME/.tmux.conf
|
|
||||||
|
|
||||||
After Coc is installed, install coc-pyright and pyright:
|
|
||||||
|
|
||||||
# terminal:
|
|
||||||
> npm install -g pyright
|
|
||||||
> sudo apt install ripgrep # or brew install
|
|
||||||
# inside nvim:
|
|
||||||
:CocInstall coc-pyright
|
|
||||||
143
bash_aliases
143
bash_aliases
@@ -4,19 +4,144 @@ alias bb='vi ~/.bashrc'
|
|||||||
alias ba='vi ~/.bash_aliases'
|
alias ba='vi ~/.bash_aliases'
|
||||||
alias bs='vi ~/.git_secret'
|
alias bs='vi ~/.git_secret'
|
||||||
alias r='cd ~/repos && pwd'
|
alias r='cd ~/repos && pwd'
|
||||||
alias vl='vi ~/.config/nvim/init.lua'
|
alias vv='vi ~/.config/nvim/init.lua'
|
||||||
alias vv='vi ~/.config/nvim/vimrc.vim'
|
alias dx='deactivate'
|
||||||
|
alias ph='poetry shell'
|
||||||
|
alias ta='tmux a'
|
||||||
alias gb='git branch'
|
alias gb='git branch'
|
||||||
alias gl='git log'
|
alias gl='git log'
|
||||||
|
alias pp='vi ~/.profile'
|
||||||
alias pg='git pull origin $(git branch --show-current)'
|
alias pg='git pull origin $(git branch --show-current)'
|
||||||
alias gp='git push origin $(git branch --show-current)'
|
alias gp='git push origin $(git branch --show-current)'
|
||||||
alias gs='git status'
|
alias gs='git status'
|
||||||
alias gd='git diff'
|
alias gt='git stash'
|
||||||
alias ga='git add --all'
|
|
||||||
alias i='ipython'
|
|
||||||
alias python=python3
|
|
||||||
alias v="vagrant ssh"
|
|
||||||
alias tt='vi ~/.tmux.conf'
|
alias tt='vi ~/.tmux.conf'
|
||||||
alias t='tree -a -I "*.pyc|*__pycache__|.git|.data|.pytest_cache|.ruff_cache"'
|
alias gd='git diff --diff-filter=ACMRTUXB'
|
||||||
alias p3=python3
|
alias gha='git rev-parse --short HEAD'
|
||||||
|
alias gf='git fetch'
|
||||||
|
alias ga='git add --all'
|
||||||
alias l='ls -lrta'
|
alias l='ls -lrta'
|
||||||
|
alias i='ipython'
|
||||||
|
alias python3=/usr/local/vitol/pyenv/versions/3.11.4/bin/python
|
||||||
|
alias p3=python3
|
||||||
|
alias t='tree -a -I "*.pyc|*__pycache__|.git|.data|.pytest_cache|.ruff_cache|.mypy_cache|node_modules|env"'
|
||||||
|
alias pl='poetry shell'
|
||||||
|
alias act='source env/bin/activate'
|
||||||
|
alias lsd='ls -d */'
|
||||||
|
alias tm='tmux'
|
||||||
|
alias c='cal --three'
|
||||||
|
|
||||||
|
n() {
|
||||||
|
local latest_file
|
||||||
|
latest_file=$(find . -type f \
|
||||||
|
-not -path '*/\.*' \
|
||||||
|
-not -path '*_cache/*' \
|
||||||
|
-not -path '*/__pycache__/*' \
|
||||||
|
-not -name '*.pyc' \
|
||||||
|
-not -name 'pyproject.toml' \
|
||||||
|
-not -name 'poetry.lock' \
|
||||||
|
-printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" ")
|
||||||
|
|
||||||
|
if [ -n "$latest_file" ]; then
|
||||||
|
nvim "$latest_file"
|
||||||
|
else
|
||||||
|
echo "No files found."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
function gc() {
|
||||||
|
git commit -m "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
v() {
|
||||||
|
local file
|
||||||
|
file=$(find . -type f \
|
||||||
|
-not -path "*/node_modules/*" \
|
||||||
|
-not -path "*/__pycache__/*" \
|
||||||
|
-not -path "*/venv/*" \
|
||||||
|
-not -path "*/.venv/*" \
|
||||||
|
-not -path "*/*cache/*" \
|
||||||
|
-not -path "*/.git/*" \
|
||||||
|
-not -path "*/.reports/*" \
|
||||||
|
| fzf)
|
||||||
|
if [[ -n $file ]]; then
|
||||||
|
vi "$file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function gh() {
|
||||||
|
git checkout -b $1
|
||||||
|
}
|
||||||
|
|
||||||
|
vm() {
|
||||||
|
# open the most recently modified file in the current directory
|
||||||
|
|
||||||
|
local substring="$1"
|
||||||
|
local modified_files
|
||||||
|
local selected_files
|
||||||
|
|
||||||
|
modified_files=$(git status --porcelain | grep '^.M' | awk '{print $2}')
|
||||||
|
|
||||||
|
if [ -z "$substring" ]; then
|
||||||
|
selected_files=$(echo "$modified_files" | fzf --multi --preview 'git diff --color=always {} | head -500')
|
||||||
|
else
|
||||||
|
matching_files=$(echo "$modified_files" | grep "$substring")
|
||||||
|
count=$(echo "$matching_files" | wc -l)
|
||||||
|
|
||||||
|
if [ "$count" -eq 1 ]; then
|
||||||
|
selected_files="$matching_files"
|
||||||
|
elif [ "$count" -gt 1 ]; then
|
||||||
|
selected_files=$(echo "$matching_files" | fzf --multi --preview 'git diff --color=always {} | head -500')
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$selected_files" ]; then
|
||||||
|
echo "$selected_files" | while read -r file; do
|
||||||
|
diff_output=$(git diff -U0 "$file")
|
||||||
|
first_change=$(echo "$diff_output" | grep -m1 '^@@')
|
||||||
|
if [ -n "$first_change" ]; then
|
||||||
|
line_info=$(echo "$first_change" | awk '{print $3}' | tr -d '+')
|
||||||
|
line_number=$(echo "$line_info" | cut -d, -f1)
|
||||||
|
change_type=$(echo "$diff_output" | grep -A1 "$first_change" | tail -n1 | cut -c1)
|
||||||
|
if [ "$change_type" = "-" ]; then
|
||||||
|
line_number=$((line_number + 1))
|
||||||
|
fi
|
||||||
|
$EDITOR "+$line_number" "$file"
|
||||||
|
else
|
||||||
|
$EDITOR "$file"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "No files selected."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
delete_branches_except() {
|
||||||
|
if [[ "$#" -eq 0 || "$1" != "--except" ]]; then
|
||||||
|
echo "Error: You must supply at least one '--except' argument."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
shift # Remove the '--except' argument
|
||||||
|
|
||||||
|
if [[ "$#" -eq 0 ]]; then
|
||||||
|
echo "Error: You must specify at least one branch to keep."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Store branches to keep in an array
|
||||||
|
local branches_to_keep=("$@")
|
||||||
|
|
||||||
|
# Get all local branches
|
||||||
|
local all_branches
|
||||||
|
all_branches=$(git branch --format='%(refname:short)')
|
||||||
|
|
||||||
|
# Loop through all branches and delete those not in the branches_to_keep array
|
||||||
|
for branch in $all_branches; do
|
||||||
|
if [[ ! " ${branches_to_keep[*]} " =~ " ${branch} " ]]; then
|
||||||
|
echo "Deleting branch: $branch"
|
||||||
|
git branch -D "$branch"
|
||||||
|
else
|
||||||
|
echo "Keeping branch: $branch"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
ln -s $HOME/repos/dotfiles/tmux.conf $HOME/.tmux.conf
|
|
||||||
ln -s $HOME/repos/dotfiles/bash_aliases $HOME/.bash_aliases
|
|
||||||
ln -s $HOME/repos/dotfiles/init.lua $HOME/.config/nvim/init.lua
|
|
||||||
ln -s $HOME/repos/dotfiles/vimrc.vim $HOME/.config/nvim/vimrc.vim
|
|
||||||
58
tmux.conf
58
tmux.conf
@@ -1,34 +1,50 @@
|
|||||||
# remap prefix
|
# remap prefix
|
||||||
unbind C-b
|
unbind C-b
|
||||||
set-option -g prefix `
|
set -g prefix `
|
||||||
bind-key ` send-prefix
|
bind ` send-prefix
|
||||||
|
|
||||||
set -g @plugin 'tmux-plugins/tpm'
|
|
||||||
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
||||||
set -g @plugin 'tmux-plugins/tmux-continuum'
|
|
||||||
set -g @continuum-restore 'on'
|
|
||||||
set -g @continuum-save-interval '1'
|
|
||||||
|
|
||||||
|
|
||||||
set -g mouse on
|
set -g mouse on
|
||||||
set -g pane-border-style fg=black
|
set -g pane-border-style fg=black
|
||||||
|
|
||||||
set-option -sg escape-time 10
|
set -g @sessionx-bind 'o'
|
||||||
set-option -g focus-events on
|
set -g @sessionx-bind 's'
|
||||||
set-option -g default-terminal "screen-256color"
|
bind l select-pane -t :.+
|
||||||
set-option -ga terminal-overrides ',xterm-256color:Tc'
|
bind h select-pane -t :.-
|
||||||
set-option -g history-limit 30000
|
|
||||||
set-window-option -g aggressive-resize
|
unbind-key -T copy-mode-vi v
|
||||||
|
|
||||||
setw -g mode-keys vi
|
setw -g mode-keys vi
|
||||||
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel
|
bind -T copy-mode-vi 'r' send -X rectangle-toggle # Begin selection in copy mode.
|
||||||
bind -T copy-mode-vi v send -X begin-selection
|
bind -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
|
||||||
|
bind -T copy-mode-vi 'y' send -X copy-selection # Yank selection in copy mode.
|
||||||
bind P paste-buffer
|
bind P paste-buffer
|
||||||
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel
|
bind -T root C-c if-shell -F '#{==:#{pane_mode},tree-mode}' 'send-keys Escape' 'send-keys C-c'
|
||||||
|
bind c new-window -c "#{pane_current_path}"
|
||||||
|
bind '"' split-window -c "#{pane_current_path}"
|
||||||
|
bind % split-window -h -c "#{pane_current_path}"
|
||||||
|
|
||||||
# bind ctrl-C to escape
|
set -sg escape-time 10
|
||||||
bind-key -n C-c send-keys Escape
|
set -g focus-events on
|
||||||
|
set -g default-terminal "screen-256color"
|
||||||
|
set -ga terminal-overrides ',xterm-256color:Tc'
|
||||||
|
set -g history-limit 30000
|
||||||
|
set-window-option -g aggressive-resize
|
||||||
|
# set -ag pane-active-border fg=magenta
|
||||||
|
|
||||||
|
set -g status on
|
||||||
|
set -g status-left ""
|
||||||
|
set -g status-right "#{session_name}"
|
||||||
|
set -g status-style bg=colour17,fg=colour248
|
||||||
|
|
||||||
|
set -g window-status-format ""
|
||||||
|
set -g window-status-current-format ""
|
||||||
|
set -g status-interval 1
|
||||||
|
set -g status-position bottom
|
||||||
|
set -g status-right-length 50
|
||||||
|
set -g display-time 200
|
||||||
|
set -g message-style bg=default,fg=default
|
||||||
|
set -g @plugin 'tmux-plugins/tpm'
|
||||||
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||||
|
set -g @plugin 'omerxx/tmux-sessionx'
|
||||||
run '~/.tmux/plugins/tpm/tpm'
|
run '~/.tmux/plugins/tpm/tpm'
|
||||||
# run-shell ~/clone/path/continuum.tmux
|
|
||||||
|
|
||||||
|
|||||||
70
vimrc.vim
70
vimrc.vim
@@ -1,70 +0,0 @@
|
|||||||
set autoindent expandtab tabstop=4 shiftwidth=4
|
|
||||||
set hidden
|
|
||||||
let g:python3_host_prog = '/usr/local/vitol/pyenv/versions/3.11.4/bin/python'
|
|
||||||
|
|
||||||
|
|
||||||
" When editing a file, always jump to the last known cursor position.
|
|
||||||
autocmd BufReadPost *
|
|
||||||
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
|
|
||||||
\ | exe "normal! g`\""
|
|
||||||
\ | endif
|
|
||||||
|
|
||||||
nnoremap <silent> <C-s> :w<cr>
|
|
||||||
nnoremap <C-l> :bn<cr>
|
|
||||||
nnoremap <C-h> :bp<cr>
|
|
||||||
inoremap <silent> <C-S> <esc>:w<cr>i
|
|
||||||
let mapleader=" "
|
|
||||||
nnoremap <leader>w :w<cr>:bw<cr>
|
|
||||||
nnoremap <silent> <leader>W :bw<cr>
|
|
||||||
nnoremap <leader>v :e ~/.config/nvim/init.lua<cr>
|
|
||||||
nnoremap <leader>m :e ~/.config/nvim/vimrc.vim<cr>
|
|
||||||
nnoremap <leader>s :source ~/.config/nvim/init.lua<cr>
|
|
||||||
nnoremap <leader>q :xa<cr>
|
|
||||||
nnoremap <leader>f <cmd>Telescope find_files<cr>
|
|
||||||
nnoremap <leader>g <cmd>Telescope live_grep<cr>
|
|
||||||
nnoremap <leader>b <cmd>Telescope buffers<cr>
|
|
||||||
nnoremap <leader>h <cmd>Telescope help_tags<cr>
|
|
||||||
nnoremap <leader>l <cmd>Lazy<cr>
|
|
||||||
nmap <silent> <leader>j <Plug>(coc-diagnostic-prev)
|
|
||||||
nmap <silent> <leader>d <Plug>(coc-diagnostic-next)
|
|
||||||
function! s:c_cycle(count) abort
|
|
||||||
let qf_info = getqflist({ 'idx': 0, 'size': 0 })
|
|
||||||
let size = qf_info->get('size')
|
|
||||||
if size == 0
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
|
|
||||||
let idx = qf_info->get('idx')
|
|
||||||
|
|
||||||
let num = (idx + size + a:count) % size
|
|
||||||
|
|
||||||
if num == 0
|
|
||||||
let num = size
|
|
||||||
endif
|
|
||||||
|
|
||||||
execute num .. 'cc'
|
|
||||||
endfunction
|
|
||||||
command! -nargs=1 CCycle call s:c_cycle(<q-args>)
|
|
||||||
|
|
||||||
nnoremap <expr> [n '<Cmd>CCycle -' .. v:count1 .. '<CR>'
|
|
||||||
nnoremap <expr> ]n '<Cmd>CCycle ' .. v:count1 .. '<CR>'
|
|
||||||
|
|
||||||
vnoremap <C-k> :m '<-2<CR>gv=gv
|
|
||||||
vnoremap <C-j> :m '>+1<CR>gv=gv
|
|
||||||
nnoremap <C-k> :m -2<CR>
|
|
||||||
nnoremap <C-j> :m +1<CR>
|
|
||||||
map gf :e<cfile><cr>
|
|
||||||
|
|
||||||
augroup tokyonight-night
|
|
||||||
autocmd!
|
|
||||||
autocmd ColorScheme * highlight Normal guibg=NONE ctermbg=NONE
|
|
||||||
autocmd ColorScheme * highlight NonText guibg=NONE ctermbg=NONE
|
|
||||||
augroup END
|
|
||||||
colorscheme tokyonight-night
|
|
||||||
set background=dark
|
|
||||||
|
|
||||||
let g:LanguageClient_useVirtualText = 0 " disable inline errors
|
|
||||||
|
|
||||||
set undodir=~/.config/nvim/undodir
|
|
||||||
set undofile
|
|
||||||
set number relativenumber
|
|
||||||
Reference in New Issue
Block a user