diff options
-rw-r--r-- | .vimrc | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -262,6 +262,29 @@ augroup lsp_install autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled() augroup END +function! SortLinesByLength() range + " Save the selected range + let start_line = a:firstline + let end_line = a:lastline + + " Create a list of lines with their lengths + let lines_with_length = [] + for lnum in range(start_line, end_line) + let line_text = getline(lnum) + call add(lines_with_length, {'text': line_text, 'length': strlen(line_text)}) + endfor + + " Sort the list by line length + let sorted_lines = sort(lines_with_length, {a, b -> a['length'] - b['length']}) + + " Replace the selected lines with the sorted lines + let current_line = start_line + for line_info in sorted_lines + call setline(current_line, line_info['text']) + let current_line += 1 + endfor +endfunction + let g:lsp_diagnostics_virtual_text_enabled = 0 let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] call asyncomplete#register_source(asyncomplete#sources#buffer#get_source_options({ |