mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Compare commits
No commits in common. "5ab08f0f0b341fd495a5c39634251cc54076782d" and "65777555555253421d2ab120582590a69e21062c" have entirely different histories.
5ab08f0f0b
...
6577755555
8 changed files with 27 additions and 137 deletions
|
@ -1,63 +0,0 @@
|
||||||
" Based on <https://github.com/kana/vim-textobj-indent/blob/deb76867c302f933c8f21753806cbf2d8461b548/autoload/textobj/indent.vim>
|
|
||||||
" A motion for moving over enclosing indentation blocks. Primarily intended
|
|
||||||
" for reverse-engineering CrossCode.
|
|
||||||
|
|
||||||
function dotfiles#indent_motion#run(direction)
|
|
||||||
let l:cursor_linenr = line(".")
|
|
||||||
let l:max_linenr = line("$")
|
|
||||||
|
|
||||||
let l:retry = 0
|
|
||||||
while l:retry <# 2
|
|
||||||
let l:retry += 1
|
|
||||||
|
|
||||||
let l:base_linenr = l:cursor_linenr
|
|
||||||
let l:base_indent = 0
|
|
||||||
while 1 <=# l:base_linenr && l:base_linenr <=# l:max_linenr
|
|
||||||
let l:base_indent = dotfiles#indent_motion#indent_level_of(l:base_linenr)
|
|
||||||
if l:base_indent >=# 0
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
let l:base_linenr += a:direction
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
let l:target_linenr = l:base_linenr
|
|
||||||
|
|
||||||
let l:curr_linenr = l:base_linenr + a:direction
|
|
||||||
let l:prev_indent = l:base_indent
|
|
||||||
while 1 <=# l:curr_linenr && l:curr_linenr <=# l:max_linenr
|
|
||||||
let l:indent = dotfiles#indent_motion#indent_level_of(l:curr_linenr)
|
|
||||||
|
|
||||||
if l:indent >=# 0
|
|
||||||
if l:indent <# l:base_indent
|
|
||||||
break
|
|
||||||
else
|
|
||||||
let l:target_linenr = l:curr_linenr
|
|
||||||
endif
|
|
||||||
elseif l:base_indent ==# 0 && l:prev_indent ==# 0
|
|
||||||
break
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:prev_indent = l:indent
|
|
||||||
let l:curr_linenr += a:direction
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
if l:target_linenr ==# l:cursor_linenr
|
|
||||||
let l:cursor_linenr += a:direction
|
|
||||||
if 1 <=# l:cursor_linenr && l:cursor_linenr <=# l:max_linenr
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
break
|
|
||||||
endwhile
|
|
||||||
|
|
||||||
execute "normal! " . l:target_linenr . "G^"
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" <https://github.com/kana/vim-textobj-indent/blob/deb76867c302f933c8f21753806cbf2d8461b548/autoload/textobj/indent.vim#L120-L127>
|
|
||||||
function dotfiles#indent_motion#indent_level_of(linenr)
|
|
||||||
if getline(a:linenr) ==# ""
|
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
return indent(a:linenr)
|
|
||||||
endfunction
|
|
|
@ -1,6 +0,0 @@
|
||||||
function dotfiles#utils#array_remove_element(array, element)
|
|
||||||
let l:index = index(a:array, a:element)
|
|
||||||
if l:index >= 0
|
|
||||||
call remove(a:array, l:index)
|
|
||||||
endif
|
|
||||||
endfunction
|
|
|
@ -1,9 +0,0 @@
|
||||||
for [s:plug_mapping, s:direction, s:user_mapping] in [["prev", -1, "("], ["next", 1, ")"]]
|
|
||||||
let s:plug_mapping = "<Plug>dotfiles_indent_motion_".s:plug_mapping
|
|
||||||
for s:mode in ["n", "v", "o"]
|
|
||||||
execute s:mode."noremap" "<silent>" s:plug_mapping "<Cmd>call dotfiles#indent_motion#run(".s:direction.")<CR>"
|
|
||||||
if !empty(s:user_mapping)
|
|
||||||
execute s:mode."map" s:user_mapping s:plug_mapping
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endfor
|
|
|
@ -106,6 +106,10 @@ set commentstring=//%s
|
||||||
nnoremap <C-n> <C-i>
|
nnoremap <C-n> <C-i>
|
||||||
nnoremap <C-p> <C-o>
|
nnoremap <C-p> <C-o>
|
||||||
|
|
||||||
|
nnoremap <leader>kk <Cmd>set keymap&<CR>
|
||||||
|
nnoremap <leader>kr <Cmd>set keymap=russian-jcuken-custom<CR>
|
||||||
|
nnoremap <leader>ku <Cmd>set keymap=ukrainian-jcuken-custom<CR>
|
||||||
|
|
||||||
nnoremap Q <nop>
|
nnoremap Q <nop>
|
||||||
|
|
||||||
" normal mode
|
" normal mode
|
||||||
|
@ -134,19 +138,6 @@ set commentstring=//%s
|
||||||
" }}}
|
" }}}
|
||||||
|
|
||||||
|
|
||||||
" Keymap switcher {{{
|
|
||||||
|
|
||||||
nnoremap <leader>kk <Cmd>set keymap&<CR>
|
|
||||||
nnoremap <leader>kr <Cmd>set keymap=russian-jcuken-custom<CR>
|
|
||||||
nnoremap <leader>ku <Cmd>set keymap=ukrainian-jcuken-custom<CR>
|
|
||||||
|
|
||||||
nnoremap <C-o> <Cmd>DotfilesSwapKeymaps<CR>
|
|
||||||
let g:dotfiles_prev_keymap = &keymap
|
|
||||||
command! -nargs=0 DotfilesSwapKeymaps let [g:dotfiles_prev_keymap, &keymap] = [&keymap, g:dotfiles_prev_keymap]
|
|
||||||
|
|
||||||
" }}}
|
|
||||||
|
|
||||||
|
|
||||||
" Search {{{
|
" Search {{{
|
||||||
|
|
||||||
" ignore case if the pattern doesn't contain uppercase characters (use '\C'
|
" ignore case if the pattern doesn't contain uppercase characters (use '\C'
|
||||||
|
|
|
@ -36,10 +36,6 @@ nnoremap <silent><expr> <CR> empty(&buftype) ? ":write<bar>wall\<CR>" : "\<CR>"
|
||||||
" Ranger {{{
|
" Ranger {{{
|
||||||
let g:ranger_replace_netrw = 1
|
let g:ranger_replace_netrw = 1
|
||||||
let g:ranger_map_keys = 0
|
let g:ranger_map_keys = 0
|
||||||
" The default path (/tmp/chosenfile) is inaccessible at least on
|
|
||||||
" Android/Termux, so the tempname() function was chosen because it respects
|
|
||||||
" $TMPDIR.
|
|
||||||
let g:ranger_choice_file = tempname()
|
|
||||||
nnoremap <silent> <Leader>o <Cmd>Ranger<CR>
|
nnoremap <silent> <Leader>o <Cmd>Ranger<CR>
|
||||||
" ranger.vim relies on the Bclose.vim plugin, but I use Bbye.vim, so this
|
" ranger.vim relies on the Bclose.vim plugin, but I use Bbye.vim, so this
|
||||||
" command is here just for compatitabilty
|
" command is here just for compatitabilty
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
nnoremap <leader>gw :GBrowse<CR>
|
nnoremap <leader>gw :GBrowse<CR>
|
||||||
nnoremap <leader>gW :.GBrowse<CR>
|
nnoremap <leader>gW :.GBrowse<CR>
|
||||||
nnoremap <leader>gc :Git commit %
|
nnoremap <leader>gc :Git commit %
|
||||||
nnoremap <leader>gC :Git commit --amend
|
|
||||||
nnoremap <leader>gl :Gclog<CR>
|
nnoremap <leader>gl :Gclog<CR>
|
||||||
nnoremap <leader>gp :Git push
|
nnoremap <leader>gp :Git push
|
||||||
" }}}
|
" }}}
|
||||||
|
|
17
zsh/path.zsh
17
zsh/path.zsh
|
@ -70,8 +70,7 @@ export GOPATH=~/go
|
||||||
path_prepend path "$GOPATH/bin"
|
path_prepend path "$GOPATH/bin"
|
||||||
|
|
||||||
# Rust
|
# Rust
|
||||||
rustup_home="${RUSTUP_HOME:-$HOME/.rustup}"
|
if [[ -f ~/.rustup/settings.toml ]]; then
|
||||||
if [[ -f "$rustup_home"/settings.toml ]]; then
|
|
||||||
# Make a low-effort attempt at quickly extracting the selected Rust toolchain
|
# Make a low-effort attempt at quickly extracting the selected Rust toolchain
|
||||||
# from rustup's settings. The TOML file is obviously assumed to be well-formed
|
# from rustup's settings. The TOML file is obviously assumed to be well-formed
|
||||||
# and syntactically correct because virtually always it's manipulated with the
|
# and syntactically correct because virtually always it's manipulated with the
|
||||||
|
@ -79,7 +78,7 @@ if [[ -f "$rustup_home"/settings.toml ]]; then
|
||||||
# because Rust toolchain names don't need escaping in strings.
|
# because Rust toolchain names don't need escaping in strings.
|
||||||
# See also <https://github.com/toml-lang/toml/blob/master/toml.abnf>.
|
# See also <https://github.com/toml-lang/toml/blob/master/toml.abnf>.
|
||||||
rust_toolchain=""
|
rust_toolchain=""
|
||||||
< "$rustup_home"/settings.toml while IFS= read -r line; do
|
< ~/.rustup/settings.toml while IFS= read -r line; do
|
||||||
if [[ "$line" =~ '^default_toolchain = "(.+)"$' ]]; then
|
if [[ "$line" =~ '^default_toolchain = "(.+)"$' ]]; then
|
||||||
rust_toolchain="${match[1]}"
|
rust_toolchain="${match[1]}"
|
||||||
break
|
break
|
||||||
|
@ -89,20 +88,16 @@ if [[ -f "$rustup_home"/settings.toml ]]; then
|
||||||
done; unset line
|
done; unset line
|
||||||
|
|
||||||
if [[ -n "$rust_toolchain" ]]; then
|
if [[ -n "$rust_toolchain" ]]; then
|
||||||
rust_sysroot="$rustup_home"/toolchains/"$rust_toolchain"
|
rust_sysroot=~/.rustup/toolchains/"$rust_toolchain"
|
||||||
# path_append path "$rust_sysroot"/bin
|
# path_append path "$rust_sysroot"/bin
|
||||||
path_prepend fpath "$rust_sysroot"/zsh/site-functions
|
path_prepend fpath "$rust_sysroot"/zsh/site-functions
|
||||||
path_prepend manpath "$rust_sysroot"/share/man
|
path_prepend manpath "$rust_sysroot"/share/man
|
||||||
|
path_prepend ld_library_path "$rust_sysroot"/lib
|
||||||
|
unset rust_sysroot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for rust_sysroot in "$rustup_home"/toolchains/*(/); do
|
unset rust_toolchain
|
||||||
# The filenames of all libraries in toolchain dirs are suffixed with their
|
|
||||||
# build hashes or the compiler identifier, so in practice conflicts are
|
|
||||||
# insanely unlikely.
|
|
||||||
path_prepend ld_library_path "$rust_sysroot"/lib
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
unset rustup_home rust_toolchain rust_sysroot
|
|
||||||
|
|
||||||
path_prepend path ~/.cargo/bin
|
path_prepend path ~/.cargo/bin
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version"
|
||||||
# Oh My Zsh {{{
|
# Oh My Zsh {{{
|
||||||
|
|
||||||
omz_features=(key-bindings termsupport)
|
omz_features=(key-bindings termsupport)
|
||||||
omz_plugins=(git)
|
omz_plugins=(git extract fasd)
|
||||||
|
|
||||||
_plugin ohmyzsh 'ohmyzsh/ohmyzsh' \
|
_plugin ohmyzsh 'ohmyzsh/ohmyzsh' \
|
||||||
load='lib/'${^omz_features}'.zsh' \
|
load='lib/'${^omz_features}'.zsh' \
|
||||||
|
@ -64,35 +64,22 @@ _plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version"
|
||||||
|
|
||||||
# fasd {{{
|
# fasd {{{
|
||||||
|
|
||||||
if command_exists fasd; then
|
#unalias j
|
||||||
# Initialization taken from <https://github.com/ohmyzsh/ohmyzsh/blob/6fbad5bf72fad4ecf30ba4d4ffee62bac582f0ed/plugins/fasd/fasd.plugin.zsh>
|
#j() {
|
||||||
fasd_cache="${ZSH_CACHE_DIR}/fasd-init-cache"
|
# local _fasd_ret
|
||||||
if [[ "${commands[fasd]}" -nt "$fasd_cache" || ! -s "$fasd_cache" ]]; then
|
# _fasd_ret="$(
|
||||||
fasd --init posix-alias zsh-hook zsh-ccomp zsh-ccomp-install zsh-wcomp zsh-wcomp-install >| "$fasd_cache"
|
# # -l: list all paths in the database (without scores)
|
||||||
fi
|
# # -d: list only directories
|
||||||
source "$fasd_cache"
|
# # -R: in the reverse order
|
||||||
unset fasd_cache
|
# fasd -l -d -R |
|
||||||
|
# fzf --height=40% --layout=reverse --tiebreak=index --query="$*"
|
||||||
alias v='f -e "$EDITOR"'
|
# )"
|
||||||
alias o='a -e xdg-open'
|
# if [[ -d "$_fasd_ret" ]]; then
|
||||||
|
# cd -- "$_fasd_ret"
|
||||||
# alias j='zz'
|
# elif [[ -n "$_fasd_ret" ]]; then
|
||||||
j() {
|
# print -- "$_fasd_ret"
|
||||||
local _fasd_ret
|
# fi
|
||||||
_fasd_ret="$(
|
#}
|
||||||
# -l: list all paths in the database (without scores)
|
|
||||||
# -d: list only directories
|
|
||||||
# -R: in the reverse order
|
|
||||||
fasd -l -d -R |
|
|
||||||
fzf --height=40% --layout=reverse --tiebreak=index --query="$*"
|
|
||||||
)"
|
|
||||||
if [[ -d "$_fasd_ret" ]]; then
|
|
||||||
cd -- "$_fasd_ret"
|
|
||||||
elif [[ -n "$_fasd_ret" ]]; then
|
|
||||||
print -- "$_fasd_ret"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue