ryuichiro
  • Member for 6 years, 4 months
  • Last seen more than a month ago
5 answers
25 votes
4k views
Delete until the right end of the current inner block
Accepted answer
37 votes

I would use d]) which means delete (d) to the next unmatched ')' (])). See :help ]).

View answer
3 answers
16 votes
408 views
Can I make :s operate only on the last match of the line?
Accepted answer
18 votes

I would use \zs :%s/.*\zspattern/replacement/ A little bit of explanation: . represents any single character * represents greedy matching (as many as possible) In Vim you can use zero-width ...

View answer
1 answers
8 votes
702 views
Automatically breaking lines in comments?
Accepted answer
9 votes

I like this one augroup comment_textwidth autocmd! autocmd TextChanged,TextChangedI * :call AdjustTextWidth() augroup END function! AdjustTextWidth() let syn_element = synIDattr(synID(...

View answer
4 answers
21 votes
4k views
What is the most convenient way to work with different keyboards in vim?
Accepted answer
7 votes

I would recommend keymap, which can solve your trouble. Put these in your vimrc " set keymap=greek_utf-8 set iminsert=0 set imsearch=-1 to disable Greek as a default.You can toggle the option on (...

View answer
1 answers
2 votes
2k views
vim indentation setup - Ruby
Accepted answer
4 votes

If you need to use two spaces instead of tab, try set shiftwidth=2 set tabstop=2 set expandtab More on this here on wiki or in help :h shiftwidth :h tabstop :h expandtab

View answer
1 answers
2 votes
390 views
How can I sort a file by word frequency?
Accepted answer
3 votes

Normaly, I would use :%! sort | uniq -c | sort -nr but this is a shell depended answer. Using only Vim language or ex-commands in Vim is a little bit more difficult and it is very nicely described ...

View answer
2 answers
1 votes
108 views
How to create a mapping to replace all non word characters at the beginning of a line?
Accepted answer
3 votes

nnoremap <leader>! 0v<S-Right>hr<Space> This possible solution may be also useful :%s/^.\{-}\</\=repeat(' ',strlen(submatch(0)))/g Read more :h functions :h function-list

View answer
4 answers
3 votes
251 views
Hightlight Gutter of Function Being Edited
2 votes

I was really surprised by the existence of SignColumn, so I decided to use it in this strange way. The whole function is not highlighted "if a change in a text, call SetSign() function au ...

View answer
2 answers
1 votes
952 views
Swap file directory often ignored
Accepted answer
1 votes

Use :set dir? to see which directories are used to store your swap files. If you insist on having just one directory, you could use set directory=~/.vim/tmp-backup-swapfiles// Using double trailing ...

View answer
4 answers
5 votes
2k views
Stop highlighting when entering Insert mode
1 votes

You can try: autocmd InsertEnter * setlocal nohlsearch autocmd InsertLeave * setlocal hlsearch lz inoremap <silent><Esc> <Esc>:nohl<bar>set nolz<CR> inoremap <silent&...

View answer
1 answers
3 votes
143 views
Error, polytonic Greek spell file
1 votes

I followed instructions as described at github. This is the result. Only way I could reproduce the behaviour mentioned previously was when I haven't set spell in my .vimrc but tried to enable ...

View answer
2 answers
0 votes
82 views
How can I soft wrap the gundo preview?
1 votes

Before you get better answer, you can go to /autoload/gundo.vim (or wherever it is), there should be two functions GundoSettingsGraph() and GundoSettingsPreview() (depends on which you desire to ...

View answer
2 answers
1 votes
117 views
Syntax highlighting for not empty line starting with a space, but only if the previous line did not end with "="
0 votes

Yes, it is. O.k., now seriously. This is only for the starting space. syntax match WhiteSpaceWithoutPrecedingEqualSign /=\@<!\n^ \S/hs=s+1,he=e-1 hi WhiteSpaceWithoutPrecedingEqualSign guibg=blue ...

View answer
3 answers
7 votes
182 views
Reusing search pattern in ex mode
0 votes

Another possible solution :exe '%s/' . @/ . '/replacement/g'

View answer