Compare commits

...

28 Commits

Author SHA1 Message Date
bretello 7efeedf6d9
add extras folder
just miscellaneous script/configs that could be useful
2023-09-15 00:35:36 +02:00
bretello e32676922e
zsh: add tracing module 2023-09-15 00:33:46 +02:00
bretello b96f0a6f86
zsh: add pacman module 2023-09-15 00:32:28 +02:00
bretello 51f92885fe
ipython: add fix for broken pager with bat 2023-09-15 00:29:56 +02:00
bretello d4bf2f32f8
vim: allow local override of config via the .vimrc.local file 2023-09-15 00:29:56 +02:00
bretello e749eedb75
vim: get rid of set shell/shellcmdflag 2023-09-15 00:29:56 +02:00
bretello 455ba2c17e
vim: misc linting fixes 2023-09-15 00:29:56 +02:00
bretello f6880b715e
vim: group autocommands in augroups 2023-09-15 00:29:55 +02:00
bretello de05c9c8f7
vim: add support for THEME_PREFER_LIGHT env variable 2023-09-15 00:29:55 +02:00
bretello 20baed04d9
vim: cleanup plugs 2023-09-15 00:29:55 +02:00
bretello cf6dad897d
vim: plugs: add colorizer for hex color codes 2023-09-15 00:29:55 +02:00
bretello fa69ebe8f9
vim: ale: tweak ale_lint_on enter/insert 2023-09-15 00:29:55 +02:00
bretello 0e5f23e864
vim: ale: add arduino config 2023-09-15 00:29:55 +02:00
bretello 1ccb61013d
vim: make plugs lazier 2023-09-15 00:29:55 +02:00
bretello a0c5985009
vim: ale: add basic android dev configuration 2023-09-15 00:29:55 +02:00
bretello 90c870b91d
vim: ale: update linters 2023-09-14 23:30:31 +02:00
bretello be236d0e25
vim: <leader>Q :close! 2023-09-14 23:30:31 +02:00
bretello f5f6133c53
vim: ale: update fixers 2023-09-14 23:30:31 +02:00
bretello 4b19ff0f38
ansible: update brethil dotfiles mark 2023-09-14 23:30:31 +02:00
bretello 9ed23cd5a5
ansible: update packages 2023-09-14 23:30:31 +02:00
bretello 99baa7f1e0
zsh: automatically enable/disable python virtualenvs on chdir 2023-09-14 23:30:31 +02:00
bretello 1dcdb77f97
zsh: add SAVEHIST for unlimited history 2023-09-14 23:30:31 +02:00
bretello c5532fea31
zsh: add FZF_CTRL_T_COMMAND 2023-09-14 23:30:30 +02:00
bretello 70aec3b2b6
useful_commands: add dbus introspection 2023-09-14 23:30:30 +02:00
bretello 39abcd4756
zsh: remove set -x from mangrep() definition 2023-09-14 23:30:30 +02:00
bretello 5a1c3c07ac
zsh: add support for THEME_PREFER_LIGHT env variable for bat theme 2023-09-14 23:30:30 +02:00
bretello 0c52f21233
pdbrc: add support from THEME_PREFER_LIGHT env variable 2023-09-14 22:40:49 +02:00
bretello b193afe50a
upgrade script: avoid printing extra line on source 2023-09-14 22:38:57 +02:00
20 changed files with 349 additions and 51 deletions

View File

@ -7,21 +7,26 @@ packages:
- "git"
- "grc"
- "htop"
- "mtr"
- "nmap"
- "ripgrep"
- "tmux"
- "tree"
- "vim"
- "zsh"
- "iotop"
packages_debian:
- "pylint"
- "ipython3"
- "python3-pip"
- "python3-setuptools"
- "virtualenv"
- "batcat"
- "mtr-tiny"
packages_archlinux:
- "man"
- "ipython"
- "python-pylint"
- "python-virtualenv"
- "bash-language-server"
- "bat"
- "mtr"

View File

@ -57,7 +57,7 @@
- name: zsh config
blockinfile:
path: $HOME/.zshrc
marker: "# brethil dotfiles"
marker: "# {mark} brethil dotfiles"
block: |
export DOTFILES={{ DOTFILES }}
source $DOTFILES/brethil_dotfile.sh

View File

