Tip 1297 Printable Monobook Previous Next

created August 5, 2006 · complexity basic · author pulp · version n/a

function! s:Shell(...)
  let curline=line ('.')
  if curline < 6
    let start=0
    let start=curline-5
  let end=curline+15
  execute 'silent !clear'
  execute 'silent !echo -e "\n...\n"'
  execute 'silent !sed ' . start . ',' . end . '\!d %'
  execute 'silent !echo -e "\n...\n"'
  execute 'shell'
command! Shell call s:Shell()

Executing ":Shell" will start a new shell and display the last viewed text lines in the top of the new shell.

Useful if you read a 'README' file and you want to follow the install instruction ("./configurer, make etc).

With the displayed text you do not need to remember the commands.

Comments[edit | edit source]

This may be an alternative:

:nnoremap gsh :set t_te= t_ti=<CR>:sh<CR>:set t_te& t_ti&<CR>

Community content is available under CC-BY-SA unless otherwise noted.