|
2
|
1 syntax on
|
|
|
2 set tabstop=2
|
|
|
3 set shiftwidth=2
|
|
|
4 set softtabstop=2
|
|
|
5 set autoindent
|
|
|
6 set smartindent
|
|
|
7 "set termguicolors
|
|
|
8 "set number
|
|
|
9 nnoremap <Leader>cc :set colorcolumn=80<cr>
|
|
|
10 nnoremap <Leader>ncc :set colorcolumn-=80<cr>
|
|
|
11 set mouse=a
|
|
|
12
|
|
|
13 function! FixPhpFiles()
|
|
|
14 " Save the current cursor position
|
|
|
15 let save_cursor = getpos(".")
|
|
|
16
|
|
|
17 "Format the files
|
|
|
18 let command = 'php-cs-fixer fix .'
|
|
|
19 let output = system(command)
|
|
|
20 " Reload the file and restore the cursor position
|
|
|
21 execute 'edit!'
|
|
|
22 call setpos(".", save_cursor)
|
|
|
23 endfunction
|
|
|
24
|
|
|
25 nnoremap <leader>f :call FixPhpFiles()<CR>
|
|
|
26
|
|
|
27 " Committing commands
|
|
|
28 map <C-k> :wa<CR>:!hg addremove && hg commit <CR>
|
|
|
29
|
|
|
30 " Git commands, for now don't port to hg
|
|
|
31 " function! GitDiffCached()
|
|
|
32 " let files = system('git diff --cached --name-only')
|
|
|
33 "
|
|
|
34 " if v:shell_error
|
|
|
35 " echo "Error running git diff"
|
|
|
36 " return
|
|
|
37 " endif
|
|
|
38 "
|
|
|
39 " let filelist = split(files, "\n")
|
|
|
40 " let chosen_file = inputlist(filelist)
|
|
|
41 "
|
|
|
42 " if chosen_file != -1
|
|
|
43 " let cmd = 'tabnew ' . filelist[chosen_file]
|
|
|
44 " execute cmd
|
|
|
45 " endif
|
|
|
46 " endfunction
|
|
|
47 "
|
|
|
48 " execute "set <M-d>=\033d"
|
|
|
49 " map <M-d> :call GitDiffCached()<CR>
|