Top Banner

Click here to load reader

of 32

Python으로 vim plugin 만들기

Feb 14, 2017

Download

Engineering

Brad J.S. Heo
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Vim Plugin

python Vim Plugin Jason Heohttp:/jason-heo.github.io/2015-10

Vim VimL Plugin , Python Vim Plugin ! Python Vim Plugin

Vim plugin (Markdown Heading )command mapfunctionpython plugin 1) 2) JSON FormatterVim Plugin ManagerVundle

Vim Plugin Markdown Heading

(Markdown Heading .)

Vim Markdown h1 Title 1

Title 1=======vim yypVr= ,: yypVr= .

yy: p: V: r=: = replace

map - command map command ~/.vimrc

\u1 h1 .~/.vimrc ,vim vim :source ~/.vimrc

nnoremap u1 :normal yypVr=

map - command nnoremapnormal mode map

leader key key back slash

carriage return, enter key

FunctionMarkdown Heading VimL ~/.vimrc function! UnderlineHeading(level) if a:level == 1 normal! yypVr= elseif a:level == 2 normal! yypVr- else normal! I### endifendfunction

FunctionVim ":call Under" Tab ""

mapping :call UnderlineHeading(1)nnoremap u1 :call UnderlineHeading(1)

Python Vim plugin Python Vim plugin

10

Vim "+python" "+" ,"-"

"+python" Vim Python2 $ vim --version | grep python+cryptv +linebreak +python +viminfo+cscope +lispindent -python3 +vreplace

"Hello world"Vim

"Hello world" 10 . Vim Python code :python "Hello world" * 10

Text bc , vim

Text function! Calc()python ') lines = vim.eval('getline({}, {})'.format(starting_line_num, ending_line_num)) lines[0] = lines[0][col1:] lines[-1] = lines[-1][:col2 + 1] return lines, starting_line_num, ending_line_num, col1, col2

JSON Formatterfunction! FormatJson()python