1
0
mirror of https://github.com/gryf/.vim.git synced 2025-12-17 11:30:29 +01:00

Scripts update

Removed GetLatestVimScripts plugin (it's distributed with vim)
Added nice function for generating HTML from rst in rst/common.vim
Removd NERDtree (didn't used it at all)
Removed tasklist (same as above)
Removed eclim tools, leaved only buffer functionality
Small improvements in vimrc
This commit is contained in:
2010-08-29 19:58:17 +02:00
parent 51fd5661ec
commit 67fd7abec6
37 changed files with 1725 additions and 8138 deletions

View File

@@ -159,6 +159,42 @@ if !exists("*s:WideMsg")
endfun
endif
if !exists("*s:GetQuickFixStackCount")
function s:GetQuickFixStackCount()
let l:stack_count = 0
try
silent colder 9
catch /E380:/
endtry
try
for i in range(9)
silent cnewer
let l:stack_count = l:stack_count + 1
endfor
catch /E381:/
return l:stack_count
endtry
endfunction
endif
if !exists("*s:ActivatePyflakesQuickFixWindow")
function s:ActivatePyflakesQuickFixWindow()
try
silent colder 9 " go to the bottom of quickfix stack
catch /E380:/
endtry
if s:pyflakes_qf > 0
try
exe "silent cnewer " . s:pyflakes_qf
catch /E381:/
echoerr "Could not activate Pyflakes Quickfix Window."
endtry
endif
endfunction
endif
if !exists("*s:RunPyflakes")
function s:RunPyflakes()
highlight link PyFlakes SpellBad
@@ -174,12 +210,23 @@ if !exists("*s:RunPyflakes")
let b:matched = []
let b:matchedlines = {}
let b:qf_list = []
let b:qf_window_count = -1
python << EOF
for w in check(vim.current.buffer):
vim.command('let s:matchDict = {}')
vim.command("let s:matchDict['lineNum'] = " + str(w.lineno))
vim.command("let s:matchDict['message'] = '%s'" % vim_quote(w.message % w.message_args))
vim.command("let b:matchedlines[" + str(w.lineno) + "] = s:matchDict")
vim.command("let l:qf_item = {}")
vim.command("let l:qf_item.bufnr = bufnr('%')")
vim.command("let l:qf_item.filename = expand('%')")
vim.command("let l:qf_item.lnum = %s" % str(w.lineno))
vim.command("let l:qf_item.text = '%s'" % vim_quote(w.message % w.message_args))
vim.command("let l:qf_item.type = 'E'")
if w.col is None or isinstance(w, SyntaxError):
# without column information, just highlight the whole line
@@ -189,8 +236,21 @@ for w in check(vim.current.buffer):
# with a column number, highlight the first keyword there
vim.command(r"let s:mID = matchadd('PyFlakes', '^\%" + str(w.lineno) + r"l\_.\{-}\zs\k\+\k\@!\%>" + str(w.col) + r"c')")
vim.command("let l:qf_item.vcol = 1")
vim.command("let l:qf_item.col = %s" % str(w.col + 1))
vim.command("call add(b:matched, s:matchDict)")
vim.command("call add(b:qf_list, l:qf_item)")
EOF
if exists("s:pyflakes_qf")
" if pyflakes quickfix window is already created, reuse it
call s:ActivatePyflakesQuickFixWindow()
call setqflist(b:qf_list, 'r')
else
" one pyflakes quickfix window for all buffer
call setqflist(b:qf_list, '')
let s:pyflakes_qf = s:GetQuickFixStackCount()
endif
let b:cleared = 0
endfunction
end

View File

@@ -1,16 +1,16 @@
" Some common settings for all reSt files
set textwidth=80
set makeprg=rst2html.py\ %\ %.html
set spell
set smartindent
set autoindent
set formatoptions+=w
setlocal textwidth=80
setlocal makeprg=rst2html.py\ %\ %.html
setlocal spell
setlocal smartindent
setlocal autoindent
setlocal formatoptions=tcq "set VIms default
map <F5> :call Rst2Blogger()<cr>
map <F5> :call <SID>Rst2Blogger()<cr>
" Simple function, that translates reSt text into html with specified format,
" suitable to copy and paste into blogger post.
fun! Rst2Blogger()
fun <SID>Rst2Blogger()
python << EOF
from docutils import core
from docutils.writers.html4css1 import Writer, HTMLTranslator
@@ -45,7 +45,7 @@ _w = Writer()
_w.translator_class = NoHeaderHTMLTranslator
def blogify(string):
return core.publish_string(string,writer=_w)
return core.publish_string(string, writer=_w)
bufcontent = "\n".join(vim.current.buffer)
name = vim.current.buffer.name
@@ -54,16 +54,18 @@ if name.lower().endswith(".rst"):
vim.command('new')
vim.current.buffer[:] = blogify(bufcontent).split("\n")
vim.command('saveas %s' % name)
vim.command(r'silent %s/<tt class="docutils literal">/<code>/g')
vim.command(r'silent %s/<\/tt>/<\/code>/g')
vim.command('w %s' % name)
vim.command('bd')
else:
print "This is not reSt file. File should have '.rst' extension."
print "Ihis is not reSt file. File should have '.rst' extension."
EOF
endfun
" This is similar to that above, but creates full html document
fun! Restify()
fun <SID>Restify()
python << EOF
from docutils import core
from docutils.writers.html4css1 import Writer, HTMLTranslator
@@ -82,10 +84,12 @@ if name.lower().endswith(".rst"):
vim.command('new')
vim.current.buffer[:] = reSTify(bufcontent).split("\n")
vim.command('saveas %s' % name)
vim.command(r'silent %s/<tt class="docutils literal">/<code>/g')
vim.command(r'silent %s/<\/tt>/<\/code>/g')
vim.command('w %s' % name)
vim.command('bd')
else:
print 'To nie jest plik reSt!'
print "It's not reSt file!"
EOF
endfun

View File

@@ -21,6 +21,11 @@ let b:undo_ftplugin = "setlocal ".
setlocal autowriteall
setlocal commentstring=<!--%s-->
if g:vimwiki_conceallevel && exists("+conceallevel")
let &conceallevel = g:vimwiki_conceallevel
endif
" MISC }}}
" GOTO FILE: gf {{{
@@ -38,32 +43,22 @@ else
endif
setlocal formatoptions=tnro
inoremap <buffer> <expr> <CR> vimwiki_lst#insertCR()
nnoremap <buffer> o :call vimwiki_lst#insertOo('o')<CR>a
nnoremap <buffer> O :call vimwiki_lst#insertOo('O')<CR>a
if !empty(&langmap)
" Valid only if langmap is a comma separated pairs of chars
let l_o = matchstr(&langmap, '\C,\zs.\zeo,')
if l_o
exe 'nnoremap <buffer> '.l_o.' :call vimwiki_lst#insertOo("o")<CR>a'
exe 'nnoremap <buffer> '.l_o.' :call vimwiki_lst#kbd_oO("o")<CR>a'
endif
let l_O = matchstr(&langmap, '\C,\zs.\zeO,')
if l_O
exe 'nnoremap <buffer> '.l_O.' :call vimwiki_lst#insertOo("O")<CR>a'
exe 'nnoremap <buffer> '.l_O.' :call vimwiki_lst#kbd_oO("O")<CR>a'
endif
endif
" COMMENTS }}}
" FOLDING for headers and list items using expr fold method. {{{
if g:vimwiki_folding == 1
setlocal fdm=expr
setlocal foldexpr=VimwikiFoldLevel(v:lnum)
setlocal foldtext=VimwikiFoldText()
endif
function! VimwikiFoldLevel(lnum) "{{{
let line = getline(a:lnum)
@@ -208,14 +203,14 @@ command! -buffer Vimwiki2HTML
command! -buffer VimwikiAll2HTML
\ call vimwiki_html#WikiAll2HTML(expand(VimwikiGet('path_html')))
command! -buffer VimwikiNextWord call vimwiki#WikiNextWord()
command! -buffer VimwikiPrevWord call vimwiki#WikiPrevWord()
command! -buffer VimwikiDeleteWord call vimwiki#WikiDeleteWord()
command! -buffer VimwikiRenameWord call vimwiki#WikiRenameWord()
command! -buffer VimwikiFollowWord call vimwiki#WikiFollowWord('nosplit')
command! -buffer VimwikiGoBackWord call vimwiki#WikiGoBackWord()
command! -buffer VimwikiSplitWord call vimwiki#WikiFollowWord('split')
command! -buffer VimwikiVSplitWord call vimwiki#WikiFollowWord('vsplit')
command! -buffer VimwikiNextLink call vimwiki#find_next_link()
command! -buffer VimwikiPrevLink call vimwiki#find_prev_link()
command! -buffer VimwikiDeleteLink call vimwiki#delete_link()
command! -buffer VimwikiRenameLink call vimwiki#rename_link()
command! -buffer VimwikiFollowLink call vimwiki#follow_link('nosplit')
command! -buffer VimwikiGoBackLink call vimwiki#go_back_link()
command! -buffer VimwikiSplitLink call vimwiki#follow_link('split')
command! -buffer VimwikiVSplitLink call vimwiki#follow_link('vsplit')
command! -buffer -range VimwikiToggleListItem call vimwiki_lst#ToggleListItem(<line1>, <line2>)
@@ -227,6 +222,8 @@ exe 'command! -buffer -nargs=* VimwikiSearch vimgrep <args> '.
exe 'command! -buffer -nargs=* VWS vimgrep <args> '.
\ escape(VimwikiGet('path').'**/*'.VimwikiGet('ext'), ' ')
command! -buffer -nargs=1 VimwikiGoto call vimwiki#goto("<args>")
" table commands
command! -buffer -nargs=* VimwikiTable call vimwiki_tbl#create(<f-args>)
command! -buffer VimwikiTableAlignQ call vimwiki_tbl#align_or_cmd('gqq')
@@ -234,65 +231,69 @@ command! -buffer VimwikiTableAlignW call vimwiki_tbl#align_or_cmd('gww')
command! -buffer VimwikiTableMoveColumnLeft call vimwiki_tbl#move_column_left()
command! -buffer VimwikiTableMoveColumnRight call vimwiki_tbl#move_column_right()
" diary commands
command! -buffer VimwikiDiaryNextDay call vimwiki_diary#goto_next_day()
command! -buffer VimwikiDiaryPrevDay call vimwiki_diary#goto_prev_day()
" COMMANDS }}}
" KEYBINDINGS {{{
if g:vimwiki_use_mouse
nmap <buffer> <S-LeftMouse> <NOP>
nmap <buffer> <C-LeftMouse> <NOP>
noremap <silent><buffer> <2-LeftMouse> :VimwikiFollowWord<CR>
noremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitWord<CR>
noremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitWord<CR>
noremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackWord<CR>
noremap <silent><buffer> <2-LeftMouse> :VimwikiFollowLink<CR>
noremap <silent><buffer> <S-2-LeftMouse> <LeftMouse>:VimwikiSplitLink<CR>
noremap <silent><buffer> <C-2-LeftMouse> <LeftMouse>:VimwikiVSplitLink<CR>
noremap <silent><buffer> <RightMouse><LeftMouse> :VimwikiGoBackLink<CR>
endif
if !hasmapto('<Plug>VimwikiFollowWord')
nmap <silent><buffer> <CR> <Plug>VimwikiFollowWord
if !hasmapto('<Plug>VimwikiFollowLink')
nmap <silent><buffer> <CR> <Plug>VimwikiFollowLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiFollowWord :VimwikiFollowWord<CR>
\ <Plug>VimwikiFollowLink :VimwikiFollowLink<CR>
if !hasmapto('<Plug>VimwikiSplitWord')
nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitWord
if !hasmapto('<Plug>VimwikiSplitLink')
nmap <silent><buffer> <S-CR> <Plug>VimwikiSplitLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiSplitWord :VimwikiSplitWord<CR>
\ <Plug>VimwikiSplitLink :VimwikiSplitLink<CR>
if !hasmapto('<Plug>VimwikiVSplitWord')
nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitWord
if !hasmapto('<Plug>VimwikiVSplitLink')
nmap <silent><buffer> <C-CR> <Plug>VimwikiVSplitLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiVSplitWord :VimwikiVSplitWord<CR>
\ <Plug>VimwikiVSplitLink :VimwikiVSplitLink<CR>
if !hasmapto('<Plug>VimwikiGoBackWord')
nmap <silent><buffer> <BS> <Plug>VimwikiGoBackWord
if !hasmapto('<Plug>VimwikiGoBackLink')
nmap <silent><buffer> <BS> <Plug>VimwikiGoBackLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiGoBackWord :VimwikiGoBackWord<CR>
\ <Plug>VimwikiGoBackLink :VimwikiGoBackLink<CR>
if !hasmapto('<Plug>VimwikiNextWord')
nmap <silent><buffer> <TAB> <Plug>VimwikiNextWord
if !hasmapto('<Plug>VimwikiNextLink')
nmap <silent><buffer> <TAB> <Plug>VimwikiNextLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiNextWord :VimwikiNextWord<CR>
\ <Plug>VimwikiNextLink :VimwikiNextLink<CR>
if !hasmapto('<Plug>VimwikiPrevWord')
nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevWord
if !hasmapto('<Plug>VimwikiPrevLink')
nmap <silent><buffer> <S-TAB> <Plug>VimwikiPrevLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiPrevWord :VimwikiPrevWord<CR>
\ <Plug>VimwikiPrevLink :VimwikiPrevLink<CR>
if !hasmapto('<Plug>VimwikiDeleteWord')
nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteWord
if !hasmapto('<Plug>VimwikiDeleteLink')
nmap <silent><buffer> <Leader>wd <Plug>VimwikiDeleteLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiDeleteWord :VimwikiDeleteWord<CR>
\ <Plug>VimwikiDeleteLink :VimwikiDeleteLink<CR>
if !hasmapto('<Plug>VimwikiRenameWord')
nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameWord
if !hasmapto('<Plug>VimwikiRenameLink')
nmap <silent><buffer> <Leader>wr <Plug>VimwikiRenameLink
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiRenameWord :VimwikiRenameWord<CR>
\ <Plug>VimwikiRenameLink :VimwikiRenameLink<CR>
if !hasmapto('<Plug>VimwikiToggleListItem')
nmap <silent><buffer> <C-Space> <Plug>VimwikiToggleListItem
@@ -304,10 +305,35 @@ endif
noremap <silent><script><buffer>
\ <Plug>VimwikiToggleListItem :VimwikiToggleListItem<CR>
if !hasmapto('<Plug>VimwikiDiaryNextDay')
nmap <silent><buffer> <C-Down> <Plug>VimwikiDiaryNextDay
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiDiaryNextDay :VimwikiDiaryNextDay<CR>
if !hasmapto('<Plug>VimwikiDiaryPrevDay')
nmap <silent><buffer> <C-Up> <Plug>VimwikiDiaryPrevDay
endif
noremap <silent><script><buffer>
\ <Plug>VimwikiDiaryPrevDay :VimwikiDiaryPrevDay<CR>
function! s:CR() "{{{
let res = vimwiki_lst#kbd_cr()
if res == "\<CR>" && g:vimwiki_table_auto_fmt
let res = vimwiki_tbl#kbd_cr()
endif
return res
endfunction "}}}
" List and Table <CR> mapping
inoremap <buffer> <expr> <CR> <SID>CR()
" List mappings
nnoremap <buffer> o :call vimwiki_lst#kbd_oO('o')<CR>a
nnoremap <buffer> O :call vimwiki_lst#kbd_oO('O')<CR>a
" Table mappings
if g:vimwiki_table_auto_fmt
inoremap <expr> <buffer> <CR> vimwiki_tbl#kbd_cr()
inoremap <expr> <buffer> <Tab> vimwiki_tbl#kbd_tab()
inoremap <expr> <buffer> <S-Tab> vimwiki_tbl#kbd_shift_tab()
endif