Skip to content

Instantly share code, notes, and snippets.

@ntjn

ntjn/.athamerc Secret

Created June 21, 2018 19:52
Show Gist options
  • Save ntjn/565da38558a26b5caca1fefd6a4948bd to your computer and use it in GitHub Desktop.
Save ntjn/565da38558a26b5caca1fefd6a4948bd to your computer and use it in GitHub Desktop.
" WARNING: By default /etc/athamerc will get rewritten on updates. You should
" create a ~/.athamerc that sources this file and make changes there.
"
" /etc/athamerc is only read if no ~/.athamerc is found
"
" If you don't want /etc/athamerc overidden, supply the --norc flag to the setup
" script.
set nocompatible
set ttimeoutlen=10 "Otherwise, you have to wait for the escape key.
set backspace-=eol "For more traditional shell behavior
set backspace+=start "Without this, you can't delete shell completions
set textwidth=0 "Don't try to wrap text
"Start each line in insert mode. Most shell vi-modes do this:
autocmd User Vimbed_StartLine call feedkeys("\<C-\>\<C-N>i","n")
" These make arrows more shell like. Feel free to comment them out:
if v:version>=800 || has("patch928")
" These maps can segfault in earlier vim versions.
inoremap <Up> <Up><ESC>A
inoremap <Down> <Down><ESC>A
endif
" Uncomment these maps to have the up and down arrow
" only match lines that share text before cursor
" (Similar to how arrows work for vim ex expressions)
"
"inoremap <Up> <C-\><C-O>:silent call HistorySearchBackward()<CR>
"inoremap <Down> <C-\><C-O>:silent call HistorySearchForward()<CR>
"nnoremap <Up> :silent call HistorySearchBackward()<CR>
"nnoremap <Down> :silent call HistorySearchForward()<CR>
"Similar to bash's history-search-backward.
function! HistorySearchBackward()
let curcol = col('.')
if curcol > 1
let searchText = getline('.')[0:curcol - 2]
for line in range(line('.') - 1, 1, -1)
if getline(line)[0:curcol - 2] == searchText
call cursor(line, curcol)
break
endif
endfor
elseif line('.') > 1
call cursor(line('.') - 1, 1)
endif
endfunction
"Similar to bash's history-search-forward.
function! HistorySearchForward()
let curcol = col('.')
if curcol > 1
let searchText = getline('.')[0:curcol - 2]
for line in range(line('.') + 1, line('$'))
if getline(line)[0:curcol - 2] == searchText
call cursor(line, curcol)
break
endif
endfor
else
call cursor(line('.') + 1, 1)
endif
endfunction
"Delete suffix
"map ü :s/\v([a-zA-Z.-_]*).*/\1/<CR>
"map ó :s/\v[^ ]*[ ]([-][a-zA-Z-_.]*[ ]*)*[\|]?//<CR>
function Rmprefix()
execute 's/\v[^ ]*[ ]([-][a-zA-Z-_.]*[ ]*)*[\|]?//'
endfunction
function Rmsuffix()
execute 's/\v([a-zA-Z.-_]*).*/\1/'
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment