From 9417f48a99e4d8aea2352c7dd00b8c6eac57676c Mon Sep 17 00:00:00 2001 From: hrsh7th <629908+hrsh7th@users.noreply.github.com> Date: Sat, 20 Aug 2022 19:21:22 +0900 Subject: [PATCH] Restore filetype setting --- doc/cmp.txt | 14 ++++++++++++++ lua/cmp/view/custom_entries_view.lua | 1 + lua/cmp/view/docs_view.lua | 1 + 3 files changed, 16 insertions(+) diff --git a/doc/cmp.txt b/doc/cmp.txt index 740ac43..17fbf89 100644 --- a/doc/cmp.txt +++ b/doc/cmp.txt @@ -12,6 +12,7 @@ Function |cmp-function| Mapping |cmp-mapping| Command |cmp-command| Highlight |cmp-highlight| +FileType |cmp-filetype| Autocmd |cmp-autocmd| Config |cmp-config| Config Helper |cmp-config-helper| @@ -312,6 +313,8 @@ There are also builtin mapping helper functions you can use: Built-in mapping helpers are only available as a configuration option. If you want to call nvim-cmp features directly, please use |cmp-function| instead. + + ============================================================================== Command *cmp-command* @@ -321,6 +324,8 @@ Command *cmp-command* For example, `cmp-nvim-lsp` registers itself on InsertEnter autocommand so the status will be shown as `unknown` when running the command. + + ============================================================================== Highlight *cmp-highlight* @@ -351,6 +356,15 @@ NOTE: `kind` is a symbol after each completion option. *CmpItemMenu* The menu field's highlight group. +============================================================================== +FileType *cmp-filetype* + +*cmp_menu* + The completion menu buffer's filetype. + +*cmp_docs* + The documentation window buffer's filetype. + ============================================================================== Autocmd *cmp-autocmd* diff --git a/lua/cmp/view/custom_entries_view.lua b/lua/cmp/view/custom_entries_view.lua index 2ce3bc5..da2310d 100644 --- a/lua/cmp/view/custom_entries_view.lua +++ b/lua/cmp/view/custom_entries_view.lua @@ -37,6 +37,7 @@ custom_entries_view.new = function() -- always rendered one column wide, which removes the unpredictability coming -- from variable width of the tab character. self.entries_win:buffer_option('tabstop', 1) + self.entries_win:buffer_option('filetype', 'cmp_menu') self.event = event.new() self.offset = -1 self.active = false diff --git a/lua/cmp/view/docs_view.lua b/lua/cmp/view/docs_view.lua index 722d415..c330767 100644 --- a/lua/cmp/view/docs_view.lua +++ b/lua/cmp/view/docs_view.lua @@ -16,6 +16,7 @@ docs_view.new = function() self.window:option('linebreak', true) self.window:option('scrolloff', 0) self.window:option('wrap', true) + self.window:buffer_option('filetype', 'cmp_docs') return self end