This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Search for a term within an Anki deck. | |
# | |
# Usage: grepanki.sh someword | |
# run "grepanki" without any input for more detailed help | |
# | |
# You might want to add special aliases to the .bashrc or .bash_profile files | |
# alias gpj='grepanki' # searches defaultly | |
# alias gpr='grepanki -r' # searches the reverse direction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" added '<buffer>' to guard against this mapping from being used in other filetypes | |
inoremap <buffer><silent><Bar> <Bar><Esc>:call <SID>align()<CR>a | |
function! s:align() | |
let p = '^\s*|\s.*\s|\s*$' | |
if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
Tabularize/|/l1 | |
normal! 0 |