nvim: Fix Lazy's ft setting breaking ftplugin

The trick is to include 3 lines in init before lazy is loaded.

vim.cmd [[
  filetype plugin on
  filetype indent on
  syntax on
]]

Note that me switching ftdetect and ftplugin content to lua has nothing
to do with this fix. Vim should work well as well.

Made the switch to speed up operations. And fully eliminate Vimscript
from the config. (I love vimscript but unfortunately lua is faster!)
This commit is contained in:
hedy 2023-07-02 09:14:42 +08:00
parent 65c1e2c5b4
commit 4b8dfad834
Signed by: hedy
GPG Key ID: B51B5A8D1B176372
19 changed files with 75 additions and 58 deletions

View File

@ -0,0 +1,4 @@
vim.api.nvim_create_autocmd(
{ "BufNewFile", "BufRead" },
{ pattern = "*.moon", command = "set filetype=moon" }
)

View File

@ -1 +0,0 @@
autocmd BufNewFile,BufRead *.moon set filetype=moon

View File

@ -0,0 +1,4 @@
vim.api.nvim_create_autocmd(
{ "BufNewFile", "BufRead" },
{ pattern = "*.scd", command = "set filetype=scdoc" }
)

View File

@ -1 +0,0 @@
autocmd BufNewFile,BufRead *.scd set filetype=scdoc

View File

@ -0,0 +1,4 @@
vim.api.nvim_create_autocmd(
{ "BufNewFile", "BufRead" },
{ pattern = "*.slo", command = "set filetype=slope" }
)

View File

@ -1 +0,0 @@
autocmd BufNewFile,BufRead *.slo set filetype=slope

View File

@ -1,16 +0,0 @@
" Set up :make to use fish for syntax checking.
" Error about unknown compiler?
" compiler fish
" set indent size
setl shiftwidth=4
" Set this to have long lines wrap inside comments.
setl textwidth=79
" Enable folding of block structures in fish.
setl foldmethod=expr
" Use spaces please
setl expandtab
setl tabstop=4

View File

@ -0,0 +1 @@
vim.opt_local.expandtab = false

View File

@ -1 +0,0 @@
setl noexpandtab

View File

@ -0,0 +1,3 @@
vim.opt_local.tabstop = 2
vim.opt_local.shiftwidth = 2
vim.opt_local.softtabstop = 2

View File

@ -1,3 +0,0 @@
setl tabstop=2
setl shiftwidth=2
setl softtabstop=2

View File

@ -0,0 +1,3 @@
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.shiftwidth = 2

View File

@ -1,3 +0,0 @@
setl tabstop=2
setl shiftwidth=2
setl softtabstop=2

View File

@ -1 +0,0 @@
setl textwidth=80

View File

@ -1,3 +0,0 @@
setl tabstop=2
setl shiftwidth=2
setl softtabstop=2

View File

@ -0,0 +1,2 @@
vim.opt_local.shiftwidth=2
vim.opt_local.tabstop=2

View File

@ -1,2 +0,0 @@
setl shiftwidth=2
setl tabstop=2

View File

@ -9,4 +9,15 @@ end
vim.opt.rtp:prepend(lazypath)
vim.opt.completeopt = { "menuone", "noinsert", "noselect", "preview" }
require('lazy').setup('plugin_spec')
-- Fix when ft = blah included in plugin spec, syntax not loaded.
vim.cmd [[
filetype plugin on
filetype indent on
syntax on
]]
require('lazy').setup('plugin_spec', {
install = {
colorscheme = { "dracula" },
},
})

View File

@ -1,18 +1,19 @@
-- Used by Lazy.nvim in loadlazy.lua
return {
{ "dracula/vim", name = "dracula", init = function()
-- THE most important nvim configuration
vim.cmd("colorscheme dracula")
end },
{
"dracula/vim", name = "dracula", lazy = false, priority = 10000,
config = function()
-- THE most important nvim configuration
vim.cmd("colorscheme dracula")
end,
},
{
"nvim-tree/nvim-tree.lua",
config = function()
require("nvim-tree").setup({
view = { width = 20, },
-- renderer = { group_empty = true, },
-- filters = { dotfiles = true, },
})
end
opts = {
view = { width = 20, },
-- renderer = { group_empty = true, },
-- filters = { dotfiles = true, },
},
},
"tpope/vim-fugitive",
"jreybert/vimagit", -- emacs' magit ✨
@ -51,28 +52,44 @@ return {
},
{
"lukas-reineke/indent-blankline.nvim",
config = function()
require("indent_blankline").setup({
-- These require treesitter
-- show_current_context = true,
-- show_current_context_start = true,
})
end,
opts = {
-- These require treesitter
-- show_current_context = true,
-- show_current_context_start = true,
},
},
--- File type, syntax, language helper plugins ---
{
url = "https://git.sr.ht/~torresjrjr/gemini.vim",
-- ft = "gemini",
ft = "gemini",
},
{ "cespare/vim-toml", ft = "toml" },
{ "blankname/vim-fish", ft = "fish",
config = function ()
vim.opt_local.shiftwidth = 4
vim.opt_local.textwidth = 79
vim.opt_local.foldmethod = "expr"
vim.opt_local.expandtab = true
vim.opt_local.tabstop = 4
end,
},
{ "cespare/vim-toml", },
{ "blankname/vim-fish", },
{
url = "https://git.rawtext.club/slope-lang/slope-vim-syntax",
-- ft = "slope",
ft = "slope",
},
{ "mzlogin/vim-markdown-toc", ft = "markdown",
config = function ()
vim.opt_local.textwidth = 80
end
},
{ "leafo/moonscript-vim", ft = "moon",
config = function ()
vim.opt_local.tabstop = 2
vim.opt_local.softtabstop = 2
vim.opt_local.shiftwidth = 2
end
},
{ "mzlogin/vim-markdown-toc", },
{ "leafo/moonscript-vim", },
------ LSP and autopair plugins ------
-- This plugin below is really good, but whenever I'm on a commented line,
@ -108,7 +125,7 @@ return {
{ "hrsh7th/cmp-calc", dependencies = "hrsh7th/nvim-cmp" },
-- 😏 :smirk:
{ "hrsh7th/cmp-emoji", dependencies = "hrsh7th/nvim-cmp" },
{ "mtoohey31/cmp-fish", dependencies = "hrsh7th/nvim-cmp" },
{ "mtoohey31/cmp-fish", dependencies = "hrsh7th/nvim-cmp", ft="fish" },
{ "petertriho/cmp-git", dependencies = "hrsh7th/nvim-cmp" },
-- τ long live \tau
{ "kdheepak/cmp-latex-symbols", dependencies = "hrsh7th/nvim-cmp" },