Compare commits
12 Commits
78fafd18ee
...
1dd6ac51ae
Author | SHA1 | Date |
---|---|---|
Hektor Misplon | 1dd6ac51ae | |
Hektor Misplon | 2444cba1cb | |
Hektor Misplon | 02eab915e7 | |
Hektor Misplon | e3517c8dc0 | |
Hektor Misplon | 06c90adb7c | |
Hektor Misplon | 93a76e7940 | |
Hektor Misplon | d2ac9d3822 | |
Hektor Misplon | 14b69eb0f8 | |
Hektor Misplon | ce21e48fd7 | |
Hektor Misplon | e1f55bed1a | |
Hektor Misplon | 393e2c5db5 | |
Hektor Misplon | 6cf696e1f6 |
|
@ -8,7 +8,7 @@ alias al-=unalias
|
|||
# Edit configuration files
|
||||
alias eba="nvim ~/.bashrc"
|
||||
alias eal="nvim ~/.bash_aliasrc"
|
||||
alias ev="nvim ~/.vimrc"
|
||||
alias ev="edit_editor_config"
|
||||
|
||||
# Navigation
|
||||
alias ..="cd .."
|
||||
|
|
38
.bashrc
38
.bashrc
|
@ -4,36 +4,18 @@
|
|||
|
||||
source /etc/os-release
|
||||
|
||||
# Aliases {{{
|
||||
# Editor & prompt configuration
|
||||
[ -f "$HOME/.bashrc.d/editor" ] && source "$HOME/.bashrc.d/editor"
|
||||
[ -f "$HOME/.bashrc.d/prompt" ] && source "$HOME/.bashrc.d/prompt"
|
||||
|
||||
# Load aliases dynamically
|
||||
[ -f "$HOME/.bash_aliases/all" ] && source "$HOME/.bash_aliases/all"
|
||||
[ -f "$HOME/.bash_aliases/$HOSTNAME" ] && source "$HOME/.bash_aliases/$HOSTNAME"
|
||||
[ -f "$HOME/.bash_aliases/hosts/$HOSTNAME" ] && source "$HOME/.bash_aliases/hosts/$HOSTNAME"
|
||||
[ -f "$HOME/.bash_aliases/private" ] && source "$HOME/.bash_aliases/private"
|
||||
# }}}
|
||||
|
||||
# Dynamic configuration {{{
|
||||
[ -f "$HOME/.bashrc.d/$HOSTNAME" ] && source "$HOME/.bashrc.d/$HOSTNAME"
|
||||
# Host-specific and private configurations
|
||||
[ -f "$HOME/.bashrc.d/hosts/$HOSTNAME" ] && source "$HOME/.bashrc.d/hosts/$HOSTNAME"
|
||||
[ -f "$HOME/.bashrc.d/private" ] && source "$HOME/.bashrc.d/private"
|
||||
# }}}
|
||||
|
||||
# Prompt {{{
|
||||
get_branch_name() {
|
||||
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|
||||
|| git rev-parse --short HEAD 2>/dev/null \
|
||||
|| echo 'some branch'
|
||||
}
|
||||
get_git_info() {
|
||||
git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
echo -e " $(get_branch_name)"
|
||||
}
|
||||
|
||||
PS1="\u \w ❭\[$(tput sgr0)\] "
|
||||
|
||||
# Ellipsis when deep in directory
|
||||
export PROMPT_DIRTRIM=2
|
||||
|
||||
export PS1
|
||||
# }}}
|
||||
|
||||
# Path {{{
|
||||
# Add ~/.bin to PATH
|
||||
|
@ -53,12 +35,6 @@ export MANWIDTH=80
|
|||
export PAGER=nvimpager
|
||||
# }}}
|
||||
|
||||
# Editor {{{
|
||||
# Set vim as default editor
|
||||
export EDITOR=nvim
|
||||
export SUDO_EDITOR=nvim
|
||||
# }}}
|
||||
|
||||
# Nvm
|
||||
export PATH=~/.nvm/versions/node/v14.16.0/bin:$PATH
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
# vim: set ft=bash :
|
||||
|
||||
# Set NeoVim as default editor
|
||||
export EDITOR=nvim
|
||||
export SUDO_EDITOR="$EDITOR"
|
||||
|
||||
declare -A -r EDITOR_CONFIGS=(
|
||||
["nvim"]="$HOME/.config/nvim/init.lua"
|
||||
["vim"]="$HOME/.vimrc"
|
||||
)
|
||||
|
||||
edit_editor_config() {
|
||||
for editor in "${!EDITOR_CONFIGS[@]}"; do
|
||||
if [ "$EDITOR" = "$editor" ]; then
|
||||
$EDITOR "${EDITOR_CONFIGS[$editor]}"
|
||||
fi
|
||||
done
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
# Laptop configuration
|
|
@ -0,0 +1,18 @@
|
|||
# Laptop configuration
|
||||
|
||||
# >>> mamba initialize >>>
|
||||
# !! Contents within this block are managed by 'mamba init' !!
|
||||
export MAMBA_EXE="/usr/bin/micromamba";
|
||||
export MAMBA_ROOT_PREFIX="/home/h/.local/share/micromamba";
|
||||
__mamba_setup="$("$MAMBA_EXE" shell hook --shell bash --prefix "$MAMBA_ROOT_PREFIX" 2> /dev/null)"
|
||||
if [ $? -eq 0 ]; then
|
||||
eval "$__mamba_setup"
|
||||
else
|
||||
if [ -f "/home/h/.local/share/micromamba/etc/profile.d/micromamba.sh" ]; then
|
||||
. "/home/h/.local/share/micromamba/etc/profile.d/micromamba.sh"
|
||||
else
|
||||
export PATH="/home/h/.local/share/micromamba/bin:$PATH" # extra space after export prevents interference from conda init
|
||||
fi
|
||||
fi
|
||||
unset __mamba_setup
|
||||
# <<< mamba initialize <<<
|
|
@ -0,0 +1,20 @@
|
|||
# vim: set ft=bash :
|
||||
get_branch_name() {
|
||||
git symbolic-ref --quiet --short HEAD 2>/dev/null \
|
||||
|| git rev-parse --short HEAD 2>/dev/null \
|
||||
|| echo 'some branch'
|
||||
}
|
||||
get_git_info() {
|
||||
git rev-parse --is-inside-work-tree &>/dev/null || return
|
||||
echo -e "($(get_branch_name))"
|
||||
}
|
||||
|
||||
if [[ $SSH_CONNECTION ]]; then
|
||||
PS1='\[\033[01;31m\]\u@\h\[\033[00m\] $(get_git_info)\W❭\[$(tput sgr0)\] '
|
||||
else
|
||||
PS1='\u $(get_git_info)\W❭\[$(tput sgr0)\] '
|
||||
fi
|
||||
|
||||
# Ellipsis when deep in directory
|
||||
export PROMPT_DIRTRIM=2
|
||||
export PS1
|
|
@ -1,4 +0,0 @@
|
|||
let g:copilot_no_tab_map = v:true
|
||||
imap <c-l> <plug>(copilot-next)
|
||||
imap <c-h> <plug>(copilot-prev)
|
||||
imap <silent><script><expr> <s-tab> copilot#Accept("\<CR>")
|
|
@ -0,0 +1,5 @@
|
|||
highlight QuickScopePrimary gui=underline cterm=underline
|
||||
highlight QuickScopeSecondary gui=underline cterm=underline
|
||||
|
||||
let g:qs_max_chars=80
|
||||
let g:qs_lazy_highlight = 1
|
|
@ -1,2 +0,0 @@
|
|||
let g:qs_max_chars=80
|
||||
let g:qs_lazy_highlight = 1
|
|
@ -11,34 +11,98 @@ nm <leader>ww <plug>(wiki-index)
|
|||
" nm <leader>v <plug>(wiki-link-follow-vsplit)
|
||||
|
||||
autocmd BufEnter *.md if expand('%:t') =~ '_' | echo 'hierarchical relation' | endif
|
||||
autocmd BufEnter *.md if expand('%:t') =~ '--' | echo 'non-hierarchical relation' | endif
|
||||
autocmd BufEnter *.md if expand('%:t') =~ '--' | echo 'relation' | endif
|
||||
autocmd BufEnter *.md if expand('%:t') =~ '<>' | echo 'dichotomy' | endif
|
||||
autocmd BufEnter *.md if expand('%:t') =~ 'my-' | echo 'personal file' | endif
|
||||
autocmd BufEnter *.md if expand('%:t') =~ 'project-' | echo 'project file' | endif
|
||||
autocmd BufEnter *.md if expand('%:t') =~ 'project_' | echo 'project file' | endif
|
||||
|
||||
" Only load wiki.vim for zk directory
|
||||
let g:wiki_global_load=0
|
||||
let g:wiki_root='~/.zk'
|
||||
let g:wiki_index_name='index'
|
||||
let g:wiki_zotero_root='~/doc/Zotero'
|
||||
let g:wiki_filetypes=['md']
|
||||
let g:wiki_completion_case_sensitive=0
|
||||
|
||||
" Links
|
||||
let g:wiki_link_extension=''
|
||||
" Do not automatically transform to link, use `<leader>wf` for this
|
||||
let g:wiki_link_toggle_on_follow=0
|
||||
let g:wiki_link_target_type='md'
|
||||
|
||||
" E.g. transform `My link` into `[My link](my-link.md)`
|
||||
function Slugify(text) abort
|
||||
return [substitute(tolower(a:text), '\s\+', '-', 'g'), a:text]
|
||||
endfunction
|
||||
|
||||
let g:wiki_map_text_to_link='Slugify'
|
||||
|
||||
vmap <leader>wf <plug>(wiki-link-toggle-visual)
|
||||
|
||||
" Automatically save when navigation
|
||||
"
|
||||
" Links
|
||||
"
|
||||
|
||||
"
|
||||
" Options
|
||||
"
|
||||
|
||||
"
|
||||
" Events
|
||||
"
|
||||
|
||||
"
|
||||
" Mappings and commands
|
||||
"
|
||||
|
||||
"
|
||||
" Completion
|
||||
"
|
||||
|
||||
let g:wiki_completion_enabled=1
|
||||
let g:wiki_completion_case_sensitive=0
|
||||
|
||||
"
|
||||
" Tags
|
||||
"
|
||||
|
||||
"
|
||||
" Templates
|
||||
"
|
||||
|
||||
let g:wiki_templates = [
|
||||
\ { 'match_re': '^my-',
|
||||
\ 'source_filename': '.my.md'},
|
||||
\ { 'match_re': '^project[-_]',
|
||||
\ 'source_filename': '.project.md'},
|
||||
\ { 'match_re': '^blog[-_]',
|
||||
\ 'source_filename': '.blog.md'},
|
||||
\ { 'match_re': '^journal[-_]',
|
||||
\ 'source_filename': '.journal.md'},
|
||||
\ { 'match_func': { x -> v:true },
|
||||
\ 'source_filename': '.md'},
|
||||
\]
|
||||
|
||||
"
|
||||
" Advanced configuration
|
||||
"
|
||||
|
||||
let g:wiki_filetypes=['md']
|
||||
let g:wiki_root='~/.zk'
|
||||
let g:wiki_global_load=0
|
||||
let g:wiki_link_creation = {
|
||||
\ 'md': {
|
||||
\ 'link_type': 'md',
|
||||
\ 'url_extension': '',
|
||||
\ 'url_transform': { x -> substitute(tolower(x), '\s\+', '-', 'g') },
|
||||
\ },
|
||||
\ '_': {
|
||||
\ 'link_type': 'wiki',
|
||||
\ 'url_extension': '',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" let g:wiki_link_default_schemes
|
||||
" let g:wiki_link_schemes
|
||||
let g:wiki_link_toggle_on_follow=0
|
||||
" let g:wiki_link_transforms
|
||||
" let g:wiki_mappings_use_defaults
|
||||
" let g:wiki_mappings_global
|
||||
" let g:wiki_mappings_local
|
||||
" let g:wiki_mappings_local_journal
|
||||
" ... tags
|
||||
" let g:wiki_template_month_names
|
||||
" let g:wiki_template_title_month =
|
||||
" let g:wiki_template_title_week
|
||||
" let g:wiki_ui_method
|
||||
let g:wiki_write_on_nav=1
|
||||
let g:wiki_zotero_root='~/.local/share/zotero'
|
||||
" ... mappings and commands
|
||||
" ...
|
||||
|
|
|
@ -5,6 +5,9 @@ hi! link pandocCiteKey Comment
|
|||
hi! link pandocCiteAnchor Comment
|
||||
hi! link pandocCiteLocator Comment
|
||||
|
||||
" Don't show the CiteKey within the CiteLocator
|
||||
syn match pandocCiteKey /\v\[[^]]+\]/ contained
|
||||
|
||||
" Match cloze delimiters e.g. `{{c1::` and `}}`
|
||||
syn match ClozeDelimiter /{{c\d\+::/ conceal containedin=pandocUListItem,pandocListItem
|
||||
syn match ClozeDelimiter /}}/ conceal containedin=pandocUListItem,pandocListItem
|
||||
|
|
|
@ -10,9 +10,16 @@ func! GetContext()
|
|||
echo 'math_inline'
|
||||
elseif index(matches, 'pandocLaTeXMathBlock') >= 0
|
||||
echo 'math_block'
|
||||
elseif !empty(matches)
|
||||
echo matches[0]
|
||||
else
|
||||
echo ''
|
||||
endif
|
||||
endfunc
|
||||
com! -nargs=0 GetContext :call GetContext()
|
||||
|
||||
function! Put(str)
|
||||
put = a:str
|
||||
endfunction
|
||||
|
||||
com! -nargs=0 AnkiDeck call fzf#run(fzf#wrap({'source': 'get-anki-decks', 'sink': function('Put')}))
|
||||
|
|
|
@ -6,11 +6,11 @@ let maplocalleader = ";"
|
|||
nm s <c-w> " Split horizontal
|
||||
nm ss :sp<CR><c-w>w| " Split horizontal
|
||||
nm sv :vs<CR><c-w>w| " Split vertical
|
||||
nn sw <c-w>w| " Navigate splits
|
||||
nn sh <c-w>h| "
|
||||
nn sj <c-w>j| "
|
||||
nn sk <c-w>k| "
|
||||
nn sl <c-w>l| "
|
||||
nm sw <c-w>w| " Navigate splits
|
||||
nm sh <c-w>h| "
|
||||
nm sj <c-w>j| "
|
||||
nm sk <c-w>k| "
|
||||
nm sl <c-w>l| "
|
||||
nn sH <c-w>8<| " Resize splits
|
||||
nn sJ <c-w>8-| "
|
||||
nn sK <c-w>8+| "
|
||||
|
|
|
@ -5,10 +5,8 @@
|
|||
call plug#begin()
|
||||
Plug 'unblevable/quick-scope'
|
||||
Plug 'tpope/vim-commentary'
|
||||
Plug 'tpope/vim-obsession'
|
||||
Plug 'machakann/vim-sandwich'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'github/copilot.vim'
|
||||
Plug 'Shougo/context_filetype.vim'
|
||||
Plug 'editorconfig/editorconfig-vim'
|
||||
Plug 'honza/vim-snippets'
|
||||
|
|
Loading…
Reference in New Issue