Merge branch 'master' of github.com:DarkWiiPlayer/darkrc
This commit is contained in:
commit
883685a0ab
2 changed files with 84 additions and 11 deletions
|
@ -9,7 +9,7 @@ tree = (tab, pref='') ->
|
||||||
io.write last and "└─" or "├─"
|
io.write last and "└─" or "├─"
|
||||||
switch type element
|
switch type element
|
||||||
when "table"
|
when "table"
|
||||||
tree element, last and ' ' or '│ '
|
tree element, pref .. (last and ' ' or '│ ')
|
||||||
else
|
else
|
||||||
print tostring element
|
print tostring element
|
||||||
|
|
||||||
|
|
93
vimrc
93
vimrc
|
@ -68,8 +68,8 @@ set swapfile
|
||||||
|
|
||||||
" Indentation, etc.
|
" Indentation, etc.
|
||||||
set tabstop=2
|
set tabstop=2
|
||||||
set softtabstop=2
|
set shiftwidth=0 " Not needed
|
||||||
set shiftwidth=2
|
set softtabstop=0 " Not needed
|
||||||
set noexpandtab
|
set noexpandtab
|
||||||
set smarttab
|
set smarttab
|
||||||
set autoindent
|
set autoindent
|
||||||
|
@ -326,6 +326,9 @@ command! -range Count echo(<line2>-<line1>+1)
|
||||||
command! Closeall bufdo bdelete
|
command! Closeall bufdo bdelete
|
||||||
command! Context bufdo bdelete | e .
|
command! Context bufdo bdelete | e .
|
||||||
command! Kontext Context
|
command! Kontext Context
|
||||||
|
command! -range=% Numbers <line1>,<line2>
|
||||||
|
\s/^/\=printf("%0".printf("%f", floor(log10(<line2>)))."i", line("."))."\t"/
|
||||||
|
\ | noh
|
||||||
|
|
||||||
command! L lopen | set number | set norelativenumber
|
command! L lopen | set number | set norelativenumber
|
||||||
command! LAddLine call LocationAddLine(expand("%"), line("."), getline("."))
|
command! LAddLine call LocationAddLine(expand("%"), line("."), getline("."))
|
||||||
|
@ -359,7 +362,24 @@ function! s:hex(...)
|
||||||
endfunction
|
endfunction
|
||||||
command! -nargs=* Hex call <sid>hex(<q-args>)
|
command! -nargs=* Hex call <sid>hex(<q-args>)
|
||||||
|
|
||||||
" === GIT STUFF === "
|
command! -range=% LuaCompile <line1>,<line2>w !luac -l -p -
|
||||||
|
|
||||||
|
" ┌─────────────────┐
|
||||||
|
" └─┬─┬───┬─┬───┬─┬─┘
|
||||||
|
" │ │ │ │ │ │
|
||||||
|
" │ │ │ │ │ │
|
||||||
|
" ┌─┴─┴───┴─┴───┴─┴─┐
|
||||||
|
" ┌┘ Git Stuff └┐
|
||||||
|
" └───────────────────┘
|
||||||
|
|
||||||
|
function! s:gitroot()
|
||||||
|
let s:ret = substitute(system('git rev-parse --show-toplevel'), '\n\_.*', '', '')
|
||||||
|
if v:shell_error
|
||||||
|
throw s:ret
|
||||||
|
else
|
||||||
|
return s:ret
|
||||||
|
end
|
||||||
|
endf
|
||||||
|
|
||||||
function! s:git_history()
|
function! s:git_history()
|
||||||
if exists("b:git_history")
|
if exists("b:git_history")
|
||||||
|
@ -510,14 +530,31 @@ function! s:git_blame()
|
||||||
keepjumps call setpos('.', [0, l:line, l:char, 0])
|
keepjumps call setpos('.', [0, l:line, l:char, 0])
|
||||||
endfun
|
endfun
|
||||||
|
|
||||||
command! Blame call <sid>git_blame()
|
command! Blame try
|
||||||
command! GitNext call <sid>git_next() | call s:git_info()
|
\| call s:gitroot() | call <sid>git_blame()
|
||||||
|
\| catch | echo 'Not a git repo!'
|
||||||
|
\| endtry
|
||||||
|
command! GitNext try
|
||||||
|
\| call s:gitroot() | call <sid>git_next() | call s:git_info()
|
||||||
|
\| catch | echo 'Not a git repo!'
|
||||||
|
\| endtry
|
||||||
command! GitPrev call <sid>git_prev() | call s:git_info()
|
command! GitPrev call <sid>git_prev() | call s:git_info()
|
||||||
command! GitFirst call <sid>git_first() | call s:git_info()
|
command! GitFirst call <sid>git_first() | call s:git_info()
|
||||||
command! GitLast call <sid>git_last() | call s:git_info()
|
command! GitLast call <sid>git_last() | call s:git_info()
|
||||||
command! GitInfo call <sid>git_info()
|
command! GitInfo call <sid>git_info()
|
||||||
command! -nargs=1 GitCheckout call <sid>file_at_revision(<f-args>)
|
command! -nargs=1 GitCheckout call <sid>file_at_revision(<f-args>)
|
||||||
command! -nargs=? GitCompare call <sid>git_diff(<f-args>)
|
command! -nargs=? GitCompare try
|
||||||
|
\| call s:gitroot() | call <sid>git_diff(<f-args>)
|
||||||
|
\| catch | echo 'Not a git repo!'
|
||||||
|
\| endtry
|
||||||
|
command! Uncommited try
|
||||||
|
\| call s:gitroot() | call <sid>git_diff()
|
||||||
|
\| catch | echo 'Not a git repo!'
|
||||||
|
\| endtry
|
||||||
|
command! GitRoot try
|
||||||
|
\| echo <sid>gitroot()
|
||||||
|
\| catch | echo 'Not a git repository'
|
||||||
|
\| endtry
|
||||||
|
|
||||||
" === FILE STUFF ===
|
" === FILE STUFF ===
|
||||||
|
|
||||||
|
@ -736,6 +773,7 @@ digraph ss 223
|
||||||
command! HLProgress syntax match Comment /\_.*\ze\n.*\%#/
|
command! HLProgress syntax match Comment /\_.*\ze\n.*\%#/
|
||||||
|
|
||||||
nnoremap <leader>h :call <SID>toggleWUC()<CR>
|
nnoremap <leader>h :call <SID>toggleWUC()<CR>
|
||||||
|
|
||||||
function! s:updateWUC()
|
function! s:updateWUC()
|
||||||
if exists("b:hlwuc")
|
if exists("b:hlwuc")
|
||||||
if b:hlwuc > 1
|
if b:hlwuc > 1
|
||||||
|
@ -747,10 +785,10 @@ function! s:updateWUC()
|
||||||
else
|
else
|
||||||
let hl = "Underlined"
|
let hl = "Underlined"
|
||||||
endif
|
endif
|
||||||
let str = "\\<".escape(expand("<cword>"), "\\")."\\>"
|
let l:str = "\\<".escape(expand("<cword>"), "\\")."\\>"
|
||||||
let b:hlwuc = matchadd(hl, str)
|
let b:hlwuc = matchadd(hl, l:str)
|
||||||
"echom str
|
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
function! s:toggleWUC()
|
function! s:toggleWUC()
|
||||||
augroup hlwuc
|
augroup hlwuc
|
||||||
if exists("b:hlwuc")
|
if exists("b:hlwuc")
|
||||||
|
@ -760,11 +798,12 @@ function! s:toggleWUC()
|
||||||
end
|
end
|
||||||
unlet b:hlwuc
|
unlet b:hlwuc
|
||||||
else
|
else
|
||||||
call <SID>updateWUC()
|
|
||||||
autocmd CursorMoved <buffer> call <SID>updateWUC()
|
autocmd CursorMoved <buffer> call <SID>updateWUC()
|
||||||
autocmd CursorMovedI <buffer> call <SID>updateWUC()
|
autocmd CursorMovedI <buffer> call <SID>updateWUC()
|
||||||
|
call <SID>updateWUC()
|
||||||
endif
|
endif
|
||||||
augroup END
|
augroup END
|
||||||
|
redraw
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Autosave when vim loses focus :)
|
" Autosave when vim loses focus :)
|
||||||
|
@ -1003,3 +1042,37 @@ function! s:init_html_file()
|
||||||
inoremap <buffer> <C-space> <C-o>""ciw<<C-o>""p><C-o>m'</<C-o>""p><C-o>`'<C-o>l
|
inoremap <buffer> <C-space> <C-o>""ciw<<C-o>""p><C-o>m'</<C-o>""p><C-o>`'<C-o>l
|
||||||
inoremap <buffer> <C-CR> <C-o>""diw<C-o>"_cc<<C-o>""p><C-o>o</<C-o>""p><C-o>O
|
inoremap <buffer> <C-CR> <C-o>""diw<C-o>"_cc<<C-o>""p><C-o>o</<C-o>""p><C-o>O
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" --- Moonscript Stuff ---
|
||||||
|
|
||||||
|
augroup MOON
|
||||||
|
au!
|
||||||
|
au FileType moon nnoremap <buffer> <F8> :ToggleAutoMoonLocal<CR>
|
||||||
|
au BufWritePost *.moon call <SID>automoon()
|
||||||
|
augroup END
|
||||||
|
com! ToggleAutoMoon echo <SID>toggleautomoon()
|
||||||
|
com! ToggleAutoMoonLocal echo <SID>toggleautomoonlocal()
|
||||||
|
function! s:automoon()
|
||||||
|
if exists('g:automoon') || exists('b:automoon')
|
||||||
|
silent !moonc %
|
||||||
|
redraw
|
||||||
|
end
|
||||||
|
endfun
|
||||||
|
function! s:toggleautomoon()
|
||||||
|
if exists('g:automoon')
|
||||||
|
unlet g:automoon
|
||||||
|
return 'Automoon: off'
|
||||||
|
else
|
||||||
|
let g:automoon=1
|
||||||
|
return 'Automoon: on'
|
||||||
|
end
|
||||||
|
endfun
|
||||||
|
function! s:toggleautomoonlocal()
|
||||||
|
if exists('b:automoon')
|
||||||
|
unlet b:automoon
|
||||||
|
return 'Local Automoon: off'
|
||||||
|
else
|
||||||
|
let b:automoon=1
|
||||||
|
return 'Local Automoon: on'
|
||||||
|
end
|
||||||
|
endfun
|
||||||
|
|
Loading…
Reference in a new issue