|
0
|
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 nnoremap <C-l> :ALECodeAction <cr>
|
|
|
12 set mouse=a
|
|
|
13
|
|
|
14 function! FixPhpFiles()
|
|
|
15 " Save the current cursor position
|
|
|
16 let save_cursor = getpos(".")
|
|
|
17
|
|
|
18 "Format the files
|
|
|
19 let command = 'php-cs-fixer fix .'
|
|
|
20 let output = system(command)
|
|
|
21 " Reload the file and restore the cursor position
|
|
|
22 execute 'edit!'
|
|
|
23 call setpos(".", save_cursor)
|
|
|
24 endfunction
|
|
|
25
|
|
|
26 nnoremap <leader>f :call FixPhpFiles()<CR>
|
|
|
27
|
|
|
28 " Committing commands
|
|
|
29 map <C-k> :wa<CR>:!hg addremove && hg commit <CR>
|
|
|
30
|
|
|
31
|
|
|
32
|
|
|
33 function! SendBufferToProgram()
|
|
|
34 " Create a temporary file
|
|
|
35 let temp_file = tempname()
|
|
|
36
|
|
|
37 " Write current buffer to the temporary file
|
|
|
38 exe "write! " . temp_file
|
|
|
39
|
|
|
40 " Send the content of the temporary file to your program
|
|
|
41 " Replace <your_program> with the actual command to run your program
|
|
|
42 let command = "cat " . temp_file . " | <your_program>"
|
|
|
43
|
|
|
44 " Execute the command
|
|
|
45 call system(command)
|
|
|
46
|
|
|
47 " Optionally, delete the temporary file if not needed
|
|
|
48 call delete(temp_file)
|
|
|
49 endfunction
|