From d37e97bdc3fed57efd7829a7fe29ad50d8aa86b5 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Wed, 11 Jul 2018 15:59:04 +0200 Subject: [PATCH 1/3] Add line caps to draw function --- lua/vim.moon | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/vim.moon b/lua/vim.moon index f34478c..347b562 100644 --- a/lua/vim.moon +++ b/lua/vim.moon @@ -56,9 +56,10 @@ draw = -> for line in * { { "─", "│", "┼" } { "┌", "┐", "└", "┘" } - {"├", "┤", "┬", "┴"} + { "├", "┤", "┬", "┴" } + { "╼" ,"╽" ,"╾" ,"╾" } } - print table.concat(line, " ") + print table.concat(line, " ") { From 0b38f7295c9a35f9e667e7d7ca82866fd4c19561 Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Fri, 13 Jul 2018 10:19:13 +0200 Subject: [PATCH 2/3] Change how trees look and add the CLASS constant --- lua/vim.moon | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lua/vim.moon b/lua/vim.moon index 347b562..5f5a19e 100644 --- a/lua/vim.moon +++ b/lua/vim.moon @@ -1,29 +1,17 @@ -- vim: set noexpandtab :miv -- -tree = (tab, level=0, skip="") -> - if level==0 - print "┐" - - pre = (lvl, skip) -> - for i=1,lvl - if skip\sub(i,i) == "y" - io.write " " - else - io.write "│ " +tree = (tab, pref='') -> + print tab.title and tab.title or '┐' for idx, element in ipairs tab last = idx == #tab + first = idx == 1 + io.write pref + io.write last and "└─" or "├─" switch type element when "table" - pre level, skip - io.write last and "└─" or "├─" - print element.title and "┬─ "..element.title or "┐" - tree element, level+1, skip .. (last and "y" or "n") + tree element, last and ' ' or '│ ' else - pre level, skip - if idx<#tab - print "├─ "..element - else - print "└─ "..element + print tostring element import max from math column = (col) -> @@ -52,18 +40,30 @@ column = (col) -> box = (box) -> column { box } +CLASS = [[ +print vim.col { + { 'Class' } -- Title + { + -- Members + } + { + -- Methods + } +} +]] + draw = -> for line in * { { "─", "│", "┼" } { "┌", "┐", "└", "┘" } { "├", "┤", "┬", "┴" } - { "╼" ,"╽" ,"╾" ,"╾" } + { "╼", "╽", "╾", "╾" } } - print table.concat(line, " ") + print table.concat(line, " ") { - :tree, :column, :box, :draw + :tree, :column, :box, :draw, :CLASS -- Aliases col: column } From b817b4be7bee31aec3c6f90c1dce5c4c8296c1be Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Fri, 13 Jul 2018 11:25:22 +0200 Subject: [PATCH 3/3] Add Blame command This command allows to quickly git-blame the current file. --- vimrc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/vimrc b/vimrc index 9b74fce..7425879 100644 --- a/vimrc +++ b/vimrc @@ -492,6 +492,25 @@ function! s:git_diff(...) end endfun +function! s:git_blame() + let l:name = expand('%') + let l:line = getpos('.')[1] + let l:char = getpos('.')[2]+59 + let l:type = &filetype + enew + set modifiable + let &filetype = l:type + set buftype=nofile + set bufhidden=delete + set nowrap + silent exec "file Blame: ".l:name + keepjumps exec 'r !git blame '.l:name + keepjumps 0,0del " + set nomodifiable + keepjumps call setpos('.', [0, l:line, l:char, 0]) +endfun + +command! Blame call git_blame() command! GitNext call git_next() | call s:git_info() command! GitPrev call git_prev() | call s:git_info() command! GitFirst call git_first() | call s:git_info()