Questions tagged [whitespace]

Question about how Vim handles non printable characters.

Filter by
Sorted by
Tagged with
2 votes
1 answer
374 views

How Can I Use The Error Color for `guibg` and `ctermbg`

I have the following Vim code which highlights trailing whitespace in red: highlight ExtraWhitespace ctermbg=red guibg=red match ExtraWhitespace /\s\+$/ But instead of making the color "red"...
Amarakon's user avatar
  • 261
2 votes
1 answer
437 views

Stop vim from deleting expanded tab as a block of spaces

I am on CentOS 8.1 and using vim 8.0.1763. When I open a python file, e.g. vim tmp.py, I type tab and it inserts 4 spaces (see .vimrc below). When I type delete, it deletes all 4 spaces. I want it ...
irritable_phd_syndrome's user avatar
2 votes
1 answer
211 views

What option controls how much space is added after a new line?

When I set tw vim will auto wrap lines at tw. When breaking that line vim usually places some spaces to keep the indentation of the previous line. Example foo bar<suppose that a wrap happens ...
geckos's user avatar
  • 123
2 votes
1 answer
162 views

Leading blank line with execute function()

When I run :echo execute('echo "oh"') I get a leading blank line before the "oh" message. This happens with when I use no vimrc as well. Why is this?
vvv's user avatar
  • 53
2 votes
1 answer
371 views

Listchar for Preceding Indentation Space

At the moment, I'm trying to highlight the spaces/tabs used for indentation and the end-of-line with special characters. Although I prefer tabs over spaces I also need the spaces highlighted in order ...
Can Sürmeli's user avatar
2 votes
1 answer
54 views

On the length of tabs after an initial character

Length of tabs after initial char Start gvim with the --clean option, to get a clean slate, and then do: :set noet ts=5 sts=3 sw=2 Then enter the following 1234567890 and on the next line, press ...
wmnorth's user avatar
  • 123
2 votes
1 answer
816 views

Disable vim-better-whitespace highlighting for nvim-ipy buffer

I am using the vim-better-whitespace plugin to highlight trailing whitespaces. For some buffers, I don't want this behavior and vim-better-whitespace usually provides an option to list the filetypes ...
languitar's user avatar
  • 293
2 votes
1 answer
607 views

Only highlight trailing whitespace in normal mode

I have some code in my ~/.vimrc to highlight trailing whitespace. " Highlight trailing whitespace hi TrailingWhitespace ctermbg=red guibg=red matchadd("TrailingWhitespace", '\v\s+$') I ...
user2609980's user avatar
2 votes
0 answers
396 views

Custom highlights not working in visual splits

I'm a tabs kind of guy, so I highlight leading and trailing white spaces with the following commands in my .vimrc: highlight whiteSpace_trailing ctermbg=red guibg=red highlight whiteSpace_leading ...
solalito's user avatar
  • 363
1 vote
2 answers
316 views

Function to remove all trailing whitespace

I have the following function to remove every trailing white space from the document, without changing my cursor position function! StripTrailingWhitespaces() let l = line('.') let c = col('.') ...
noibe's user avatar
  • 179
1 vote
2 answers
259 views

<Space> doesn't insert a space within a function

So I'm trying to have a function type out a space which goes as follows: function! UnderlineHeading(level) if a:level == 1 normal! yypVr= elseif a:level == 2 normal! yypVr- else ...
Benjamin Chausse's user avatar
1 vote
2 answers
337 views

Delete whitespace before and after word

I have some text with two dashes: This is some text -- with two dashes. I want to delete the space before and after the dashes: This is some text--with two dashes. Is there a way this can be done ...
Vermillion's user avatar
1 vote
1 answer
543 views

Preventing the join() command from adding extra space

I am trying to use the join command to join multiple strings. The join command seems to add one character of space in between each of the strings. But I don't want any space added. As an example, I'm ...
Trevor's user avatar
  • 487
1 vote
1 answer
270 views

Turning the `match` command on and off

I found this useful setting form this post, which highlights trailing whitespaces : highlight ExtraWhitespace ctermbg=grey guibg=grey noremap <F10> :match ExtraWhitespace /\s\+$/<CR> This ...
First User's user avatar
1 vote
1 answer
237 views

Expandtab converts spaces to newline character?

When I enabled expandtab in vim by putting these in .vimrc: set tw=4 set expandtab Vim comverted every space typed by me to a newline character. Like with the above settings whenever I type a new ...
AVX-42's user avatar
  • 113
1 vote
1 answer
188 views

Next paragraph - don't skip lines with white spaces

When using { and } to skip to the next paragraph, the behavior is unpredictable since I can't see white spaces. I have tried to show line endings to see which lines have spaces, but I don't like the ...
nixlarfs's user avatar
1 vote
1 answer
88 views

How to prevent indent, unindent (>>, <<) from re-aligning text?

Is it possible to make indenting/unindenting not re-align text, eg: /* * Some Text */ Indents to: /* * Some Text */ I would prefer/expect: /* * Some Text */ I saw ...
ideasman42's user avatar
  • 3,733
1 vote
1 answer
812 views

Fix spacing with vim

I would like to fix only spacing in badly formatted C/C++ source code. The Vim command = fixes only indentation. Utility indent is not suitable, because it reformats totally all source code, but want ...
Costa's user avatar
  • 141
1 vote
1 answer
1k views

Disable automatic whitespace marking in red

