Skip to content

Instantly share code, notes, and snippets.

@JuneBuug
Last active December 15, 2020 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JuneBuug/3749861b3f9404258b8bcbcd4aa9622d to your computer and use it in GitHub Desktop.
Save JuneBuug/3749861b3f9404258b8bcbcd4aa9622d to your computer and use it in GitHub Desktop.
vimrc 설정 (vimrc)
let g:startify_lists = [
\ { 'type': 'sessions', 'header': [' Sessions'] },
\ { 'type': 'files', 'header': [' MRU'] },
\ { 'type': 'dir', 'header': [' MRU '. getcwd()] },
\ { 'type': 'bookmarks', 'header': [' Bookmarks'] },
\ { 'type': 'commands', 'header': [' Commands'] },
\ ]
set nocompatible
set notagbsearch
set showcmd
set showmode
set list listchars+=space:• " 빈칸을 • 로 표시
set listchars=tab:>- " 탭을 >- 로
set listchars=tab:├─
set listchars+=trail:⋄ " 뒤 공백을 ⋄ 로
set hlsearch " 모든 검색결과 하이라이트
set ignorecase " 대소문자 무시하고 검색
set incsearch " 타이핑할 때마다 검색 결과 표시
set number " 줄번호 표시
set noswapfile " 스왑파일 사용안함
filetype plugin on
syntax on
call plug#begin('~/.vim/plugged')
Plug 'vimwiki/vimwiki'
Plug 'mhinz/vim-startify'
call plug#end()
let maplocalleader = "\\"
let g:vimwiki_list = [
\{
\'path': '~/Desktop/blog/content/wiki',
\'ext': '.md',
\'diary_rel_path': '.',
\},
\]
let g:vimwiki_conceallevel = 0
command! WikiIndex :VimWikiIndex
nmap <LocalLeader>ww <Plug>VimwikiIndex
nmap <LocalLeader>tt <Plug>VimwikiToggleListItem
function! NewTemplate()
if line("$") > 1
return
endif
let l:template = []
call add(l:template, '---')
call add(l:template, 'title : ')
call add(l:template, 'slug : ')
call add(l:template, 'layout : wiki ')
call add(l:template, 'excerpt : ')
call add(l:template, 'date : ' . strftime('%Y-%m-%d %H:%M:%S +0900'))
call add(l:template, 'updated : ' . strftime('%Y-%m-%d %H:%M:%S +0900'))
call add(l:template, 'tags : ')
call add(l:template, '---')
call add(l:template, '')
call add(l:template, '# ')
call setline(1, l:template)
execute 'normal! G'
execute 'normal! $'
echom 'new wiki page has created'
endfunction
function! LastModified()
if g:md_modify_disabled
return
endif
if &modified
" echo('markdown updated time modified')
let save_cursor = getpos(".")
let n = min([10, line("$")])
keepjumps exe '1,' . n . 's#^\(.\{,10}updated\s*: \).*#\1' .
\ strftime('%Y-%m-%d %H:%M:%S') . '#e'
call histdel('search', -1)
call setpos('.', save_cursor)
endif
endfun
augroup vimwikiauto
autocmd BufWritePre */wiki/*.md call LastModified()
autocmd BufRead,BufNewFile */wiki/*.md call NewTemplate()
augroup END
let g:md_modify_disabled = 0
@JuneBuug
Copy link
Author

https://news.hada.io/topic?id=3397 을 참고하여 추가하였음

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment