view .vimrc @ 8:4216c0dc638c

Added base php cs fixer added config helper to maintain config
author luka
date Wed, 18 Oct 2023 21:04:32 -0400
parents cf9993c5c7df
children 4bb4daa9e3f1
line wrap: on
line source

syntax on
set tabstop=2
set shiftwidth=2
set softtabstop=2
set autoindent
set smartindent
"set termguicolors
"set number
nnoremap <Leader>cc :set colorcolumn=80<cr>
nnoremap <Leader>ncc :set colorcolumn-=80<cr>
set mouse=a

function! FixPhpFiles()
 " Save the current cursor position
  let save_cursor = getpos(".")

	"Format the files
    let command = 'php-cs-fixer fix  .'
    let output = system(command)
  " Reload the file and restore the cursor position
  execute 'edit!'
  call setpos(".", save_cursor)
endfunction

nnoremap <leader>f :call FixPhpFiles()<CR>

" Committing commands
map <C-k> :wa<CR>:!hg addremove && hg commit <CR>

" Git commands, for now don't port to hg
" function! GitDiffCached()
"   let files = system('git diff --cached --name-only')
" 
"   if v:shell_error
"     echo "Error running git diff"
"     return
"   endif
" 
"   let filelist = split(files, "\n")
"   let chosen_file = inputlist(filelist)
" 
"   if chosen_file != -1
" 		let cmd = 'tabnew ' . filelist[chosen_file]
"     execute cmd
"   endif
" endfunction
" 
" execute "set <M-d>=\033d"
" map <M-d> :call GitDiffCached()<CR>