Update: pretty comments in vim
This commit is contained in:
parent
9a2bd97715
commit
2b483acf56
|
@ -123,6 +123,9 @@ nnoremap <leader><leader>= :vertical resize 84<CR>
|
|||
" Show full file path
|
||||
nnoremap <C-g> 1<C-g>
|
||||
|
||||
" Change cwd to current buffer's
|
||||
nnoremap gf :cd %:p:h<CR>
|
||||
|
||||
" Editing remaps ========================================
|
||||
" Uppercase previous word from Insert mode
|
||||
inoremap <C-y> <ESC>vbU`>a
|
||||
|
@ -156,11 +159,11 @@ nnoremap <silent> <leader>ourl :silent call OpenURL()<CR>
|
|||
command! Url :silent call OpenURL()
|
||||
|
||||
" Create a pretty block comment. Supports 3 types of comments
|
||||
nnoremap <leader>opretty :call PrettySectionComment()<CR>
|
||||
command! Pretty :call PrettySectionComment('#')
|
||||
command! Prettyc :call PrettySectionComment('/*')
|
||||
command! Prettypy :call PrettySectionComment('#')
|
||||
command! Prettyhtml :call PrettySectionComment("<!--")
|
||||
command! Prettyrs :call PrettySectionComment('//')
|
||||
command! Prettyjs :call PrettySectionComment('//')
|
||||
command! Prettycss :call PrettySectionComment('/*')
|
||||
nnoremap <leader>opretty :echom "use :Pretty{rs,py,css}"<cr>
|
||||
|
||||
" Open with vifm
|
||||
nnoremap <leader>onet :EditVifm getcwd()<CR>
|
||||
|
|
|
@ -21,6 +21,11 @@ function! PrettySectionComment(type)
|
|||
\ "/*─────────────────────────────────────────────────────────────────────────────╗")
|
||||
call append(line("."),
|
||||
\ "╚─────────────────────────────────────────────────────────────────────────────*/")
|
||||
elseif a:type ==# "<!--"
|
||||
call append(line(".") - 1,
|
||||
\ "<!--───────────────────────────────────────────────────────────────────────────╗")
|
||||
call append(line("."),
|
||||
\ "╚────────────────────────────────────────────────────────────────────────────-->")
|
||||
elseif a:type ==# '//'
|
||||
call append(line(".") - 1,
|
||||
\ "//╔────────────────────────────────────────────────────────────────────────────╗")
|
||||
|
@ -41,6 +46,8 @@ function! PrettySectionComment(type)
|
|||
" Paste back in commented text
|
||||
if a:type ==# '/*'
|
||||
exe "normal! 0i│ \<C-r>\"\<esc>"
|
||||
elseif a:type ==# "<!--"
|
||||
exe "normal! 0i│ \<C-r>\"\<esc>"
|
||||
elseif a:type ==# '//'
|
||||
exe "normal! 0i//│ \<C-r>\"\<esc>"
|
||||
else
|
||||
|
|
|
@ -89,7 +89,7 @@ function! SetGlobalPrimaryColor()
|
|||
let l:mode = mode() " Returns vim's current mode
|
||||
|
||||
if l:mode ==# 'n'
|
||||
let g:StatlnPrimaryColor = GuiColors(synIDattr(synIDtrans(hlID('String')), 'fg', 'gui'), '#AFAF00')
|
||||
let g:StatlnPrimaryColor = GuiColors(synIDattr(synIDtrans(hlID('String')), 'fg', 'gui'), '#b8bb26')
|
||||
let g:mode_str = 'NORMAL' " Light green
|
||||
elseif l:mode ==# 'i'
|
||||
let g:StatlnPrimaryColor = GuiColors(synIDattr(synIDtrans(hlID('Function')), 'fg', 'gui'), '#83ADAD')
|
||||
|
|
Loading…
Reference in a new issue