|
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>
|
|
12
|
11 nnoremap <C-l> :ALECodeAction <cr>
|
|
2
|
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 " Git commands, for now don't port to hg
|
|
|
32 " function! GitDiffCached()
|
|
|
33 " let files = system('git diff --cached --name-only')
|
|
|
34 "
|
|
|
35 " if v:shell_error
|
|
|
36 " echo "Error running git diff"
|
|
|
37 " return
|
|
|
38 " endif
|
|
|
39 "
|
|
|
40 " let filelist = split(files, "\n")
|
|
|
41 " let chosen_file = inputlist(filelist)
|
|
|
42 "
|
|
|
43 " if chosen_file != -1
|
|
|
44 " let cmd = 'tabnew ' . filelist[chosen_file]
|
|
|
45 " execute cmd
|
|
|
46 " endif
|
|
|
47 " endfunction
|
|
|
48 "
|
|
|
49 " execute "set <M-d>=\033d"
|
|
|
50 " map <M-d> :call GitDiffCached()<CR>
|
|
12
|
51 "
|
|
|
52 "
|
|
|
53 "
|
|
|
54 "
|
|
|
55
|
|
|
56
|
|
|
57 function! SendBufferToProgram()
|
|
|
58 " Create a temporary file
|
|
|
59 let temp_file = tempname()
|
|
|
60
|
|
|
61 " Write current buffer to the temporary file
|
|
|
62 exe "write! " . temp_file
|
|
|
63
|
|
|
64 " Send the content of the temporary file to your program
|
|
|
65 " Replace <your_program> with the actual command to run your program
|
|
|
66 let command = "cat " . temp_file . " | <your_program>"
|
|
|
67
|
|
|
68 " Execute the command
|
|
|
69 call system(command)
|
|
|
70
|
|
|
71 " Optionally, delete the temporary file if not needed
|
|
|
72 call delete(temp_file)
|
|
|
73 endfunction
|