@ -18,6 +18,13 @@ antibody bundle < "$DOTFILES/antibody_plugins.txt"
source $DOTFILES/completion_style.zsh
source $DOTFILES/extras/fzf-tab-config.zsh
if command -v fd >/dev/null; then
export FZF_CTRL_T_COMMAND='fd'
else
export FZF_CTRL_T_COMMAND='find'
fi
export FZF_CTRL_T_OPTS=" --preview-window=right,60% --preview \"bash -c 'if [[ -d \"{}\" ]]; then tree -C \"{}\"; else bat --style=plain --color=always \"{}\"; fi'\" --bind 'ctrl-/:change-preview-window(right,70%|down,40%,border-horizontal|hidden|right)'"
if [[ "$(command -v systemctl)" ]]; then
antibody bundle robbyrussell/oh-my-zsh path:plugins/systemd
fi
@ -66,6 +73,7 @@ if ! grep -q "set editing-mode vi" $HOME/.inputrc &> /dev/null; then
fi
export HISTSIZE=10000000
export SAVEHIST=10000000
# zsh-autosuggestions config
@ -81,7 +89,11 @@ if [[ "$(command -v bat)" || "$(command -v batcat)" ]]; then
alias cat=batcat
export PAGER=batcat
fi
export BAT_THEME="gruvbox-dark"
if [[ -n $THEME_PREFER_LIGHT ]]; then
export BAT_THEME="gruvbox-light"
else
export BAT_THEME="gruvbox-dark"
fi
export BAT_PAGER="less $LESS"
export PAGER=bat
@ -95,6 +107,9 @@ if [[ $SSH_CLIENT ]]; then
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
fi
# Automatically enable/disable virtualenv on chdir/step
export DOTFILES_AUTOSWITCH_VIRTUALENV=1
alias esource='$EDITOR $HOME/.zshrc'
alias resource='source $HOME/.zshrc'
alias dotedit='$EDITOR $DOTFILES/brethil_dotfile.sh'

View File

@ -0,0 +1,10 @@
#_tmux_sourced=1 exec tmux
if [[ -z $TMUX ]] && [[ -n $SSH_TTY ]]; then
session=tmux
if tmux has-session -t "$session" 2>/dev/null; then
exec tmux attach-session -t "$session"
else
exec tmux new-session -s "$session"
fi
fi

View File

