comparison .vimrc @ 16:e577dac6c913 development

Simple test
author Luka Sitas <sitas.luka.97@gmail.com>
date Mon, 23 Sep 2024 20:32:05 -0400
parents 4bb4daa9e3f1
children
comparison
equal deleted inserted replaced
12:4bb4daa9e3f1 16:e577dac6c913
26 nnoremap <leader>f :call FixPhpFiles()<CR> 26 nnoremap <leader>f :call FixPhpFiles()<CR>
27 27
28 " Committing commands 28 " Committing commands
29 map <C-k> :wa<CR>:!hg addremove && hg commit <CR> 29 map <C-k> :wa<CR>:!hg addremove && hg commit <CR>
30 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>
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