folke / todo-comments.nvim

✅ Highlight, list and search todo comments in your projects
Apache License 2.0
2.97k stars 87 forks source link

Don't understand the vim script config #126

Closed Ross-Li closed 1 week ago

Ross-Li commented 1 year ago

By saying

lua << EOF
  require("todo-comments").setup {
    -- your configuration comes here
    -- or leave it empty to use the default settings
    -- refer to the configuration section below
  }
EOF

in the vim script config method, do you mean to include this code directly into the init.vim file??? It doesn't seems to work for me because the syntax highlighing suggests it can't recognize this code. Can you please add in the document about where exactly to include this code in?

image

folke commented 1 year ago

in init.vim or anywhere else. Just make sure this code is ran after the plugin is loaded

Ross-Li commented 1 year ago

@folke I have already included this code in init.vim, but the plugin doesn't work.

folke commented 1 year ago

Are you sure the plugin was loaded before executing this? What plugin manager are you using?

Ross-Li commented 1 year ago

Just vimplug, here is my init.vim

" Inspirations from the following config sources
" https://gist.github.com/synasius/5cdc75c1c8171732c817
" https://github.com/Garoth/Configs/blob/master/nvim/init.vim
" https://github.com/krisleech/neovim-config/blob/master/init.vim
" https://github.com/NeuralNine/config-files/blob/master/init.vim
" https://gist.github.com/pluskid/2de23aea09470e985a33899ed154dc95
" https://zhuanlan.zhihu.com/p/434731678

" Plugins
call plug#begin()

Plug 'https://github.com/vim-airline/vim-airline'           " Airline theme
Plug 'https://github.com/preservim/nerdtree'                " Nerdtree file explorer
Plug 'http://github.com/tpope/vim-surround'                 " Surrounding ysw
Plug 'https://github.com/tpope/vim-commentary'              " For Commenting gcc & gc
Plug 'https://github.com/rafi/awesome-vim-colorschemes'     " Some colorschemes
Plug 'https://github.com/ryanoasis/vim-devicons'            " Developer Icons
Plug 'https://github.com/tc50cal/vim-terminal'              " Vim Terminal
Plug 'https://github.com/terryma/vim-multiple-cursors'      " CTRL+N for multiple cursors
" Plug 'https://github.com/neoclide/coc.nvim'               " Auto Completion
Plug 'https://github.com/jbgutierrez/vim-better-comments'   " Better comment
Plug 'https://github.com/windwp/nvim-autopairs'             " Auto pairs
Plug 'folke/todo-comments.nvim'                             " Better comment for neovim
Plug 'nvim-lua/plenary.nvim'

call plug#end()

" Plugin Settings
    " NERDTree
nnoremap <C-f> :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
    " todo comment  

lua << EOF
  require("todo-comments").setup {
    -- your configuration comes here
    -- or leave it empty to use the default settings
    -- refer to the configuration section below
  }
EOF

" Colorscheme
:colorscheme onedark

:set nocompatible            " Disable compatibility to old-time vi

" Space & Tabs
:set tabstop=4              " Number of visual spaces per TAB
:set softtabstop=4          " Number of spaces in tab when editing
:set shiftwidth=4           " Number of spaces for autoindent
:set expandtab              " Tabs are spaces
:set mouse=a                " Enable mouse click
:set autoindent             " Enable autoindent
:set smarttab               " Enable smarttab

" Clipboard
set clipboard=unnamed

" UI  
set number                  " Show line number
set cursorline              " Highlight current cursorline
hi CursorLine cterm=NONE ctermbg=DarkGrey ctermfg=white
hi Comment cterm=italic gui=italic
set showcmd                 " Show command in bottom bar
set wildmenu                " Enable visual auto complete for command menu
set showmatch               " Highlight matching brace

" WSL yank support
" From https://stackoverflow.com/questions/44480829/how-to-copy-to-clipboard-in-vim-of-bash-on-windows/61864749#61864749
let s:clip = '/mnt/c/Windows/System32/clip.exe'  " default location
if executable(s:clip)
    augroup WSLYank
        autocmd!
        autocmd TextYankPost * call system('echo '.shellescape(join(v:event.regcontents, "\<CR>")).' | '.s:clip)
    augroup END
end

image

folke commented 1 year ago

Can you show me the file where it should highlight?

Also, you don't seem to have treesitter installed, so comments_only won't work. (you may have to disable it)

Ross-Li commented 1 year ago

Ahhh I see, maybe it is the absence of TreeSitter. I will have a look at it. For now the icon works. Thank you for your timely response! image

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 week ago

This issue was closed because it has been stalled for 7 days with no activity.