@ -49,7 +49,7 @@ function update_dotfiles() {
zmodload -F zsh/stat b:zstat
if mtime=$(zstat +mtime "$DOTFILES/update.lock" 2>/dev/null); then
if (( (mtime + 3600 * 24) < EPOCHSECONDS )); then
command rm -rf "$DOTFILES/update.lock"
command rm -f "$DOTFILES/update.lock"
fi
fi
@ -65,7 +65,6 @@ function update_dotfiles() {
trap "
unset -f current_epoch _update_dotfiles_update update_dotfiles &>/dev/null
command rmdir '$DOTFILES/update.lock' &>/dev/null
echo
return 1
" EXIT INT QUIT

View File

@ -0,0 +1,50 @@
#!/usr/bin/env zsh
# Reads output from zprof.
# Usage:
# 1. add the following to the beginning of your zshrc
# if [[ -n $profiling ]]; then
# zmodload zsh/zprof
# zmodload zsh/datetime
# setopt PROMPT_SUBST
# PS4='+$EPOCHREALTIME %N:%i> '
#
# logfile=$(mktemp zsh_profile.XXXXXXXX)
# echo "Logging to $logfile"
# exec 3>&2 2>$logfile
#
# setopt XTRACE
# fi
# 2. add this to the end of your zshrc
# if [[ -n $profiling ]]; then
# unsetopt XTRACE
# exec 2>&3 3>&-
# zprof
# fi
# 3. zsh -i -c exit
# 4. sort_timings.zsh zsh_profile.* # or use the newly-created file
typeset -a lines
typeset -i prev_time=0
typeset prev_command
while read line; do
if [[ $line =~ '^.*\+([0-9]{10})\.([0-9]{6})[0-9]* (.+)' ]]; then
integer this_time=$match[1]$match[2]
if [[ $prev_time -gt 0 ]]; then
time_difference=$(( $this_time - $prev_time ))
lines+="$time_difference $prev_command"
fi
prev_time=$this_time
local this_command=$match[3]
if [[ ${#this_command} -le 80 ]]; then
prev_command=$this_command
else
prev_command="${this_command}..."
fi
fi
done < ${1:-/dev/stdin}
print -l ${(@On)lines} # | sort -h | vim -

4
extras/sshrc 100644
View File

@ -0,0 +1,4 @@
#!/bin/bash
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi

15
extras/zprofile 100644
View File

@ -0,0 +1,15 @@
# Make sure SSH_AUTH_sock is symlinked
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
#_tmux_sourced=1 exec tmux
if [[ -z $TMUX ]] && [[ -n $SSH_TTY ]]; then
session=tmux
if tmux has-session -t "$session" 2>/dev/null; then
exec tmux attach-session -t "$session"
else
exec tmux new-session -s "$session"
fi
fi

View File

@ -0,0 +1,18 @@
# Make sure SSH_AUTH_sock is symlinked
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
#_tmux_sourced=1 exec tmux
if [[ -z $TMUX ]] && [[ -n $SSH_TTY ]]; then
set -x
session=tmux
if tmux has-session -t "$session" 2>/dev/null; then
exec tmux attach-session -t "$session"
else
tmux new-session -s "$session"
exec tmux attach-session -t "$session"
fi
fi

View File

@ -269,7 +269,6 @@ function find_by_mtime() {
function mangrep() {
set -x
if [[ -z "$@" ]]; then
echo "Usage: $0 <pattern> <command>"
echo "Opens man page for <command> at the first match for <pattern>"

View File

@ -0,0 +1,9 @@
if ! command -v pacman &>/dev/null; then return; fi
function pacpreview() {
if ! command -v fzf &>/dev/null; then
echo "Requires fzf! Quitting"
return 1
fi
pacman -Slq | fzf --multi --preview 'grc --colour=on pacman -Si {1}' | xargs -ro sudo pacman -S
}

View File

@ -22,3 +22,34 @@ mkvenv(){
source .venv/bin/activate && echo -e "$(color $BOLD Enabled!) 🐍 $(color $BOLD$PURPLE $(python --version | cut -d " " -f2 )) ($(color $BOLD$GREEN $(pip --version | cut -d " " -f -2)))"
fi
}
function enable_venv() {
local root
local activate
root=$(git rev-parse --show-toplevel 2>/dev/null)
if [[ -z $root ]]; then root=$PWD; fi
activate="$root/.venv/bin/activate"
if [[ -f "$activate" ]]; then
source "$activate"
fi
}
function disable_venv() {
if [[ -z ${VIRTUAL_ENV} ]]; then
return
fi
if [[ ! "$PWD" =~ $(dirname $VIRTUAL_ENV)}* ]]; then
echo "Deactivating venv..."
deactivate
fi
}
if [[ -n $DOTFILES_AUTOSWITCH_VIRTUALENV ]]; then
add-zsh-hook chpwd enable_venv
add-zsh-hook chpwd disable_venv
enable_venv
fi

View File

@ -0,0 +1,18 @@
#!/bin/zsh
function start_tracing {
zmodload zsh/zprof
zmodload zsh/datetime
setopt PROMPT_SUBST
PS4+='+$EPOCHREALTIME %N:%i> '
logfile=$(mktemp zsh_profile.XXXXXXXX)
echo "logging to $logfile"
exec 3>&2 2>$logfile
setopt XTRACE
}
function stop_tracing {
unsetopt XTRACE
exec 2>&3 3>&-
zprof | tee zprof_out.log | vimscratch -
}

View File

@ -0,0 +1,3 @@
import os
os.environ["PAGER"] = "bat --style=plain"

View File

@ -1,19 +1,26 @@
import os
import pdb
from pygments.styles import get_style_by_name
if os.getenv("THEME_PREFER_LIGHT"):
pygments_style = "gruvbox-light"
else:
pygments_style = "gruvbox-dark"
class Config(pdb.DefaultConfig):
# prompt = "(Pdb++) "
skip = ["dvc.stage.decorators.*", "funcy.*"]
sticky_by_default = True
use_pygments = True
if pdb.__version__.version.startswith("0.10.4."):
pygments_formatter_class = "pygments.formatters.TerminalTrueColorFormatter"
pygments_formatter_kwargs = {"style": get_style_by_name("gruvbox-dark")}
pygments_formatter_kwargs = {"style": get_style_by_name(pygments_style)}
else:
from pygments.formatters import TerminalTrueColorFormatter
formatter = TerminalTrueColorFormatter(style=get_style_by_name("gruvbox-dark"))
formatter = TerminalTrueColorFormatter(style=get_style_by_name(pygments_style))
editor = "vim"

View File

@ -252,3 +252,5 @@ emacs -batch -l dunnet
# BINARY CLOCK!
watch -n 1 'echo "obase=2;`date +%s`" | bc'
# dbus introspection
busctl -j --user introspect org.freedesktop.Notifications "/fr/emersion/Mako"

View File

@ -10,20 +10,26 @@ let g:ale_fixers = {
\ 'json': ['prettier'],
\ 'c': ['clang-format'],
\ 'cpp': ['clang-format'],
\ 'cmake': ['cmakeformat'],
\ 'css': ['prettier'],
\ 'html': ['prettier'],
\ 'kotlin': ['ktlint'],
\ 'markdown': ['prettier'],
\ 'terraform': ['terraform'],
\ 'java': ['eclipselsp'],
\ 'yaml': ['prettier'],
\ 'python': ['black', 'isort'],
\ 'go': ['gofmt', 'goimports'],
\ 'rust': ['rustfmt'],
\ 'sql': ['pgformatter'],
\ 'java': ['clang-format'],
\ 'javascript': ['prettier', 'eslint'],
\ 'vue': ['prettier', 'eslint']
\ 'vue': ['prettier', 'eslint'],
\}
let g:ale_fixers_aliases = {'vue': ['vue', 'javascript']}
let g:ale_fixers_aliases = {'vue': ['vue', 'javascript'], 'arduino': 'cpp'}
let g:ale_arduino_ccls_executable = 'ccls'
let g:ale_arduino_ccls_init_options = {}
let g:ale_popup_menu_enabled = 1
let g:ale_python_bandit_options = '-c banditrc'
let g:ale_python_pylint_options = '-j0 --disable=W0511'
@ -37,26 +43,46 @@ let g:ale_linters = {
\ 'bash': ['bash-language-server', 'bashlint', 'shellcheck'],
\ 'dockerfile': ['hadolint'],
\ 'zsh': ['bashlint', 'shellcheck'],
\ 'c': ['clangd'],
\ 'c': ['ccls', 'clangd'],
\ 'cpp': ['clangd'],
\ 'python': ['pylsp', 'pylint', 'bandit', 'mypy', 'flake8'],
\ 'qml': ['qmllint'],
\ 'python': ['pylsp', 'mypy', 'ruff'],
\ 'go': ['gopls', 'gobuild'],
\ 'rust': ['analyzer'],
\ 'rust': ['analyzer', 'cargo'],
\ 'yaml': ['yamllint'],
\ 'javascript': ['yarn lint', 'eslint', 'vls']
\ 'javascript': ['yarn lint', 'eslint'],
\ 'xml': ['android'],
\ 'groovy': ['android'],
\ 'java': ['eclipselsp', 'android'],
\ 'kotlin': ['android', 'ktlint', 'languageserver'],
\ 'vue': ['volar', 'eslint']
\}
let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
let g:ale_linter_aliases = {'vue': ['vue', 'javascript'], 'arduino': 'cpp'}
" disable gradle signs/loclist as they conflict with ALE (vim-android)
let g:gradle_loclist_show = 0
let g:gradle_show_signs = 0
let g:ale_java_eclipselsp_path = '~/git/eclipse.jdt.ls'
let g:ale_yaml_yamllint_options = '--config .editorconfig'
let g:ale_open_list = 0
let g:ale_keep_list_window_open = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_enter = 1 " uncomment if you do not want to lint files on open
let g:ale_lint_on_insert_leave = 0
let g:ale_lint_on_enter = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_text_changed = 0
let g:ale_lint_delay = 2500 " lint 2.5 seconds after text has changed
augroup androiddev
" avoid death by gradle
autocmd! FileType java,kotlin let g:ale_lint_on_insert_leave = 0
augroup END
let g:ale_fix_on_save = 1
let g:ale_completion_enabled = 1
" let g:ale_completion_autoimport = 1
@ -153,6 +179,42 @@ let g:airline_section_x=' %{tagbar#currenttag("%s", "", "f")}'
let g:airline#extensions#tagbar#flags = 's'
let g:airline#extensions#tagbar#searchmethod = 'scoped-stl'
" only these functions will only be defined when lightline#gradle#... funtions
" are defined, which happens when vim-android is loaded
if exists('lightline#gradle#running')
call airline#parts#define_function(
\ 'gradle-running',
\ 'lightline#gradle#running'
\)
call airline#parts#define_function(
\ 'gradle-errors',
\ 'lightline#gradle#errors'
\)
call airline#parts#define_function(
\ 'gradle-warnings',
\ 'lightline#gradle#warnings'
\)
call airline#parts#define_function(
\ 'gradle-project',
\ 'lightline#gradle#project'
\)
let g:airline_section_x= airline#section#create_right([
\ 'filetype',
\ 'gradle-running',
\ 'gradle-errors',
\ 'gradle-warnings'
\])
let g:gradle_glyph_gradle = ''
let g:gradle_glyph_android = ''
let g:gradle_glyph_error = ''
let g:gradle_glyph_warning = ''
let g:gradle_glyph_building = ''
endif
" These are the default mappings for vim-multi-cursor
let g:multi_cursor_start_word_key = '<C-n>'

View File

@ -11,8 +11,6 @@ call plug#begin('~/.vim/vim-plug')
Plug 'tpope/vim-sensible'
" Colorscheme
Plug 'https://github.com/morhetz/gruvbox'
"Plug 'kristijanhusak/vim-hybrid-material'
"Plug 'https://github.com/rafi/awesome-vim-colorschemes'
" Csv files 🤦
Plug 'https://github.com/mechatroner/rainbow_csv', { 'for': 'csv' }
@ -40,14 +38,18 @@ Plug 'https://github.com/maxbrunsfeld/vim-yankstack'
" Mark indentation level
Plug 'https://github.com/nathanaelkane/vim-indent-guides'
" Meson + Ninja
Plug 'https://github.com/igankevich/mesonic'
if executable('meson')
Plug 'https://github.com/igankevich/mesonic'
endif
" fzf
Plug 'junegunn/fzf'
Plug 'junegunn/fzf.vim'
" Open tags with fzf's :Tags
Plug 'https://github.com/ludovicchabant/vim-gutentags.git'
if executable('ctags')
Plug 'https://github.com/ludovicchabant/vim-gutentags.git'
endif
" snippets
if has('python3')
@ -65,24 +67,48 @@ Plug 'https://github.com/mgedmin/coverage-highlight.vim'
"Languages
Plug 'https://github.com/bfrg/vim-cpp-modern', {'for': 'cpp'}
Plug 'https://github.com/rust-lang/rust.vim', {'for': 'rust'}
Plug 'epheien/termdbg', {'for': ['c', 'cpp']}
if executable('cargo')
Plug 'https://github.com/rust-lang/rust.vim', {'for': 'rust'}
endif
Plug 'https://github.com/vim-scripts/nginx.vim', {'for': 'nginx'}
Plug 'https://github.com/plasticboy/vim-markdown', {'for': 'markdown'}
Plug 'https://github.com/cespare/vim-toml', {'for': 'toml'}
Plug 'https://github.com/vim-scripts/iptables', {'for': 'iptables'}
Plug 'https://github.com/leafoftree/vim-vue-plugin', {'for': 'vue'}
Plug 'https://github.com/hashivim/vim-terraform', {'for': 'terraform'}
Plug 'https://github.com/fatih/vim-go', {'for': 'go'}
if executable('vite')
" TODO: check if plugin is still up-to-date
Plug 'https://github.com/leafoftree/vim-vue-plugin', {'for': 'vue'}
endif
if executable('terraform')
Plug 'https://github.com/hashivim/vim-terraform', {'for': 'terraform'}
endif
if executable('go')
Plug 'https://github.com/fatih/vim-go', {'for': 'go'}
endif
" Plug 'epheien/termdbg'
if executable('adb') && executable('gradle')
Plug 'https://github.com/udalov/kotlin-vim', {'for': 'kotlin'}
Plug 'https://github.com/hsanson/vim-android', {'for': 'java'}
endif
Plug 'https://github.com/alfredodeza/pytest.vim', {'for': 'python'}
if executable('qml')
Plug 'https://github.com/peterhoeg/vim-qml', {'for': 'qml'}
endif
if executable('pytest')
Plug 'https://github.com/alfredodeza/pytest.vim', {'for': 'python'}
endif
" Colorize hex codes and/or color strings
Plug 'https://github.com/chrisbra/Colorizer'
" No RGB, no party
let vim_razer = expand('~/projects_razer/vim-razer')
if isdirectory(vim_razer)
Plug vim_razer
endif
call plug#end()
" Install plugins if missing

