|
diff --git a/vimrc b/vimrc
|
| ... |
| 23 |
|
23 |
|
| 24 |
" Commenting blocks of code. |
24 |
" Commenting blocks of code. |
| 25 |
" https://stackoverflow.com/a/1676672 |
25 |
" https://stackoverflow.com/a/1676672 |
| 26 |
augroup commenting_blocks_of_code |
26 |
augroup CodeCommenting |
| 27 |
autocmd! |
27 |
autocmd! |
| 28 |
autocmd FileType c,cpp,go,zig let b:comment_leader = '// ' |
28 |
autocmd FileType c,cpp,go,zig let b:comment_leader = '// ' |
| 29 |
autocmd FileType sh,ruby,python let b:comment_leader = '# ' |
29 |
autocmd FileType sh,ruby,python let b:comment_leader = '# ' |
| ... |
| 34 |
noremap <silent> cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> |
34 |
noremap <silent> cc :<C-B>silent <C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR> |
| 35 |
noremap <silent> cu :<C-B>silent <C-E>s/^\(\s*\)\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> |
35 |
noremap <silent> cu :<C-B>silent <C-E>s/^\(\s*\)\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR> |
| 36 |
|
36 |
|
| 37 |
" Function to auto format source code files. |
37 |
" External auto-format programs. |
| 38 |
function! Format() |
38 |
autocmd FileType c,cpp setlocal formatprg=clang-format |
| 39 |
if &filetype == 'c' | write | call system('clang-format -i '.expand('%')) | edit! | endif |
39 |
autocmd FileType go setlocal formatprg=gofmt |
| 40 |
if &filetype == 'go' | write | call system('go fmt '.expand('%')) | edit! | endif |
|
|
| 41 |
endfunction |
|
|
| 42 |
command! Format call Format() |
|
|
| 43 |
|
40 |
|
| 44 |
" FZF integration. |
41 |
" FZF integration. |
| 45 |
function! FZF() |
42 |
function! FZF() |
| ... |