Skip to content

Commit

Permalink
master: [feature] format
Browse files Browse the repository at this point in the history
  • Loading branch information
zhenyangze committed Dec 22, 2022
1 parent d51f242 commit 352d25a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
10 changes: 10 additions & 0 deletions layers/common/tool-functions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,16 @@ function! JumpToWindow(winNo)
endif
endfunction

function! AutoFormatFile()
let l:filetype = &filetype
if l:filetype == "php"
silent! exec "Format"
else
silent! exec "Autoformat"
endif
echomsg "Formated"
endfunction

"}}}

"{{{============================= language ================================
Expand Down
25 changes: 25 additions & 0 deletions layers/common/tool-quickfix.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if version >= 900
Plug 'bfrg/vim-qf-history'

augroup qf-history
autocmd!
autocmd QuickFixCmdPost chistory echo printf('Quickfix %d of %d (%d items): %s',
\ getqflist({nr: 0}).nr,
\ getqflist({nr: '$'}).nr,
\ getqflist({size: 0}).size,
\ getqflist({title: 0}).title
\ )
autocmd QuickFixCmdPost lhistory echo printf('Location-list %d of %d (%d items): %s',
\ getloclist(0, {nr: 0}).nr,
\ getloclist(0, {nr: '$'}).nr,
\ getloclist(0, {size: 0}).size,
\ getloclist(0, {title: 0}).title
\ )
augroup END

augroup qf-history
autocmd!
autocmd QuickFixCmdPost chistory cwindow
autocmd QuickFixCmdPost lhistory lwindow
augroup END
endif
2 changes: 2 additions & 0 deletions layers/user/keymap.vim
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,8 @@ let g:which_key_map.q = {
\'q': ['cclose', 'Quit'],
\'l': ['cl', 'List'],
\'o': ['copen', 'Open'],
\'h': [':Chistory', 'History'],
\'H': [':Chistory', 'Location History'],
\}

let g:which_key_map.c = { 'name': 'Comment'}
Expand Down
1 change: 1 addition & 0 deletions layers/user/quickmap.vim
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ nmap ,f :RgFiles<CR>
nmap ,g :Rg<CR>
nmap ,h :Startify<CR>
"nmap ,k :FzfGtags<CR>
nmap ,l :call AutoFormatFile()<CR>
nmap ,m :FZFBookmarks<CR>
nmap ,n :tabnew<CR>
nmap ,o :call ToggleWindowShow('tagbar', 'call ShowTagbarToggle()', 'call ShowTagbarToggle()')<CR>
Expand Down

0 comments on commit 352d25a

Please sign in to comment.