(Move categories to tip template) |
(Remove html character entities) |
||
Line 15: | Line 15: | ||
function! s:Shell(...) |
function! s:Shell(...) |
||
let curline=line ('.') |
let curline=line ('.') |
||
− | if curline |
+ | if curline < 6 |
let start=0 |
let start=0 |
||
else |
else |
||
Line 39: | Line 39: | ||
This may be an alternative: |
This may be an alternative: |
||
<pre> |
<pre> |
||
− | :nnoremap gsh :set t_te= t_ti= |
+ | :nnoremap gsh :set t_te= t_ti=<CR>:sh<CR>:set t_te& t_ti&<CR> |
</pre> |
</pre> |
||
Latest revision as of 00:12, 30 September 2008
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 else let start=curline-5 endif 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' endfunction 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[]
This may be an alternative:
:nnoremap gsh :set t_te= t_ti=<CR>:sh<CR>:set t_te& t_ti&<CR>