Hot answers tagged

8

The highlight group Todo just defines how a "todo" should be highlighted. What is actually highlighted by Todo is defined by the syntax. For the C language, the expression is: syn keyword cTodo contained TODO FIXME XXX This defines the syntax group cTodo, that contains the named keywords. This syntax group is later linked to highlight group ...


4

syntax keywords are supposed to be - well - keywords. Initially, this meant, it must match the definition of the 'iskeyword' option, which usually does not include the quotation mark. Some years later, the iskeyword option has been de-coupled from the syntax highlighting option and now one can use the :syn iskeyword command to specify the iskeyword option ...


3

You actually want syntax enable (for good reasons which I’ll leave to the :help to explain). I created this custom command to toggle syntax; you could adjust the mapping similarly: command SynToggle \ if exists("g:syntax_on") | \ syntax off | \ else | \ syntax enable | \ endif This leaves you with nnoremap <expr> &...


3

Add space between pattern, cmd: g /\v\{/ +1,/\v}/-1 sort ^------------------separation between pattern and command It's a good habit to leave space between pattern and cmd if your cmd takes a range. +1,/\v}/-1 Is a range start from next line until previous line of /\v/. Check :h :range If you have doubts. This range is used for cmd, not for global....


3

The easiest way is to use \ze to mark end of the match: syn match mysqlTable2 "TBL_[A-Z_]\+" syn match mysqlQualifier "TBL_[A-Z_]\+.\s\+[A-Z]\+" contains=mysqlTable syn match mysqlTable "TBL_[A-Z_]\+" contained syn match mysqlQualifier "[A-Z]\+\ze\."


3

Add the following to your .vimrc: fun! SetMyTodos() syn match myTodos /\%(HABA:\)\|\%(NOTE:\)/ hi link myTodos Todo endfu autocmd bufenter * :call SetMyTodos() autocmd filetype * :call SetMyTodos() Restart. Then everytime you will set filetype (usually when you edit a file) or when you enter a buffer (:e newfile) it will add a myTodos syntax that ...


2

From :h 41.2 *41.2* Variables A variable name consists of ASCII letters, digits and the underscore. It cannot start with a digit. Valid variable names are: counter _aap3 very_long_variable_name_with_underscores FuncLength LENGTH Invalid names are "foo+bar" and "6var". And I think it's the same for functions, note that user defined ...


2

try: hi clear Conceal at the bottom of your vimrc.


2

Your terminal send ^@ as <c-space> to vim, ^@ is ctrl-@, it's equivalent to <Nul> in vim, check :h keycodes if you have doubts. You get E29: No inserted text yet error message because :h i_CTRL-@ is trying to insert previously inserted text (it doesn't exist). To fix it, use: inoremap <Nul> <c-n> or inoremap <c-@> <c-n> ...


2

I believe you’ve got the map syntax backwards (see :help :map): try inoremap <C-Space> <C-n> Also see :help ins-completion


2

You could avoid this by using the right files: :h ftplugin *41.12* Writing a filetype plugin *write-filetype-plugin* *ftplugin* A filetype plugin is like a global plugin, except that it sets options and defines mappings for the current buffer only. See |add-filetype-plugin| for how this type of plugin is used. So keep your command related to syntax in ...


2

The syntax files define regions of code and links them to highlight groups, which in turn are colored by the colorscheme. So, if you want to keep your colorscheme for more than just ui elements (status/tabline, etc.), you’ll need to syntax enable. That said, there are a few ways to improve the speed of syntax highlighting. See this very detailed QA further ...


2

The only explanation I have, is that there is another syntax enable (or syntax on) somewhere. Background: If syntax enable is executed and syntax was enabled before, all syntax items are cleared. See $VIMRUNTIME/syntax/syntax.vim line 12. The documentation only talks about :highlight, not :syntax. If you have the directory $HOME/.vim with other setup ...


1

If in specific you would like to avoid the mklink on Windows or symlinks on Linux/Unix/Mac, you can use small files for the specific languages that simply load base.vim. The technique is recommended in :help :syn-files: When a language is a superset of another language, it may include the other one, for example, the cpp.vim file could include the c.vim ...


1

Here's what I came up with: Solution 1 To match the paragraphs ending with a dot: \(\%^\|^\n\)\zs\(.\+\n\)*.\+[.]\ze\(\n\n\|\n*\%$\) To match the paragraphs ending with no dot: \(\%^\|^\n\)\zs\(.\+\n\)*.\+[^.]\ze\(\n\n\|\n*\%$\) # ^ # This is added Or with the very magic flag: \v(%^|^\n)\zs(.+\n)*.+[.]\...


1

~/.vim/view is a default value (under *nix) for :h 'viewdir' option, which, in turn, is used by the :h :mkview and :h :loadview commands. :mkview is a rarely used :mksession-like command which saves some settings of a single window/view.


1

It turns out this was easier than expected. It just boils down to installing the pip and apt packages for pylint and flake8, i.e.: sudo apt install pylint sudo apt install flake8 pip install pylint pip install flake8 This of course needs to use pip-python3 instead of pip if you've configured YCM with Python3. From there, I just install the YCM and w0rp/ale ...


1

In general a good plugin will provide good and complete documentation using Vim's own help system, :help, but sometimes it is hard to figure out the right topic name. How to find documentation topics? Vim's documentation uses tags to provide quick navigation, e.g. :help :s. This makes for a little chicken and egg problem because you might not know the help ...


1

The :syntax command only covers actual buffer contents. Both statusline and (terminal) tabline, though displayed with the same font and highlighting possibilities as the windows that contain buffer contents, are different: They belong to the editor UI elements. The main reason for syntax highlighting is highlighting parts of the text with different colors ...


Only top voted, non community-wiki answers of a minimum length are eligible