NeoVim не может обнаружить Django HTML FileType ни загружать сниппеты (htmldjango)
Использование nvim 0.5.0, coc.nvim 0.0.78 и Nord для терминала GNOME. Я редактирую html-файлы шаблона Django, но html не открывает фрагменты djangohtml:
call plug#begin('~/.config/nvim/autoload/plugged')
" Better Syntax Support
Plug 'sheerun/vim-polyglot'
" Auto pairs for '(' '[' '{'
Plug 'jiangmiao/auto-pairs'
" Auto close tags <>
Plug 'alvan/vim-closetag'
" Theme
Plug 'arcticicestudio/nord-vim'
" Air theme
Plug 'vim-airline/vim-airline'
" Cool Icons
Plug 'ryanoasis/vim-devicons'
" Stable version of coc && snippets
Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'honza/vim-snippets'
" Complements
Plug 'tpope/vim-commentary'
" Repeat stuff
Plug 'tpope/vim-repeat'
" Surround
Plug 'tpope/vim-surround'
" Fast within-file word replacement.
Plug 'wincent/scalpel'
" FZF and rooter
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'airblade/vim-rooter'
" For show the #color in a css file
Plug 'ap/vim-css-color'
" For git integration
Plug 'mhinz/vim-signify'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
" Vim whichkeys
Plug 'liuchengxu/vim-which-key'
" Distraction free writing by removing UI elements and centering everything.
Plug 'junegunn/goyo.vim'
" For nice & tabular tables. (works in md too)
Plug 'godlygeek/tabular'
" VimWiki
Plug 'vimwiki/vimwiki'
" Vim-Startify
Plug 'mhinz/vim-startify'
call plug#end()
комментарий и удален Plug 'sheerun/vim-polyglot'
не было проблемой
затем в моем файле coc.vim я пытаюсь исправить проблему редактированием g:coc_filetype_map
" Tell djangohtml to filetype map to html
let g:coc_filetype_map = {
\ 'htmldjango': 'html',
\ }
" Global extensions
let g:coc_global_extensions = [
\ 'coc-html',
\ 'coc-css',
\ 'coc-python',
\ 'coc-explorer',
\ 'coc-json',
\ 'coc-vimlsp',
\ 'coc-marketplace',
\ 'coc-snippets',
\ ]
затем добавив эти строки в coc.settings.json
"html.enable": true,
"html.filetypes": [
"html",
"handlebars",
"django",
"htmldjango"
],
"html.format.enable": true,
"snippets.extends": {
"htmldjango": [
"html"
]
},
settings.vim выглядит так, добавив этот au BufNewFile,BufRead *.html set filetype=htmldjango
который установлен :echo &filetype
htmldjango
но не сниппеты загружаются только html.snipptes
syntax enable " Enables syntax highlighing
set termguicolors " Use guifg/guibg instead of ctermfg/ctermbg in terminal
set hidden " Required to keep multiple buffers open multiple buffers
set nowrap " Display long lines as just one line
set encoding=utf-8 " The encoding displayed
set pumheight=10 " Makes popup menu smaller
set fileencoding=utf-8 " The encoding written to file
set ruler " Show the cursor position all the time
set cmdheight=3 " More space for displaying messages
set iskeyword+=- " treat dash separated words as a word text object
set iskeyword+=_ " treat under_dash separated words as a word text object
set mouse=a " Enable your mouse
set splitbelow " Horizontal splits will automatically be below
set splitright " Vertical splits will automatically be to the right
set t_Co=256 " Support 256 colors
set conceallevel=0 " So that I can see `` in markdown files
set tabstop=4 " Insert 4 spaces for a tab
set softtabstop=4
set shiftwidth=4
set shiftwidth=4 " Change the number of space characters inserted for indentation
set smarttab " Makes tabbing smarter will realize you have 2 vs 4
set expandtab " Converts tabs to spaces
set smartindent " Makes indenting smart
set autoindent " Good auto indent
set laststatus=0 " Always display the status line
set number " Line numbers
set relativenumber " Line relativenumbers
set numberwidth=5 " The width of the line numbers and relativenumbers
set regexpengine=1 " Old engine for regex
set scrolloff=3 " Set 3 lines to scrolloff
set matchpairs+=<:> " Use % to jump between pairs for HTML <:>.
set cursorline " Enable highlighting of the current line
set background=dark " tell vim what the background color looks like
set list " Show whitespace
set colorcolumn=80 " Show in the screem where is 80 characteres
set showtabline=2 " Always show tabs
set noshowmode " We don't need to see things like -- INSERT -- anymore
set nobackup " This is recommended by coc
set noswapfile " Don't create root-owned files
set nowritebackup " This is recommended by coc
set updatetime=100 " Faster completion
set timeoutlen=1000 " By default timeoutlen is 1000 ms
set clipboard=unnamedplus " Copy paste between vim and everything else
set foldmethod=indent " Foldmethod indent
set foldlevelstart=1 " Fold indent start at one
set foldlevel=99 " End fold indent at 99
set autochdir " Your working directory will always be the same as your working directory
set shortmess+=c " Don't pass messages to ins-completion-menu (coc)
set signcolumn=yes " Always show the signcolumn, otherwise it would shift the text each time (coc)
set nocompatible " for wiki
autocmd BufRead,BufNewFile *.json,*.css,*.scss,*.less setlocal foldmethod=marker foldmarker={,}
au BufEnter * set fo-=c fo-=r fo-=o " Stop newline continution of comments
au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC
" djangohtml
au BufNewFile,BufRead *.html set filetype=htmldjango
" You can't stop me
" cmap w!! w !sudo tee %
Все пробую, сначала сниппеты не загружаются но после установки Plug 'honza/vim-snippets'
некоторая часть проблемы была решена. html.snippets загружены, но нет htmldjango.snippets, не знаю, как настроить или, может быть, порядок загрузки файлов? форматирование в порядке
source $HOME/.config/nvim/vim-plug/plugins.vim
source $HOME/.config/nvim/general/settings.vim
source $HOME/.config/nvim/keys/mappings.vim
source $HOME/.config/nvim/keys/which-keys.vim
source $HOME/.config/nvim/themes/nordvim.vim
source $HOME/.config/nvim/themes/airline.vim
source $HOME/.config/nvim/plug-config/scapel.vim
source $HOME/.config/nvim/plug-config/coc.vim
source $HOME/.config/nvim/plug-config/fzf.vim
source $HOME/.config/nvim/plug-config/signify.vim
source $HOME/.config/nvim/plug-config/vimwiki.vim
source $HOME/.config/nvim/plug-config/start-project.vim