Closed p00f closed 4 years ago
@p00f I don't know if calling twice startup is good.
First after doing your setup open nvim again and run ex command PackerCompile, this will enable requires, config, and setup... Always remember this.
requires on init.vim won't work as start packages run on VimEnter event so you need to setup config and setup options.
My setup
" init.vim
lua require('init')
-- lua/init.lua
local api = vim.api
local fn = vim.fn
local luv = vim.loop
local packer_path = luv.os_homedir() .. '/.local/share/nvim/site/pack/packer/opt/packer.nvim'
api.nvim_command('packadd packer.nvim')
-- Temporary until https://github.com/neovim/neovim/pull/12632 is merged
vim._update_package_paths()
local packer = require('packer')
local packages = require('packages')
packer.startup(function()
for key, value in pairs(packages) do
packer.use(value)
end
-- Temporary until https://github.com/neovim/neovim/pull/12632 is merged
vim._update_package_paths()
end)
-- lua/packages.lua
local packages = {
{ 'wbthomason/packer.nvim', opt = true },
{
'nvim-treesitter/nvim-treesitter',
config = 'require [[config/treesitter]]',
},
{
'neovim/nvim-lsp',
config = 'require [[config/lsp]]',
requires = {
{ 'nvim-lua/completion-nvim' },
{ 'nvim-lua/diagnostic-nvim' },
{ 'nvim-lua/lsp-status.nvim' },
},
},
{
'drewtempelmeyer/palenight.vim',
config='vim.cmd [[colorscheme palenight]]'
},
{
'norcalli/nvim-colorizer.lua',
config='require [[colorizer]].setup()',
},
{
'Akin909/nvim-bufferline.lua',
-- after = {'ryanoasis/vim-devicons', 'drewtempelmeyer/palenight.vim'},
config='require [[bufferline]].setup{ options = { view = "multiwindow", numbers = "ordinal", number_style = "superscript", mappings = true, separator_style = "thin" } }',
},
}
return packages
and you have to create lua/config/lsp.lua
lua/config/treesitter.lua
files to do your settings for lsp and treesitter (if you want to use it)
Thanks, I'll try this
and you have to create lua/config/lsp.lua lua/config/treesitter.lua files to do your settings for lsp and treesitter (if you want to use it)
lsp.lua is from a plugin, treesitter.lua is created. They work fine when used with vim-plug
Nah that still doesn't work
vim-plug use another approach, this use package feature of vim.
lsp.lua is from a plugin, treesitter.lua is created
no, those files you have to create them in lua/config directory. or if you want chose another name and update the require in config
{
'nvim-treesitter/nvim-treesitter',
config = 'require [[config/treesitter]]',
},
{
'neovim/nvim-lsp',
config = 'require [[config/lsp]]',
requires = {
{ 'nvim-lua/completion-nvim' },
{ 'nvim-lua/diagnostic-nvim' },
{ 'nvim-lua/lsp-status.nvim' },
},
},
Nah that still doesn't work
I hope you are doing this:
EDIT. Also you have to run :PackerInstall or :PackerUpdate
Thanks, that seems to kinda work. How do I require
like lua require'colorizer'.setup()
from here:https://github.com/norcalli/nvim-colorizer.lua#installation-and-usage
Got it, thanks!!
{'norcalli/nvim-colorizer.lua', config={'require [[colorizer]].setup()'}}
One more thing, I can't get completion to work with https://github.com/aca/completion-tabnine + https://github.com/nvim-lua/completion-nvim
~/.config/nvim/init.vim
:
set termguicolors
lua require('init')
~/.config/nvim/init.lua
: (copied from @carlitux 's comment)
-- lua/init.lua
local api = vim.api
local fn = vim.fn
local luv = vim.loop
local packer_path = luv.os_homedir() .. '/.local/share/nvim/site/pack/packer/opt/packer.nvim'
api.nvim_command('packadd packer.nvim')
-- Temporary until https://github.com/neovim/neovim/pull/12632 is merged
vim._update_package_paths()
local packer = require('packer')
local packages = require('packages')
packer.startup(function()
for key, value in pairs(packages) do
packer.use(value)
end
-- Temporary until https://github.com/neovim/neovim/pull/12632 is merged
vim._update_package_paths()
end)
~/.config/nvim/luya/packages.lua
:
local packages = {
{'wbthomason/packer.nvim'},
{'Akin909/nvim-bufferline.lua', config = 'require [[bufferline]].setup()'},
{'bakpakin/fennel.vim', ft = {'java'}, opt = true},
{'camspiers/lens.vim', requires = {{'camspiers/animate.vim'}}},
{'dense-analysis/ale'},
{'dracula/vim'},
{'editorconfig/editorconfig-vim'},
{'guns/vim-sexp', ft = {'clj', 'fnl'}, requires = 'tpope/vim-sexp-mappings-for-regular-people'},
{'hardcoreplayers/dashboard-nvim'},
{'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview', ft = {'md', 'mkdn', 'vim-plug'}},
{'jeffkreeftmeijer/vim-numbertoggle'},
{'jiangmiao/auto-pairs'},
{'justinmk/vim-gtfo'},
{'justinmk/vim-sneak'},
{'kassio/neoterm', cmd = {'TNew'}},
{'kyazdani42/nvim-tree.lua', requires = {'kyazdani42/nvim-web-devicons'}},
{'liuchengxu/vim-clap',
-- config = 'vim.cmd[[Clap install-binary!]]'
},
{'liuchengxu/vista.vim'},
{'mattn/vim-sonictemplate'},
{'mhinz/vim-signify'},
{'nvim-lua/completion-nvim',
requires = {{'hrsh7th/vim-vsnip'}, {'hrsh7th/vim-vsnip-integ'},
--{'ncm2/float-preview.nvim'},
{'aca/completion-tabnine'}}},
{'neovim/nvim-lsp',
requires = {'nvim-lua/lsp-status.nvim', 'nvim-lua/diagnostic-nvim'},
config = {'require [[nvim_lsp]].bashls.setup{}', 'require [[nvim_lsp]].jdtls.setup{}', 'require [[nvim_lsp]].vimls.setup{}'}
},
{'norcalli/nvim-colorizer.lua', config={'require [[colorizer]].setup()'}},
{'nvim-treesitter/nvim-treesitter', config='require [[treesitter_setup]]' },
{'Olical/aniseed', config='require [[aniseed.dotfiles]]'},
{'Olical/conjure', ft = {'fnl', 'clj'}},
{'pbrisbin/vim-mkdir'},
{'psliwka/vim-smoothie'},
{'tpope/vim-fugitive'},
{'tpope/vim-surround'},
{'tyru/caw.vim'},
{'reedes/vim-pencil', ft = {'txt', 'md', 'mkdn', 'rst'}},
{'rhysd/git-messenger.vim'},
--TODO 'skywind3000/vim-quickui',
{'vigoux/LanguageTool.nvim',
--TODO ft = {},
},
{'vim-airline/vim-airline'},
{'Yggdroot/indentLine', requires = 'lukas-reineke/indent-blankline.nvim'},
{'ryanoasis/vim-devicons'},
}
return packages
I have set completion-nvim to attach to every buffer like this (in dotfiles)
autocmd BufEnter * lua require'completion'.on_attach()
Now, if I have
let g:completion_chain_complete_list = {
\ 'default': [
\ {'complete_items': ['lsp', 'snippet' ]},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\]
\}
completion works fine.
But as soon as I add 'tabnine'
to 'complete_items'
, like
let g:completion_chain_complete_list = {
\ 'default': [
\ {'complete_items': ['lsp', 'snippet', 'tabnine' ]},
\ {'mode': '<c-p>'},
\ {'mode': '<c-n>'}
\]
\}
completion stops working. (Not even lsp completion works) There are not errors emitted
Just to confirm, that completion-nvim
setup works with vim-plug
and you have run PackerUpdate
or PackerInstall
since adding aca/completion-tabnine
to the requires
table for completion-nvim
?
Also @carlitux thanks for helping out!
yes, just checked both of these
Ah! I tried to replicate the issue and figured it out; you never ran install.sh
.
Try making your tabnine
config something like
{'aca/completion-tabnine', run = './install.sh'}
Big brain time
How is ft
supposed to work?
I have 2 plugins
bakpakin/fennel.vim
which is syntax highlighting for fennel, specifed as {'bakpakin/fennel.vim', ft = 'fnl'}
iamcco/markdown-preview.nvim
which is - well - markdown preview , specified as {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview', ft = {'md', 'mkdn', 'markdown'}, config= 'vim.cmd[[MarkdownPreview]]'}
Both of them are not loaded (ie I don't see syntax highlighting in fennel files, and get Error executing lua [string "vim.cmd[[MarkdownPreview]]"]:1: Vim:E492: Not an editor command: MarkdownPreview
when I run :MarkdownPreview
PS -there's a typo in the quickstart section of the readme - you forgot to close '
after config = 'vim.cmd[[ALEEnable]]
How is
ft
supposed to work? I have 2 plugins* `bakpakin/fennel.vim` which is syntax highlighting for fennel, specifed as `{'bakpakin/fennel.vim', ft = 'fnl'}` * `iamcco/markdown-preview.nvim` which is - well - markdown preview , specified as `{'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview', ft = {'md', 'mkdn', 'markdown'}, config= 'vim.cmd[[MarkdownPreview]]'}`
Both of them are not loaded (ie I don't see syntax highlighting in fennel files, and get
Error executing lua [string "vim.cmd[[MarkdownPreview]]"]:1: Vim:E492: Not an editor command: MarkdownPreview
when I run:MarkdownPreview
ft
loads plugins when any of the given filetypes are set. For https://github.com/bakpakin/fennel.vim, I suspect you're not getting any highlighting because that plugin (via its ftdetect
script) defines the fnl
filetype. So, without that plugin loaded, no file ever gets the fnl
filetype set.
The problem with your markdown-preview.nvim
config is a subtler one, but has to do with how that particular plugin is designed (i.e. it doesn't play nice with filetype-based lazy loading by default). If you look at its initialization script https://github.com/iamcco/markdown-preview.nvim/blob/ee63528bec7adbcdfaf94e2637fe630a6a576115/plugin/mkdp.vim#L113, it creates its commands in a BufEnter
autocommand. However, since it's now being loaded after filetype
is set, BufEnter
has passed and the commands never get set.
You can fix this by making your config trigger BufEnter
, e.g.
use {
'iamcco/markdown-preview.nvim',
ft = {'md', 'mkdn', 'markdown'},
config = {'vim.cmd[[doautocmd BufEnter]]', 'vim.cmd[[MarkdownPreview]]'},
run = 'cd app && yarn install',
cmd = 'MarkdownPreview'
}
PS -there's a typo in the quickstart section of the readme - you forgot to close
'
afterconfig = 'vim.cmd[[ALEEnable]]
Thanks! I'll fix this.
I get this on startup (imgur wasn't working) https://drive.google.com/file/d/1RdXTqghguJYjODTaCUs_tqr5zZx2R1d6/view?usp=sharing It is looking for stuff in the wrong places, so I'm obviously doing something wrong. What I did: 1)
git clone https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/opt/packer.nvim
2) My init.vim:
3)
.config/nvim/lua/plugins.lua
: