summaryrefslogtreecommitdiff
path: root/files/vim/plugin/Hello.vim
blob: 224200e3924f9a32ae9b7ea587ea15c5e03d6ed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
" https://github.com/arp242/startscreen.vim/blob/master/plugin/startscreen.vim

scriptencoding utf-8
if exists('g:Hello_Loaded') | finish | endif
let g:Hello_Loaded = 1
let s:save_cpo = &cpo
set cpo&vim

fun! Hello#start()
  " Don't run if:
  " - there are commandline arguments;
  " - the buffer isn't empty (e.g. cmd | vi -);
  " - we're not invoked as vim or gvim;
  " - we're starting in insert mode.
  if argc() || line2byte('$') != -1 || v:progname !~? '^[-gmnq]\=vim\=x\=\%[\.exe]$' || &insertmode
    return
  endif

  " Start a new buffer...
  enew

  " ...set it's name...
  keepalt file [Hello]

  " ...and set some options for it.
  setlocal
    \ bufhidden=wipe
    \ buftype=nofile
    \ nobuflisted
    \ nocursorcolumn
    \ nocursorline
    \ nolist
    \ nonumber
    \ noswapfile
    \ norelativenumber

  " Now we can just write to the buffer whatever you want.

  let pole = ['   .', '  (` `)', '  `\./`', ' __|`|__', '/  |_|  \', '|_______|', '\_______/', '   | |', '   | |', '   | |', ' `.| |.`', '  /| |\', ' / | | \', '   | |', ' .`| |`.', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |', '   | |']
  for i in reverse(range(0, len(pole) - 1))
    call append('0', '       '.pole[i])
  endfor
  :1
  redraw!

  "call writefile([output], '/proc/self/fd/0', 'b')

  " No modifications to this buffer.
  setlocal nomodifiable nomodified

  " When we go to insert mode start a new buffer, and start insert.
  nnoremap <buffer><silent> e :enew<CR>
  nnoremap <buffer><silent> i :enew <bar> startinsert<CR>
  nnoremap <buffer><silent> p :enew<CR>p
endfun

augroup Hello
  autocmd!
  autocmd VimEnter * call Hello#start()
augroup end

let &cpo = s:save_cpo
unlet s:save_cpo
"
"
"
"
"
"
"
"
" Sketch
"
"
"
"
"
"
"
"
"
"
"
" https://www.asciiart.eu/buildings-and-places/fences
"                                       .
"                                      (` `)
"                                      `\./`
"                                     __|`|__
"                                    /  |_|  \
"                                    |_______|
"                                    \_______/
"                                       | |
"                                       | |
"                                       | |
"                                     `.| |.`
"                                      /| |\
"                                     / | | \
"                                       | |
"                                     .`| |`.
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"                                       | |
"
"
"
"
"
"
"