View File

@ -53,6 +53,7 @@ nnoremap <leader>wz :call WinZoomToggle()<CR>
nnoremap <leader>q :close<CR>
nnoremap <leader>B :Bclose<CR>
nnoremap <leader>Q :close!<CR>
nnoremap <leader>k :Rg<CR>
"" Fugitive
@ -154,3 +155,8 @@ autocmd FileType python nnoremap T :Pytest function --pdb<CR>
" Ultisnips
map <Leader>ue :UltiSnipsEdit<cr>
nmap <F5> <ESC>:Gradle assembleDebug<CR>
nmap <F6> <ESC>:AndroidInstall debug<CR>
nmap <F7> <ESC>:AndroidLaunch debug<CR>

View File

@ -9,13 +9,17 @@ scriptencoding utf-8
"" Style
" enable truecolor mode
if has("termguicolors")
if has('termguicolors')
set termguicolors
else
let &t_8f = "\<Esc>[38:2:%lu:%lu:%lum"
let &t_8b = "\<Esc>[48:2:%lu:%lu:%lum"
endif
set background=dark
if !empty($THEME_PREFER_LIGHT)
set background=light
else
set background=dark
endif
let g:gruvbox_contrast_dark='hard'
let g:gruvbox_sign_column='bg0'
@ -35,8 +39,6 @@ end
set relativenumber number
set foldlevelstart=3 foldmethod=indent nofoldenable "without foldenable all folds are open at startup"
set shell=zsh
"set shellcmdflag=-ilc " make builtin shell interactive
set nobackup nowb noswapfile " no need for backups of every file
set history=10000
@ -78,36 +80,49 @@ syntax match jsonComment "\(/\*\)\|\(\*/\)"
hi def link jsonComment Comment
au BufRead dvc.yaml let b:ale_fix_on_save=0
au BufRead *.dvc let b:ale_fix_on_save=0
au BufRead *.dvc set filetype=yaml
augroup dvc
au BufRead dvc.yaml let b:ale_fix_on_save=0
au BufRead *.dvc let b:ale_fix_on_save=0
au BufRead *.dvc set filetype=yaml
augroup END
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
au BufRead,BufNewFile */.github/*/*.y{,a}ml
augroup ansible
au BufRead,BufNewFile */playbooks/*.yml set filetype=yaml.ansible
augroup END
augroup githubactions
au BufRead,BufNewFile */.github/*/*.y{,a}ml
\ let b:ale_linters = {'yaml': ['actionlint'] }
au BufRead,BufNewFile rules.v[46],*.rules setlocal filetype=iptables
augroup END
augroup iptables
au BufRead,BufNewFile rules.v[46],*.rules setlocal filetype=iptables
augroup END
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/shortcuts.vim source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugUpdate
augroup vimconfig
autocmd! bufwritepost ~/.vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/vimrc source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/shortcuts.vim source ~/.vimrc
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugInstall
autocmd! bufwritepost $DOTFILES/vim/plugs.vim PlugUpdate
augroup END
if has('persistent_undo')
let undo_dir=$HOME . "/.vim/undo"
let undo_dir=$HOME . '/.vim/undo'
if !isdirectory(undo_dir)
call mkdir(undo_dir , "p", 0o700)
call mkdir(undo_dir , 'p', 0700)
endif
let &undodir=undo_dir
set undofile
endif
" Return to last edit position when opening files (from amix's vimrc)
au BufReadPost * if ! exists('b:dotgitFolder') | if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" set a marker to avoid returning to the previous position in .git folders
" (avoids returning to previous position for COMMIT_EDITMSG etc )
au BufReadPost */.git/* let b:dotgitFolder = 1
augroup dotgit
" Return to last edit position when opening files (from amix's vimrc)
au BufReadPost * if ! exists('b:dotgitFolder') | if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
" set a marker to avoid returning to the previous position in .git folders
" (avoids returning to previous position for COMMIT_EDITMSG etc )
au BufReadPost */.git/* let b:dotgitFolder = 1
augroup END
" Bash like keys for the command line
cnoremap <C-A> <Home>
@ -120,3 +135,7 @@ cnoremap <C-N> <Down>
source $DOTFILES/vim/plugins_config.vim
source $DOTFILES/vim/shortcuts.vim
source $DOTFILES/vim/functions.vim
if filereadable('.vimrc.local')
source .vimrc.local
endif