Browse Source

feat: add blade syntax highlighting

master
Tovi Jaeschke-Rogers 4 months ago
parent
commit
4a839dd82d
5 changed files with 20 additions and 94 deletions
  1. +0
    -5
      .config/nvim/lua/tovi/core/autocmd.lua
  2. +1
    -0
      .config/nvim/lua/tovi/plugins/linting.lua
  3. +15
    -88
      .config/nvim/lua/tovi/plugins/nvim-treesitter.lua
  4. +3
    -0
      .config/nvim/lua/tovi/plugins/vim-blade.lua
  5. +1
    -1
      .zshrc

+ 0
- 5
.config/nvim/lua/tovi/core/autocmd.lua View File

@ -54,11 +54,6 @@ local aucmd_dict = {
vim.opt_local.syntax = 'dockerfile'
end
},
{
pattern = { '*.blade.php' },
command = [[set syntax=html]],
},
},
VimLeave = {


+ 1
- 0
.config/nvim/lua/tovi/plugins/linting.lua View File

@ -64,6 +64,7 @@ return {
golang = { "gospell", "golangci-lint" },
python = { "pylint" },
dockerfile = { "hadolint" },
blade = { "phpcs" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", {


+ 15
- 88
.config/nvim/lua/tovi/plugins/nvim-treesitter.lua View File

@ -5,7 +5,6 @@ return {
build = ":TSUpdate",
dependencies = {
"windwp/nvim-ts-autotag",
"nvim-treesitter/nvim-treesitter-textobjects",
},
config = function()
-- import nvim-treesitter plugin
@ -41,6 +40,7 @@ return {
"dockerfile",
"gitignore",
"php",
"blade",
},
-- enable nvim-ts-context-commentstring plugin for commenting tsx and jsx
context_commentstring = {
@ -49,97 +49,24 @@ return {
},
-- auto install above language parsers
auto_install = true,
textobjects = {
select = {
enable = true,
-- Automatically jump forward to textobj, similar to targets.vim
lookahead = true,
keymaps = {
-- You can use the capture groups defined in textobjects.scm
["aa"] = "@parameter.outer",
["ia"] = "@parameter.inner",
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@class.outer",
["ic"] = "@class.inner",
["ab"] = "@block.outer",
["ib"] = "@block.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
["am"] = "@call.outer",
["im"] = "@call.inner",
["ai"] = "@conditional.outer",
["ii"] = "@conditional.inner",
},
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise
},
include_surrounding_whitespace = true,
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
["]m"] = "@function.outer",
["]]"] = "@class.outer",
},
goto_next_end = {
["]M"] = "@function.outer",
["]["] = "@class.outer",
},
goto_previous_start = {
["[m"] = "@function.outer",
["[["] = "@class.outer",
},
goto_previous_end = {
["[M"] = "@function.outer",
["[]"] = "@class.outer",
},
goto_next = {
["]i"] = "@conditional.outer",
["]l"] = "@loop.outer",
},
goto_previous = {
["[i"] = "@conditional.outer",
["[l"] = "@loop.outer",
}
},
swap = {
enable = true,
swap_next = {
["<leader>s"] = "@parameter.inner",
},
swap_previous = {
["<leader>S"] = "@parameter.inner",
},
},
},
})
local ts_repeat_move = require("nvim-treesitter.textobjects.repeatable_move")
local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
local keymap = vim.keymap
-- vim way: ; goes to the direction you were moving.
keymap.set({ "n", "x", "o" }, ";", ts_repeat_move.repeat_last_move)
keymap.set({ "n", "x", "o" }, ",", ts_repeat_move.repeat_last_move_opposite)
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = { "src/parser.c" },
branch = "main",
},
filetype = "blade"
}
-- Optionally, make builtin f, F, t, T also repeatable with ; and ,
keymap.set({ "n", "x", "o" }, "f", ts_repeat_move.builtin_f)
keymap.set({ "n", "x", "o" }, "F", ts_repeat_move.builtin_F)
keymap.set({ "n", "x", "o" }, "t", ts_repeat_move.builtin_t)
keymap.set({ "n", "x", "o" }, "T", ts_repeat_move.builtin_T)
vim.filetype.add({
pattern = {
['.*%.blade%.php'] = 'blade',
}
})
end,
},
}

+ 3
- 0
.config/nvim/lua/tovi/plugins/vim-blade.lua View File

@ -0,0 +1,3 @@
return {
'jwalton512/vim-blade'
}

+ 1
- 1
.zshrc View File

@ -68,7 +68,7 @@ HISTFILE=${ZDOTDIR:-$HOME}/.zsh_history
HISTSIZE=99999999
SAVEHIST=$HISTSIZE
export PATH="~/.local/bin/:$PATH"
export PATH="${HOME}/.local/bin/:${HOME}/.cargo/bin:$PATH"
if [[ $(uname) == 'Darwin' ]]; then
fi


Loading…
Cancel
Save