I am experiencing a behavior as depicted in the picture below: vim marks the redundant spacing in red. I would like to completely remove this behavior. At the moment my .vimrc file reads as: set ...
Donatas's user avatar
  • 11
1 vote
0 answers
38 views

What is the empty space in this document and how do I. get rid of them

Here is my document: What is the thing that my cursor is on? It is definitely not a whitspace as all white space should be marked with ␣. And more importantly, how do I get rid of it? I have tried :g/...
jxhyc's user avatar
  • 135
1 vote
1 answer
203 views

Tab multiple lines [duplicate]

I have my tab set to 4 spaces with :set tabstop=4. Now I want to highlight multiple lines and tab them, or indent all them 4 spaces. If I highlight the lines and do >, it seems to indent them more ...
Thermodynamix's user avatar
0 votes
1 answer
395 views

How to delete and replace a block of text with spaces?

What I want to do I want to select a block of text in Vim, delete it, and replace the selected block with spaces. Example Suppose I have the following text: Lorem ipsum dolor sit amet, ...
jvriesem's user avatar
  • 131
0 votes
1 answer
262 views

Removing trailing spaces with the substitute command changes the cursor position

From http://vim.wikia.com/wiki/Remove_unwanted_spaces function TrimWhiteSpace() %s/\s\+$//e endfunction autocmd FileWritePre * call TrimWhiteSpace() autocmd FileAppendPre * call TrimWhiteSpace() ...
Tony's user avatar
  • 1
0 votes
1 answer
104 views

How to operate on all of a word without its surrounding space?

In vim you can do daw to delete the entire word, but it also removes the space after the word, (caw too). Is there a way to operate on the entire word without effecting the space around it? For ...
ideasman42's user avatar
  • 3,733
0 votes
2 answers
2k views

How to convert spaces on a line to tabs?

I know there's a way because it happened by accident. I was frenetically moving in a short region of text and at some point, with some wrong keystroke, the leading spaces on the line became a tab (and ...
Enlico's user avatar
  • 2,194
0 votes
1 answer
33 views

Convert spaces to tabs on only one line

So I know that, in Vim, I can use the :retab command to convert an entire file from multiple-spaces to tabs or from tabs to spaces, depending on the value of :set expandtab. But is there a way that I ...
hymie's user avatar
  • 145
0 votes
1 answer
594 views

How do I add spaces to a file path in vimrc?

I am trying to set the shell to git bash in my vimrc. I have this: The code says: set shell=C:\Program Files\Git\git-bash.exe But because there's a whitespace in Program Files, it acts as a separate ...
GoodBoyNeon's user avatar
0 votes
1 answer
911 views

Vim search: how to factor in the white space during the search?

Doing a search with / can be useful, however, it becomes harder to find things if the term you are searching for is a part of other words. I have a large text document with notes i've made about the ...
user avatar
0 votes
1 answer
249 views

zf add fold marker comments with preceding spaces

Setting foldmethod=marker, I can highlight a few lines, press zf to fold them. By default vi will add {{{ and }}} at the ends of the beginning and ending lines. I am working on shell scripts with ...
midnite's user avatar
  • 113
0 votes
2 answers
1k views

Replace tabs with appropriate number of spaces

I have this texts drwxr-xr-x enan enan Jan 15 16:10 Desktop/ drwxr-xr-x enan enan Jan 16 20:09 Documents/ drwxr-xr-x enan enan Jan 20 19:52 Downloads/ drwxr-xr-x enan ...
3N4N's user avatar
  • 5,704
0 votes
1 answer
386 views

How to configure pylsp installed by Mason with lsp-zero for nvim?

I want to disable a specific error/warning - E203. This is my lsp.lua where I tried to add ignore config according to this doc from lsp-zero git local lsp = require("lsp-zero") lsp.preset(&...
hdw3's user avatar
  • 101
0 votes
0 answers
79 views

How to make `lead` override `trail` in listchars

I have the following lines in my .vimrc. set list set listchars=lead:·,trail:⎵ Whenever I have a line consisting of only spaces, the character shown is ⎵. How can I make vim prefer · in this scenario?...
efthimio's user avatar
  • 101
0 votes
0 answers
28 views

Keep whitespace from indent even on empty line [duplicate]

I am working with python files with filetype indent on. I like a lot of the default indenting features for python, but I would like vim to keep the tabs, even on empty lines. For example, using set ...
Amadou Kone's user avatar
0 votes
0 answers
34 views

What is the shortkey for adding a space before a word in normal mode?

I have the following text: #Text My cursor is on character T; I want to obtain # Text i.e., to put a space between # and T, without "pressing i and then space". Instead, I want to do so in ...
Naghi's user avatar
  • 101
-1 votes
4 answers
110 views

Remove blank lines appearing between non-blank lines without a regex?

What is the quickest way to un-doublespace in Vim, without using a regex? I.e., convert line one <emptyline> line two <emptyline> line three to line one line two line three There's gotta ...
Geremia's user avatar
  • 956
-1 votes
1 answer
92 views

Avoid colours of white space

Added a lot of stuff to my vimrc lately and I am not sure what is causing vim to colour the whitespaces. The colour disappears when I save the file. However I would like to disable this feature. Is ...
Hrushi's user avatar
  • 135
-1 votes
1 answer
42 views

find first non-blank column in visual selection

If I select all of these lines in linewise-visual mode hi there how do you do How can I get the column number of the first non-blank character from the left? I.e. the minimum ...
minseong's user avatar
  • 2,323

1
2