annotate .vimrc @ 40:2cf26b593f4a ls_dev_2025_09 tip

better support for different column types
author Luka Sitas <sitas.luka.97@gmail.com>
date Thu, 16 Oct 2025 10:54:04 -0400
parents 55d2e5c5dad9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
1 syntax on
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
2 set tabstop=2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
3 set shiftwidth=2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
4 set softtabstop=2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
5 set autoindent
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
6 set smartindent
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
7 "set termguicolors
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
8 "set number
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
9 nnoremap <Leader>cc :set colorcolumn=80<cr>
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
10 nnoremap <Leader>ncc :set colorcolumn-=80<cr>
12
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
11 nnoremap <C-l> :ALECodeAction <cr>
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
12 set mouse=a
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
13
35
55d2e5c5dad9 Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents: 23
diff changeset
14 function! GeneratePhpCtags()
55d2e5c5dad9 Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents: 23
diff changeset
15 let command = 'ctags -R --fields=+aimS --php-kinds=cdfint --languages=php --extras=+q --tag-relative=yes --exclude=".git" --exclude=".hg" --exclude="node_modules" --exclude="composer.phar" --totals=yes'
55d2e5c5dad9 Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents: 23
diff changeset
16 let output = system(command)
55d2e5c5dad9 Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents: 23
diff changeset
17 endfunction
55d2e5c5dad9 Working on the factory, it's in a semi working state but obviously not complete
Luka Sitas <sitas.luka.97@gmail.com>
parents: 23
diff changeset
18
2
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
19 function! FixPhpFiles()
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
20 " Save the current cursor position
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
21 let save_cursor = getpos(".")
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
22
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
23 "Format the files
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
24 let command = 'php-cs-fixer fix .'
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
25 let output = system(command)
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
26 " Reload the file and restore the cursor position
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
27 execute 'edit!'
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
28 call setpos(".", save_cursor)
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
29 endfunction
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
30
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
31 nnoremap <leader>f :call FixPhpFiles()<CR>
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
32
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
33 " Committing commands
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
34 map <C-k> :wa<CR>:!hg addremove && hg commit <CR>
cf9993c5c7df Updated .vimrc for some helper commands.
luka
parents:
diff changeset
35
12
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
36
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
37
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
38 function! SendBufferToProgram()
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
39 " Create a temporary file
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
40 let temp_file = tempname()
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
41
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
42 " Write current buffer to the temporary file
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
43 exe "write! " . temp_file
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
44
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
45 " Send the content of the temporary file to your program
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
46 " Replace <your_program> with the actual command to run your program
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
47 let command = "cat " . temp_file . " | <your_program>"
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
48
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
49 " Execute the command
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
50 call system(command)
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
51
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
52 " Optionally, delete the temporary file if not needed
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
53 call delete(temp_file)
4bb4daa9e3f1 Working with the new FileModifier
luka
parents: 2
diff changeset
54 endfunction