mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-12-25 20:54:34 +00:00
Remove old lunarvim confiuration
This commit is contained in:
parent
cc54b67635
commit
cf2ac68b64
|
@ -1,43 +0,0 @@
|
||||||
-- vim: ft=lua tw=80
|
|
||||||
|
|
||||||
stds.nvim = {
|
|
||||||
globals = {
|
|
||||||
"lvim",
|
|
||||||
vim = { fields = { "g" } },
|
|
||||||
"TERMINAL",
|
|
||||||
"USER",
|
|
||||||
"C",
|
|
||||||
"Config",
|
|
||||||
"WORKSPACE_PATH",
|
|
||||||
"JAVA_LS_EXECUTABLE",
|
|
||||||
"MUtils",
|
|
||||||
"USER_CONFIG_PATH",
|
|
||||||
os = { fields = { "capture" } },
|
|
||||||
},
|
|
||||||
read_globals = {
|
|
||||||
"jit",
|
|
||||||
"os",
|
|
||||||
"vim",
|
|
||||||
"join_paths",
|
|
||||||
"get_runtime_dir",
|
|
||||||
"get_config_dir",
|
|
||||||
"get_cache_dir",
|
|
||||||
"get_lvim_base_dir",
|
|
||||||
"require_clean",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
std = "lua51+nvim"
|
|
||||||
|
|
||||||
files["tests/*_spec.lua"].std = "lua51+nvim+busted"
|
|
||||||
|
|
||||||
-- Don't report unused self arguments of methods.
|
|
||||||
self = false
|
|
||||||
|
|
||||||
-- Rerun tests only if their modification time changed.
|
|
||||||
cache = true
|
|
||||||
|
|
||||||
ignore = {
|
|
||||||
"631", -- max_line_length
|
|
||||||
"212/_.*", -- unused argument, for vars with "_" prefix
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
column_width = 120
|
|
||||||
line_endings = "Unix"
|
|
||||||
indent_type = "Spaces"
|
|
||||||
indent_width = 2
|
|
||||||
quote_style = "AutoPreferDouble"
|
|
||||||
no_call_parentheses = true
|
|
|
@ -1,2 +0,0 @@
|
||||||
vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.lua", command = "setlocal shiftwidth=2" })
|
|
||||||
vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.lua", command = "setlocal tabstop=2" })
|
|
|
@ -1,2 +0,0 @@
|
||||||
vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.md", command = "setlocal tw=119" })
|
|
||||||
vim.api.nvim_create_autocmd("BufWinEnter", { pattern = "*.md", command = "SymbolsOutline" })
|
|
|
@ -1,2 +0,0 @@
|
||||||
-- local dap_install = require "dap-install"
|
|
||||||
-- dap_install.config("python", {})
|
|
|
@ -1,44 +0,0 @@
|
||||||
require "user.keys"
|
|
||||||
require "user.abbreviations"
|
|
||||||
require "user.lsp"
|
|
||||||
require "user.autocmds"
|
|
||||||
require "user.plugins"
|
|
||||||
require "user.options"
|
|
||||||
require "user.lualine"
|
|
||||||
require "user.treesitter"
|
|
||||||
|
|
||||||
-- TEMPORARY; Learn vim, the hard way
|
|
||||||
-- vim.opt.mouse = {}
|
|
||||||
-- lvim.keys.normal_mode["<Up>"] = ""
|
|
||||||
-- lvim.keys.normal_mode["<Down>"] = ""
|
|
||||||
-- lvim.keys.normal_mode["<Left>"] = ""
|
|
||||||
-- lvim.keys.normal_mode["<Right>"] = ""
|
|
||||||
-- lvim.keys.visual_mode["<Up>"] = ""
|
|
||||||
-- lvim.keys.visual_mode["<Down>"] = ""
|
|
||||||
-- lvim.keys.visual_mode["<Left>"] = ""
|
|
||||||
-- lvim.keys.visual_mode["<Right>"] = ""
|
|
||||||
-- lvim.keys.insert_mode["<Up>"] = ""
|
|
||||||
-- lvim.keys.insert_mode["<Down>"] = ""
|
|
||||||
-- lvim.keys.insert_mode["<Left>"] = ""
|
|
||||||
-- lvim.keys.insert_mode["<Right>"] = ""
|
|
||||||
|
|
||||||
|
|
||||||
-- General
|
|
||||||
lvim.log.level = "warn"
|
|
||||||
lvim.format_on_save = false
|
|
||||||
lvim.colorscheme = "onedarker"
|
|
||||||
-- lvim.colorscheme = "lunar"
|
|
||||||
|
|
||||||
-- to disable icons and use a minimalist setup, uncomment the following
|
|
||||||
-- lvim.use_icons = false
|
|
||||||
|
|
||||||
-- TODO: User Config for predefined plugins
|
|
||||||
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
|
|
||||||
lvim.builtin.dap.active = true
|
|
||||||
lvim.builtin.terminal.active = true
|
|
||||||
lvim.builtin.alpha.active = true
|
|
||||||
lvim.builtin.alpha.mode = "dashboard"
|
|
||||||
lvim.builtin.nvimtree.setup.view.side = "left"
|
|
||||||
--lvim.builtin.project.patterns = { ".git", ".svn" }
|
|
||||||
lvim.builtin.bufferline.options.always_show_bufferline = true
|
|
||||||
-- lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
|
|
|
@ -1,185 +0,0 @@
|
||||||
--[[
|
|
||||||
lvim is the global options object
|
|
||||||
|
|
||||||
Linters should be
|
|
||||||
filled in as strings with either
|
|
||||||
a global executable or a path to
|
|
||||||
an executable
|
|
||||||
]]
|
|
||||||
-- THESE ARE EXAMPLE CONFIGS FEEL FREE TO CHANGE TO WHATEVER YOU WANT
|
|
||||||
|
|
||||||
-- general
|
|
||||||
lvim.log.level = "warn"
|
|
||||||
lvim.format_on_save.enabled = false
|
|
||||||
lvim.colorscheme = "lunar"
|
|
||||||
-- to disable icons and use a minimalist setup, uncomment the following
|
|
||||||
-- lvim.use_icons = false
|
|
||||||
|
|
||||||
-- keymappings [view all the defaults by pressing <leader>Lk]
|
|
||||||
lvim.leader = "space"
|
|
||||||
-- add your own keymapping
|
|
||||||
lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
|
|
||||||
-- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>"
|
|
||||||
-- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>"
|
|
||||||
-- unmap a default keymapping
|
|
||||||
-- vim.keymap.del("n", "<C-Up>")
|
|
||||||
-- override a default keymapping
|
|
||||||
-- lvim.keys.normal_mode["<C-q>"] = ":q<cr>" -- or vim.keymap.set("n", "<C-q>", ":q<cr>" )
|
|
||||||
|
|
||||||
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
|
|
||||||
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
|
|
||||||
-- local _, actions = pcall(require, "telescope.actions")
|
|
||||||
-- lvim.builtin.telescope.defaults.mappings = {
|
|
||||||
-- -- for input mode
|
|
||||||
-- i = {
|
|
||||||
-- ["<C-j>"] = actions.move_selection_next,
|
|
||||||
-- ["<C-k>"] = actions.move_selection_previous,
|
|
||||||
-- ["<C-n>"] = actions.cycle_history_next,
|
|
||||||
-- ["<C-p>"] = actions.cycle_history_prev,
|
|
||||||
-- },
|
|
||||||
-- -- for normal mode
|
|
||||||
-- n = {
|
|
||||||
-- ["<C-j>"] = actions.move_selection_next,
|
|
||||||
-- ["<C-k>"] = actions.move_selection_previous,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- Change theme settings
|
|
||||||
-- lvim.builtin.theme.options.dim_inactive = true
|
|
||||||
-- lvim.builtin.theme.options.style = "storm"
|
|
||||||
|
|
||||||
-- Use which-key to add extra bindings with the leader-key prefix
|
|
||||||
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
|
|
||||||
-- lvim.builtin.which_key.mappings["t"] = {
|
|
||||||
-- name = "+Trouble",
|
|
||||||
-- r = { "<cmd>Trouble lsp_references<cr>", "References" },
|
|
||||||
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
|
|
||||||
-- d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
|
|
||||||
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
|
|
||||||
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
|
|
||||||
-- w = { "<cmd>Trouble workspace_diagnostics<cr>", "Workspace Diagnostics" },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- TODO: User Config for predefined plugins
|
|
||||||
-- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
|
|
||||||
lvim.builtin.alpha.active = true
|
|
||||||
lvim.builtin.alpha.mode = "dashboard"
|
|
||||||
lvim.builtin.terminal.active = true
|
|
||||||
lvim.builtin.nvimtree.setup.view.side = "left"
|
|
||||||
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false
|
|
||||||
|
|
||||||
-- if you don't want all the parsers change this to a table of the ones you want
|
|
||||||
lvim.builtin.treesitter.ensure_installed = {
|
|
||||||
"bash",
|
|
||||||
"c",
|
|
||||||
"javascript",
|
|
||||||
"json",
|
|
||||||
"lua",
|
|
||||||
"python",
|
|
||||||
"typescript",
|
|
||||||
"tsx",
|
|
||||||
"css",
|
|
||||||
"rust",
|
|
||||||
"java",
|
|
||||||
"yaml",
|
|
||||||
}
|
|
||||||
|
|
||||||
lvim.builtin.treesitter.ignore_install = { "haskell" }
|
|
||||||
lvim.builtin.treesitter.highlight.enable = true
|
|
||||||
|
|
||||||
-- generic LSP settings
|
|
||||||
|
|
||||||
-- -- make sure server will always be installed even if the server is in skipped_servers list
|
|
||||||
-- lvim.lsp.installer.setup.ensure_installed = {
|
|
||||||
-- "sumneko_lua",
|
|
||||||
-- "jsonls",
|
|
||||||
-- }
|
|
||||||
-- -- change UI setting of `LspInstallInfo`
|
|
||||||
-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
|
|
||||||
-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
|
|
||||||
-- lvim.lsp.installer.setup.ui.border = "rounded"
|
|
||||||
-- lvim.lsp.installer.setup.ui.keymaps = {
|
|
||||||
-- uninstall_server = "d",
|
|
||||||
-- toggle_server_expand = "o",
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- ---@usage disable automatic installation of servers
|
|
||||||
-- lvim.lsp.installer.setup.automatic_installation = false
|
|
||||||
|
|
||||||
-- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
|
|
||||||
-- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
|
|
||||||
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
|
|
||||||
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
|
|
||||||
-- require("lvim.lsp.manager").setup("pyright", opts)
|
|
||||||
|
|
||||||
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
|
|
||||||
-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
|
|
||||||
-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
|
|
||||||
-- return server ~= "emmet_ls"
|
|
||||||
-- end, lvim.lsp.automatic_configuration.skipped_servers)
|
|
||||||
|
|
||||||
-- -- you can set a custom on_attach function that will be used for all the language servers
|
|
||||||
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
|
|
||||||
-- lvim.lsp.on_attach_callback = function(client, bufnr)
|
|
||||||
-- local function buf_set_option(...)
|
|
||||||
-- vim.api.nvim_buf_set_option(bufnr, ...)
|
|
||||||
-- end
|
|
||||||
-- --Enable completion triggered by <c-x><c-o>
|
|
||||||
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
|
|
||||||
-- local formatters = require "lvim.lsp.null-ls.formatters"
|
|
||||||
-- formatters.setup {
|
|
||||||
-- { command = "black", filetypes = { "python" } },
|
|
||||||
-- { command = "isort", filetypes = { "python" } },
|
|
||||||
-- {
|
|
||||||
-- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
|
|
||||||
-- command = "prettier",
|
|
||||||
-- ---@usage arguments to pass to the formatter
|
|
||||||
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
|
|
||||||
-- extra_args = { "--print-with", "100" },
|
|
||||||
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
|
|
||||||
-- filetypes = { "typescript", "typescriptreact" },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- -- set additional linters
|
|
||||||
-- local linters = require "lvim.lsp.null-ls.linters"
|
|
||||||
-- linters.setup {
|
|
||||||
-- { command = "flake8", filetypes = { "python" } },
|
|
||||||
-- {
|
|
||||||
-- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
|
|
||||||
-- command = "shellcheck",
|
|
||||||
-- ---@usage arguments to pass to the formatter
|
|
||||||
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
|
|
||||||
-- extra_args = { "--severity", "warning" },
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- command = "codespell",
|
|
||||||
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
|
|
||||||
-- filetypes = { "javascript", "python" },
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- Additional Plugins
|
|
||||||
-- lvim.plugins = {
|
|
||||||
-- {
|
|
||||||
-- "folke/trouble.nvim",
|
|
||||||
-- cmd = "TroubleToggle",
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
|
|
||||||
-- vim.api.nvim_create_autocmd("BufEnter", {
|
|
||||||
-- pattern = { "*.json", "*.jsonc" },
|
|
||||||
-- -- enable wrap mode for json files only
|
|
||||||
-- command = "setlocal wrap",
|
|
||||||
-- })
|
|
||||||
-- vim.api.nvim_create_autocmd("FileType", {
|
|
||||||
-- pattern = "zsh",
|
|
||||||
-- callback = function()
|
|
||||||
-- -- let treesitter use bash highlight for zsh files as well
|
|
||||||
-- require("nvim-treesitter.highlight").attach(0, "bash")
|
|
||||||
-- end,
|
|
||||||
-- })
|
|
|
@ -1,11 +0,0 @@
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
|
||||||
|
|
||||||
autocmd({ "BufNewFile", "BufRead" }, {
|
|
||||||
pattern = { "/etc/apparmor.d/*" },
|
|
||||||
command = "setfiletype apparmor"
|
|
||||||
})
|
|
||||||
|
|
||||||
autocmd({ "BufNewFile", "BufRead" }, {
|
|
||||||
pattern = { "/usr/share/apparmor/extra-profiles/*" },
|
|
||||||
command = "setfiletype apparmor"
|
|
||||||
})
|
|
|
@ -1,6 +0,0 @@
|
||||||
local autocmd = vim.api.nvim_create_autocmd
|
|
||||||
|
|
||||||
autocmd({ "BufNewFile", "BufRead" }, {
|
|
||||||
pattern = { "*.axaml" },
|
|
||||||
command = "setfiletype xml"
|
|
||||||
})
|
|
|
@ -1,30 +0,0 @@
|
||||||
-- Define an abbreviation
|
|
||||||
local function abbrev(mode, input, result, reabbrev)
|
|
||||||
reabbrev = reabbrev or false
|
|
||||||
local command
|
|
||||||
if reabbrev then
|
|
||||||
command = mode .. "abbrev"
|
|
||||||
else
|
|
||||||
command = mode .. "noreabbrev"
|
|
||||||
end
|
|
||||||
vim.cmd(command .. " " .. input .. " " .. result)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- In case I have caps on (don't judge me for using caps)
|
|
||||||
abbrev("c", "Wq", "wq")
|
|
||||||
abbrev("c", "wQ", "wq")
|
|
||||||
abbrev("c", "WQ", "wq")
|
|
||||||
abbrev("c", "WQ!", "wq")
|
|
||||||
abbrev("c", "wQ!", "wq")
|
|
||||||
abbrev("c", "Wq!", "wq")
|
|
||||||
abbrev("c", "W", "w")
|
|
||||||
abbrev("c", "W!", "w!")
|
|
||||||
abbrev("c", "Q", "q!")
|
|
||||||
abbrev("c", "Q!", "q!")
|
|
||||||
abbrev("c", "Qall", "qall")
|
|
||||||
abbrev("c", "Qall!", "qall")
|
|
||||||
abbrev("c", "QALL", "qall")
|
|
||||||
abbrev("c", "QALL!", "qall")
|
|
||||||
|
|
||||||
-- Save file with sudo
|
|
||||||
abbrev("c", "w!!", "w !sudo tee > /dev/null %")
|
|
|
@ -1,17 +0,0 @@
|
||||||
-- Autocommands (https://neovim.io/doc/user/autocmd.html)
|
|
||||||
|
|
||||||
-- Delete all trailing whitespace on saving
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", { pattern = "*.py", command = [[%s/\s\+$//e]] })
|
|
||||||
-- Jump to last position when opening a file
|
|
||||||
vim.api.nvim_create_autocmd("BufReadPost", {
|
|
||||||
pattern = "*",
|
|
||||||
command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]],
|
|
||||||
})
|
|
||||||
-- Highlight current line number as blue
|
|
||||||
vim.api.nvim_create_autocmd("ColorScheme", { pattern = "*", command = "highlight CursorLine guibg=#2b2b2b" })
|
|
||||||
vim.api.nvim_create_autocmd("ColorScheme", {
|
|
||||||
pattern = "*",
|
|
||||||
command = "highlight CursorLineNr guifg=#1f85de ctermfg=LightBlue",
|
|
||||||
})
|
|
||||||
-- Custom syntax definitions based on file extensions
|
|
||||||
-- vim.api.nvim_create_autocmd("BufRead", { pattern = "*.axml", command = "set ft=xml" })
|
|
|
@ -1,119 +0,0 @@
|
||||||
-- keymappings (view all the lunarvim keybinds with <leader>Lk or list every mapping with :map)
|
|
||||||
lvim.leader = "space"
|
|
||||||
|
|
||||||
-- Common shortcuts
|
|
||||||
lvim.keys.normal_mode["<C-s>"] = ":w<CR>"
|
|
||||||
lvim.keys.insert_mode["<C-s>"] = "<Esc>:w<CR>i"
|
|
||||||
lvim.keys.normal_mode["<C-z>"] = ":undo<CR>"
|
|
||||||
lvim.keys.normal_mode["<C-y>"] = ":redo<CR>"
|
|
||||||
|
|
||||||
-- Horizontal movements
|
|
||||||
lvim.keys.normal_mode["H"] = "^"
|
|
||||||
lvim.keys.normal_mode["L"] = "$"
|
|
||||||
|
|
||||||
-- Moving through buffers
|
|
||||||
lvim.keys.normal_mode["<A-l>"] = ":BufferLineCycleNext<CR>"
|
|
||||||
lvim.keys.normal_mode["<A-h>"] = ":BufferLineCyclePrev<CR>"
|
|
||||||
lvim.keys.normal_mode["<A-L>"] = ":BufferLineMoveNext<CR>"
|
|
||||||
lvim.keys.normal_mode["<A-H>"] = ":BufferLineMovePrev<CR>"
|
|
||||||
|
|
||||||
-- Opening various menus
|
|
||||||
lvim.keys.normal_mode["<C-n>"] = ":NvimTreeFindFileToggle<CR>"
|
|
||||||
lvim.keys.normal_mode["<C-f>"] = ":Lf<CR>"
|
|
||||||
lvim.keys.normal_mode["<A-s>"] = ":SymbolsOutline<CR>"
|
|
||||||
|
|
||||||
-- Delete to void register
|
|
||||||
lvim.keys.visual_mode["<A-d>"] = '"_d'
|
|
||||||
lvim.keys.normal_mode["<A-d>"] = '"_d'
|
|
||||||
lvim.keys.visual_mode["<A-p>"] = '"_dP'
|
|
||||||
lvim.keys.visual_mode["p"] = '"_dP'
|
|
||||||
|
|
||||||
-- Remove highlight
|
|
||||||
lvim.keys.normal_mode["<esc><esc>"] = ":nohlsearch<cr>"
|
|
||||||
|
|
||||||
-- Debugger
|
|
||||||
lvim.keys.normal_mode["<F9>"] = ":DapToggleBreakpoint<CR>"
|
|
||||||
lvim.keys.normal_mode["<F5>"] = ":DapContinue<CR>"
|
|
||||||
lvim.keys.normal_mode["<F6>"] = ":DapToggleRepl<CR>"
|
|
||||||
lvim.keys.normal_mode["<S-F5>"] = ":DapTerminate<CR>"
|
|
||||||
lvim.keys.normal_mode["<F10>"] = ":DapStepOver<CR>"
|
|
||||||
lvim.keys.normal_mode["<F11>"] = ":DapStepInto<CR>"
|
|
||||||
lvim.keys.normal_mode["<S-F11>"] = ":DapStepOut<CR>"
|
|
||||||
|
|
||||||
-- Goto preview
|
|
||||||
lvim.keys.normal_mode["gpd"] = ":lua require('goto-preview').goto_preview_definition()<CR>"
|
|
||||||
lvim.keys.normal_mode["gpt"] = ":lua require('goto-preview').goto_preview_type_definition()<CR>"
|
|
||||||
lvim.keys.normal_mode["gpi"] = ":lua require('goto-preview').goto_preview_implementation()<CR>"
|
|
||||||
lvim.keys.normal_mode["gpr"] = ":lua require('goto-preview').goto_preview_references()<CR>"
|
|
||||||
lvim.keys.normal_mode["gP"] = ":lua require('goto-preview').close_all_win()<CR>"
|
|
||||||
|
|
||||||
|
|
||||||
-- Quick word replacing (use . for next word)
|
|
||||||
lvim.keys.normal_mode["cn"] = "*``cgn"
|
|
||||||
lvim.keys.normal_mode["cN"] = "*``cgN"
|
|
||||||
|
|
||||||
lvim.builtin.terminal.open_mapping = "<C-t>"
|
|
||||||
|
|
||||||
-- Quick replace all
|
|
||||||
vim.api.nvim_set_keymap("n", "<A-r>", "", {
|
|
||||||
noremap = true,
|
|
||||||
callback = function()
|
|
||||||
vim.fn.inputsave()
|
|
||||||
local query = vim.fn.input "To replace: "
|
|
||||||
|
|
||||||
vim.fn.inputsave()
|
|
||||||
local answer = vim.fn.input("Replace text: ", query)
|
|
||||||
vim.api.nvim_command("%s/\\V" .. query:gsub("/", "\\/") .. "/" .. answer:gsub("/", "\\/") .. "/")
|
|
||||||
vim.fn.inputrestore()
|
|
||||||
vim.api.nvim_feedkeys("v", "n", false)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
vim.api.nvim_set_keymap("v", "<A-r>", "", {
|
|
||||||
noremap = true,
|
|
||||||
callback = function()
|
|
||||||
local getselection = function()
|
|
||||||
return vim.fn.strcharpart(vim.fn.getline(vim.fn.line "."), vim.fn.min {
|
|
||||||
vim.fn.charcol ".",
|
|
||||||
vim.fn.charcol "v",
|
|
||||||
} - 1, vim.fn.abs(vim.fn.charcol "." - vim.fn.charcol "v") + 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
local query = getselection()
|
|
||||||
|
|
||||||
vim.fn.inputsave()
|
|
||||||
local answer = vim.fn.input("Replace text: ", query)
|
|
||||||
vim.api.nvim_command("%s/\\V" .. query:gsub("/", "\\/") .. "/" .. answer:gsub("/", "\\/") .. "/")
|
|
||||||
vim.fn.inputrestore()
|
|
||||||
vim.api.nvim_feedkeys("v", "n", false)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- Change Telescope navigation to use j and k for navigation and n and p for history in both input and normal mode.
|
|
||||||
-- we use protected-mode (pcall) just in case the plugin wasn't loaded yet.
|
|
||||||
-- local _, actions = pcall(require, "telescope.actions")
|
|
||||||
-- lvim.builtin.telescope.defaults.mappings = {
|
|
||||||
-- -- for input mode
|
|
||||||
-- i = {
|
|
||||||
-- ["<C-j>"] = actions.move_selection_next,
|
|
||||||
-- ["<C-k>"] = actions.move_selection_previous,
|
|
||||||
-- ["<C-n>"] = actions.cycle_history_next,
|
|
||||||
-- ["<C-p>"] = actions.cycle_history_prev,
|
|
||||||
-- },
|
|
||||||
-- -- for normal mode
|
|
||||||
-- n = {
|
|
||||||
-- ["<C-j>"] = actions.move_selection_next,
|
|
||||||
-- ["<C-k>"] = actions.move_selection_previous,
|
|
||||||
-- },
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- Use which-key to add extra bindings with the leader-key prefix
|
|
||||||
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" }
|
|
||||||
-- lvim.builtin.which_key.mappings["t"] = {
|
|
||||||
-- name = "+Trouble",
|
|
||||||
-- r = { "<cmd>Trouble lsp_references<cr>", "References" },
|
|
||||||
-- f = { "<cmd>Trouble lsp_definitions<cr>", "Definitions" },
|
|
||||||
-- d = { "<cmd>Trouble document_diagnostics<cr>", "Diagnostics" },
|
|
||||||
-- q = { "<cmd>Trouble quickfix<cr>", "QuickFix" },
|
|
||||||
-- l = { "<cmd>Trouble loclist<cr>", "LocationList" },
|
|
||||||
-- w = { "<cmd>Trouble workspace_diagnostics<cr>", "Workspace Diagnostics" },
|
|
||||||
-- }
|
|
|
@ -1,68 +0,0 @@
|
||||||
-- generic LSP settings
|
|
||||||
|
|
||||||
-- -- make sure server will always be installed even if the server is in skipped_servers list
|
|
||||||
-- lvim.lsp.installer.setup.ensure_installed = {
|
|
||||||
-- "sumeko_lua",
|
|
||||||
-- "jsonls",
|
|
||||||
-- }
|
|
||||||
-- -- change UI setting of `LspInstallInfo`
|
|
||||||
-- -- see <https://github.com/williamboman/nvim-lsp-installer#default-configuration>
|
|
||||||
-- lvim.lsp.installer.setup.ui.check_outdated_servers_on_open = false
|
|
||||||
-- lvim.lsp.installer.setup.ui.border = "rounded"
|
|
||||||
-- lvim.lsp.installer.setup.ui.keymaps = {
|
|
||||||
-- uninstall_server = "d",
|
|
||||||
-- toggle_server_expand = "o",
|
|
||||||
-- }
|
|
||||||
|
|
||||||
-- ---@usage disable automatic installation of servers
|
|
||||||
lvim.lsp.installer.setup.automatic_installation = false
|
|
||||||
|
|
||||||
-- ---configure a server manually. !!Requires `:LvimCacheReset` to take effect!!
|
|
||||||
-- ---see the full default list `:lua print(vim.inspect(lvim.lsp.automatic_configuration.skipped_servers))`
|
|
||||||
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" })
|
|
||||||
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
|
|
||||||
-- require("lvim.lsp.manager").setup("pyright", opts)
|
|
||||||
|
|
||||||
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. !!Requires `:LvimCacheReset` to take effect!!
|
|
||||||
-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype
|
|
||||||
-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server)
|
|
||||||
-- return server ~= "emmet_ls"
|
|
||||||
-- end, lvim.lsp.automatic_configuration.skipped_servers)
|
|
||||||
|
|
||||||
-- -- you can set a custom on_attach function that will be used for all the language servers
|
|
||||||
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
|
|
||||||
-- lvim.lsp.on_attach_callback = function(client, bufnr)
|
|
||||||
-- local function buf_set_option(...)
|
|
||||||
-- vim.api.nvim_buf_set_option(bufnr, ...)
|
|
||||||
-- end
|
|
||||||
-- --Enable completion triggered by <c-x><c-o>
|
|
||||||
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
-- set a formatter, this will override the language server formatting capabilities (if it exists)
|
|
||||||
lvim.format_on_save = false
|
|
||||||
local formatters = require "lvim.lsp.null-ls.formatters"
|
|
||||||
formatters.setup {
|
|
||||||
-- each formatter accepts a list of options identical to
|
|
||||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
|
|
||||||
{ command = "black", filetypes = { "python" } },
|
|
||||||
{ command = "isort", filetypes = { "python" } },
|
|
||||||
{
|
|
||||||
command = "prettier",
|
|
||||||
extra_args = { "--print-width", "100" },
|
|
||||||
filetypes = { "typescript", "typescriptreact" },
|
|
||||||
},
|
|
||||||
{ command = "stylua", filetypes = { "lua" } },
|
|
||||||
-- { command = "rustfmt", filetypes = { "rust" } },
|
|
||||||
}
|
|
||||||
|
|
||||||
-- set additional linters
|
|
||||||
local linters = require "lvim.lsp.null-ls.linters"
|
|
||||||
linters.setup {
|
|
||||||
-- Each linter accepts a list of options identical to
|
|
||||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
|
|
||||||
{ command = "flake8", filetypes = { "python" } },
|
|
||||||
{ command = "shellcheck", extra_args = { "--severity", "warning" } },
|
|
||||||
{ command = "codespell", filetypes = { "javascript", "python", "lua" } },
|
|
||||||
{ command = "luacheck", filetypes = { "lua" } },
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
-- Add location (row:col) to lualine
|
|
||||||
local components = require "lvim.core.lualine.components"
|
|
||||||
lvim.builtin.lualine.sections.lualine_z = { components.location }
|
|
||||||
lvim.builtin.lualine.sections.lualine_y = { components.progress }
|
|
|
@ -1,48 +0,0 @@
|
||||||
-- Show whitespaces
|
|
||||||
vim.opt.list = true -- Enable showing characters like <Tab>, <EOL>
|
|
||||||
vim.opt.listchars = { tab = " ", trail = "·" } -- Specify which characters to show
|
|
||||||
|
|
||||||
-- Theme options
|
|
||||||
vim.opt.cursorline = true -- Highlight cursor line
|
|
||||||
-- vim.opt.laststatus = 2 -- Always show status line
|
|
||||||
vim.opt.relativenumber = true -- Use relative line numbers
|
|
||||||
vim.opt.wrap = true -- Allow line wrapping
|
|
||||||
|
|
||||||
-- Tab/Indent settings
|
|
||||||
vim.opt.shiftwidth = 4 -- Number of spaces inserted for each indentation (>>, <<)
|
|
||||||
vim.opt.tabstop = 4 -- Number of spaces a tab in file accounts for
|
|
||||||
vim.opt.shiftround = true -- Always round indent to multiple of shiftwidth when indenting (>>, <<)
|
|
||||||
--
|
|
||||||
-- Enable syntax highlighting in fenced markdown code-blocks
|
|
||||||
vim.g.markdown_fenced_languages = {"html", "javascript", "typescript", "css", "scss", "lua", "vim", "python"}
|
|
||||||
|
|
||||||
-- Make vim transparent (removes background)
|
|
||||||
-- lvim.transparent_window = true
|
|
||||||
|
|
||||||
-- Configure formatoption
|
|
||||||
lvim.autocommands._formatoptions = {}
|
|
||||||
vim.opt.formatoptions = {
|
|
||||||
-- default: tcqj
|
|
||||||
t = true, -- Auto-wrap text using 'textwidth'
|
|
||||||
c = true, -- Auto-wrap comments using 'textwidth', inserting the comment leader automatically
|
|
||||||
r = false, -- Automatically insert the comment leader after hitting <Enter> in Insert mode
|
|
||||||
o = false, -- Automatically insert the comment leader after hitting 'o' or 'O' in Normal mode
|
|
||||||
q = true, -- Allow formatting of comments with "gq" (won't change blank lines)
|
|
||||||
w = false, -- Trailing whitespace continues paragraph in the next line, non-whitespace ends it
|
|
||||||
a = false, -- Automatic formatting of paragraph. Every time text is inserted/deleted, paragraph gets reformatted
|
|
||||||
n = false, -- Recognize numbered lists when wrapping.
|
|
||||||
["2"] = true, -- Use indent from 2nd line of a paragraph
|
|
||||||
v = false, -- Only break a line at a blank entered during current insert command
|
|
||||||
b = false, -- Like 'v', but only wrap on entering blank, or before the wrap margin
|
|
||||||
l = false, -- Long lines are not broken in insert mode
|
|
||||||
m = false, -- Also break at a multibyte character above 255
|
|
||||||
M = false, -- When joining lines, don't insert a space before, or after two multibyte chars (overruled by 'B')
|
|
||||||
B = false, -- When joining lines, don't insert a space between two multibyte chars (overruled by 'M')
|
|
||||||
["1"] = true, -- Break line before a single-letter word.
|
|
||||||
["]"] = false, -- Respect 'textwidth' rigorously, no line can be longer unless there's some except rule
|
|
||||||
j = true, -- Remove comment leader when joining lines, when it makes sense
|
|
||||||
p = false, -- Don't break lines at single spaces that follow periods (such as for Surely you're joking, Mr. Feynman!)
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Other
|
|
||||||
vim.opt.shell = "/bin/sh"
|
|
|
@ -1,124 +0,0 @@
|
||||||
lvim.plugins = {
|
|
||||||
-- LSP
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Tree-like view for symbols in current file using LSP
|
|
||||||
"simrat39/symbols-outline.nvim",
|
|
||||||
config = function()
|
|
||||||
require("symbols-outline").setup {
|
|
||||||
width = 18,
|
|
||||||
autofold_depth = 1,
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
-- Show function signature while typing
|
|
||||||
"ray-x/lsp_signature.nvim",
|
|
||||||
config = function()
|
|
||||||
require("lsp_signature").on_attach()
|
|
||||||
end,
|
|
||||||
event = "BufRead",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- User interface
|
|
||||||
|
|
||||||
-- Autocompletion
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Local AI completion helper
|
|
||||||
"tzachar/cmp-tabnine",
|
|
||||||
run = "./install.sh",
|
|
||||||
requires = "hrsh7th/nvim-cmp",
|
|
||||||
},
|
|
||||||
|
|
||||||
-- {
|
|
||||||
-- -- Github copilot for code completion
|
|
||||||
-- "zbirenbaum/copilot.lua",
|
|
||||||
-- event = { "VimEnter" },
|
|
||||||
-- config = function()
|
|
||||||
-- vim.defer_fn(function()
|
|
||||||
-- require("copilot").setup()
|
|
||||||
-- end, 100)
|
|
||||||
-- end,
|
|
||||||
-- },
|
|
||||||
-- {
|
|
||||||
-- -- Github compilot cmp source
|
|
||||||
-- "zbirenbaum/copilot-cmp",
|
|
||||||
-- after = { "copilot.lua", "nvim-cmp" }
|
|
||||||
-- },
|
|
||||||
|
|
||||||
|
|
||||||
-- Treesitter
|
|
||||||
|
|
||||||
-- {
|
|
||||||
-- -- Colorize matching parenthesis using treesitter
|
|
||||||
-- "p00f/nvim-ts-rainbow",
|
|
||||||
-- },
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Treesitter information shown directly in neovim
|
|
||||||
"nvim-treesitter/playground",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Alwats show class/function name we're in
|
|
||||||
"romgrk/nvim-treesitter-context",
|
|
||||||
config = function()
|
|
||||||
require("treesitter-context").setup {
|
|
||||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
|
||||||
throttle = true, -- Throttles plugin updates (may improve performance)
|
|
||||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
|
||||||
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
|
||||||
-- For all filetypes
|
|
||||||
-- Note that setting an entry here replaces all other patterns for this entry.
|
|
||||||
-- By setting the 'default' entry below, you can control which nodes you want to
|
|
||||||
-- appear in the context window.
|
|
||||||
default = {
|
|
||||||
"class",
|
|
||||||
"function",
|
|
||||||
"method",
|
|
||||||
"while",
|
|
||||||
"for",
|
|
||||||
"if",
|
|
||||||
"switch",
|
|
||||||
"case",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Other
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Code time & habit tracking
|
|
||||||
"wakatime/vim-wakatime"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Make clipboard work on wayland (using wl-copy)
|
|
||||||
"jasonccox/vim-wayland-clipboard"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- eww configuration language support
|
|
||||||
"elkowar/yuck.vim"
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
-- Goto preview (definition/implementation/references)
|
|
||||||
"rmagatti/goto-preview",
|
|
||||||
config = function()
|
|
||||||
require('goto-preview').setup {}
|
|
||||||
end
|
|
||||||
},
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
-- Register copilot as cmp source
|
|
||||||
-- lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)"
|
|
||||||
-- table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" })
|
|
||||||
|
|
||||||
-- Register tabnine as cmp source
|
|
||||||
lvim.builtin.cmp.formatting.source_names["tabnine"] = "(Tabnine)"
|
|
||||||
table.insert(lvim.builtin.cmp.sources, { name = "tabnine" })
|
|
|
@ -1,42 +0,0 @@
|
||||||
-- if you don't want all the parsers change this to a table of the ones you want
|
|
||||||
lvim.builtin.treesitter.ensure_installed = {
|
|
||||||
"bash",
|
|
||||||
"c",
|
|
||||||
"javascript",
|
|
||||||
"json",
|
|
||||||
"lua",
|
|
||||||
"python",
|
|
||||||
"typescript",
|
|
||||||
"tsx",
|
|
||||||
"css",
|
|
||||||
"rust",
|
|
||||||
"java",
|
|
||||||
"yaml",
|
|
||||||
}
|
|
||||||
|
|
||||||
lvim.builtin.treesitter.ignore_install = {}
|
|
||||||
lvim.builtin.treesitter.highlight.enabled = true
|
|
||||||
-- lvim.builtin.treesitter.rainbow.enable = true
|
|
||||||
|
|
||||||
-- local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
|
|
||||||
-- parser_config.apparmor = {
|
|
||||||
-- install_info = {
|
|
||||||
-- url = "~/Personal/Programming/GitHub/Other/tree-sitter-apparmor", -- local path or git repo
|
|
||||||
-- files = {"src/parser.c"},
|
|
||||||
-- -- optional entries:
|
|
||||||
-- branch = "main", -- default branch in case of git repo if different from master
|
|
||||||
-- generate_requires_npm = false, -- if stand-alone parser without npm dependencies
|
|
||||||
-- requires_generate_from_grammar = false, -- if folder contains pre-generated src/parser.c
|
|
||||||
-- },
|
|
||||||
-- filetype = "apparmor", -- if filetype does not match the parser name
|
|
||||||
-- }
|
|
||||||
--
|
|
||||||
-- local ft_to_parser = require"nvim-treesitter.parsers".filetype_to_parsername
|
|
||||||
-- ft_to_parser.apparmor = "apparmor"
|
|
||||||
|
|
||||||
-- Temporary mappings
|
|
||||||
-- lvim.keys.normal_mode["gu"] = ":TSUpdate apparmor<CR>"
|
|
||||||
-- lvim.keys.normal_mode["gU"] = ":TSToggle apparmor<CR>"
|
|
||||||
-- lvim.keys.normal_mode["gt"] = ":TSPlaygroundToggle<CR>"
|
|
||||||
-- lvim.keys.normal_mode["gh"] = ":TSNodeUnderCursor<CR>"
|
|
||||||
-- lvim.keys.normal_mode["gH"] = ":TSHighlightCapturesUnderCursor<CR>"
|
|
|
@ -1,15 +0,0 @@
|
||||||
{
|
|
||||||
"name": "nvim-snippets",
|
|
||||||
"author": "ItsDrike",
|
|
||||||
"engines": {
|
|
||||||
"vscode": "^1.11.0"
|
|
||||||
},
|
|
||||||
"contributes": {
|
|
||||||
"snippets": [
|
|
||||||
{
|
|
||||||
"language": "python",
|
|
||||||
"path": "./python.json"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
{
|
|
||||||
"future.__annotations__": {
|
|
||||||
"prefix": "futann",
|
|
||||||
"body": "from __future__ import annotations\n",
|
|
||||||
"description": "Add __future__.annoations import."
|
|
||||||
},
|
|
||||||
"script": {
|
|
||||||
"prefix": "script",
|
|
||||||
"body": [
|
|
||||||
"#!/usr/bin/env python3",
|
|
||||||
"",
|
|
||||||
"def main() -> None:",
|
|
||||||
"\t${1:...}",
|
|
||||||
"",
|
|
||||||
"",
|
|
||||||
"if __name__ == \"__main__\":",
|
|
||||||
"\tmain()"
|
|
||||||
],
|
|
||||||
"description": "print Hello, World!"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
Flake8
|
|
||||||
Isort
|
|
||||||
linter
|
|
||||||
flake8
|
|
||||||
isort
|
|
||||||
TOML
|
|
||||||
YAML
|
|
||||||
linters
|
|
||||||
MyPy
|
|
||||||
Pyright
|
|
||||||
pyright
|
|
||||||
VSCode
|
|
||||||
Pylance
|
|
||||||
Docstrings
|
|
||||||
Docstring
|
|
||||||
docstrings
|
|
||||||
docstring
|
|
||||||
BSPWM
|
|
||||||
Xmonad
|
|
||||||
deserialized
|
|
||||||
serializable
|
|
||||||
ItsDrike
|
|
||||||
itsdrike
|
|
||||||
protonmail
|
|
||||||
wireguard
|
|
||||||
Apparmor
|
|
Binary file not shown.
|
@ -1,283 +0,0 @@
|
||||||
" generated from apparmor.vim.in by create-apparmor.vim.py
|
|
||||||
" do not edit this file - edit apparmor.vim.in or create-apparmor.vim.py instead
|
|
||||||
|
|
||||||
" ----------------------------------------------------------------------
|
|
||||||
" Copyright (c) 2005 Novell, Inc. All Rights Reserved.
|
|
||||||
" Copyright (c) 2006-2012 Christian Boltz. All Rights Reserved.
|
|
||||||
"
|
|
||||||
" This program is free software; you can redistribute it and/or
|
|
||||||
" modify it under the terms of version 2 of the GNU General Public
|
|
||||||
" License as published by the Free Software Foundation.
|
|
||||||
"
|
|
||||||
" This program is distributed in the hope that it will be useful,
|
|
||||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
" GNU General Public License for more details.
|
|
||||||
"
|
|
||||||
" You should have received a copy of the GNU General Public License
|
|
||||||
" along with this program; if not, contact Novell, Inc.
|
|
||||||
"
|
|
||||||
" To contact Novell about this file by physical or electronic mail,
|
|
||||||
" you may find current contact information at www.novell.com.
|
|
||||||
"
|
|
||||||
" To contact Christian Boltz about this file by physical or electronic
|
|
||||||
" mail, you may find current contact information at www.cboltz.de/en/kontakt.
|
|
||||||
"
|
|
||||||
" If you want to report a bug via bugzilla.novell.com, please assign it
|
|
||||||
" to suse-beta[AT]cboltz.de (replace [AT] with @).
|
|
||||||
" ----------------------------------------------------------------------
|
|
||||||
"
|
|
||||||
" stick this file into ~/.vim/syntax/ and add these commands into your .vimrc
|
|
||||||
" to have vim automagically use this syntax file for these directories:
|
|
||||||
"
|
|
||||||
" autocmd BufNewFile,BufRead /etc/apparmor.d/* set syntax=apparmor
|
|
||||||
" autocmd BufNewFile,BufRead /usr/share/apparmor/extra-profiles/* set syntax=apparmor
|
|
||||||
|
|
||||||
" profiles are case sensitive
|
|
||||||
syntax case match
|
|
||||||
|
|
||||||
" color setup...
|
|
||||||
|
|
||||||
" adjust colors according to the background
|
|
||||||
|
|
||||||
" switching colors depending on the background color doesn't work
|
|
||||||
" unfortunately, so we use colors that work with light and dark background.
|
|
||||||
" Patches welcome ;-)
|
|
||||||
|
|
||||||
"if &background == "light"
|
|
||||||
" light background
|
|
||||||
hi sdProfileName ctermfg=lightblue
|
|
||||||
hi sdHatName ctermfg=darkblue
|
|
||||||
hi sdExtHat ctermfg=darkblue
|
|
||||||
" hi sdComment2 ctermfg=darkblue
|
|
||||||
hi sdGlob ctermfg=darkmagenta
|
|
||||||
hi sdAlias ctermfg=darkmagenta
|
|
||||||
hi sdEntryWriteExec ctermfg=black ctermbg=yellow
|
|
||||||
hi sdEntryUX ctermfg=darkred cterm=underline
|
|
||||||
hi sdEntryUXe ctermfg=darkred
|
|
||||||
hi sdEntryIX ctermfg=darkcyan
|
|
||||||
hi sdEntryM ctermfg=darkcyan
|
|
||||||
hi sdEntryPX ctermfg=darkgreen cterm=underline
|
|
||||||
hi sdEntryPXe ctermfg=darkgreen
|
|
||||||
hi sdEntryW ctermfg=darkyellow
|
|
||||||
hi sdCap ctermfg=lightblue
|
|
||||||
hi sdSetCap ctermfg=black ctermbg=yellow
|
|
||||||
hi sdNetwork ctermfg=lightblue
|
|
||||||
hi sdNetworkDanger ctermfg=darkred
|
|
||||||
hi sdCapKey cterm=underline ctermfg=lightblue
|
|
||||||
hi sdCapDanger ctermfg=darkred
|
|
||||||
hi sdRLimit ctermfg=lightblue
|
|
||||||
hi def link sdEntryR Normal
|
|
||||||
hi def link sdEntryK Normal
|
|
||||||
hi def link sdFlags Normal
|
|
||||||
hi sdEntryChangeProfile ctermfg=darkgreen cterm=underline
|
|
||||||
"else
|
|
||||||
" dark background
|
|
||||||
" hi sdProfileName ctermfg=white
|
|
||||||
" hi sdHatName ctermfg=white
|
|
||||||
" hi sdGlob ctermfg=magenta
|
|
||||||
" hi sdEntryWriteExec ctermfg=black ctermbg=yellow
|
|
||||||
" hi sdEntryUX ctermfg=red cterm=underline
|
|
||||||
" hi sdEntryUXe ctermfg=red
|
|
||||||
" hi sdEntryIX ctermfg=cyan
|
|
||||||
" hi sdEntryM ctermfg=cyan
|
|
||||||
" hi sdEntryPX ctermfg=green cterm=underline
|
|
||||||
" hi sdEntryPXe ctermfg=green
|
|
||||||
" hi sdEntryW ctermfg=yellow
|
|
||||||
" hi sdCap ctermfg=lightblue
|
|
||||||
" hi sdCapKey cterm=underline ctermfg=lightblue
|
|
||||||
" hi def link sdEntryR Normal
|
|
||||||
" hi def link sdFlags Normal
|
|
||||||
" hi sdCapDanger ctermfg=red
|
|
||||||
"endif
|
|
||||||
|
|
||||||
hi def link sdInclude Include
|
|
||||||
high def link sdComment Comment
|
|
||||||
"high def link sdComment2 Comment
|
|
||||||
high def link sdFlagKey TODO
|
|
||||||
high def link sdError ErrorMsg
|
|
||||||
|
|
||||||
|
|
||||||
" always sync from the start. should be relatively quick since we don't have
|
|
||||||
" that many rules and profiles shouldn't be _extremely_ large...
|
|
||||||
syn sync fromstart
|
|
||||||
|
|
||||||
syn keyword sdFlagKey complain debug
|
|
||||||
|
|
||||||
" highlight invalid syntax
|
|
||||||
syn match sdError /{/ contained
|
|
||||||
syn match sdError /}/
|
|
||||||
syn match sdError /^.*$/ contains=sdComment "highlight all non-valid lines as error
|
|
||||||
" TODO: do not mark lines containing only whitespace as error
|
|
||||||
|
|
||||||
" TODO: the sdGlob pattern is not anchored with ^ and $, so it matches all lines matching ^@{...}.*
|
|
||||||
" This allows incorrect lines also and should be checked better.
|
|
||||||
" This also (accidently ;-) includes variable definitions (@{FOO}=/bar)
|
|
||||||
" TODO: make a separate pattern for variable definitions, then mark sdGlob as contained
|
|
||||||
syn match sdGlob /\v\?|\*|\{.*,.*\}|[[^\]]\+\]|\@\{[a-zA-Z][a-zA-Z0-9_]*\}/
|
|
||||||
|
|
||||||
syn match sdAlias /\v^alias\s+(\/|\@\{\S*\})\S*\s+-\>\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob
|
|
||||||
|
|
||||||
" syn match sdComment /#.*/
|
|
||||||
|
|
||||||
syn cluster sdEntry contains=sdEntryWriteExec,sdEntryR,sdEntryW,sdEntryIX,sdEntryPX,sdEntryPXe,sdEntryUX,sdEntryUXe,sdEntryM,sdCap,sdSetCap,sdExtHat,sdRLimit,sdNetwork,sdNetworkDanger,sdEntryChangeProfile
|
|
||||||
|
|
||||||
|
|
||||||
" TODO: support audit and deny keywords for all rules (not only for files)
|
|
||||||
" TODO: higlight audit and deny keywords everywhere
|
|
||||||
|
|
||||||
" Capability line
|
|
||||||
|
|
||||||
" normal capabilities - really keep this list? syn match sdCap should be enough... (difference: sdCapKey words would loose underlining)
|
|
||||||
syn keyword sdCapKey audit_read block_suspend chown dac_override dac_read_search fowner fsetid ipc_lock ipc_owner kill lease linux_immutable mknod net_admin net_bind_service net_broadcast net_raw setfcap setgid setpcap setuid syslog sys_boot sys_chroot sys_nice sys_pacct sys_ptrace sys_resource sys_time sys_tty_config wake_alarm
|
|
||||||
|
|
||||||
" dangerous capabilities - highlighted separately
|
|
||||||
syn keyword sdCapDanger audit_control audit_write mac_override mac_admin set_fcap sys_admin sys_module sys_rawio
|
|
||||||
|
|
||||||
" full line. Keywords are from sdCapKey + sdCapDanger
|
|
||||||
syn match sdCap /\v^\s*(audit\s+)?(deny\s+|allow\s+)?capability\s+((audit_control|audit_read|audit_write|block_suspend|chown|dac_override|dac_read_search|fowner|fsetid|ipc_lock|ipc_owner|kill|lease|linux_immutable|mac_admin|mac_override|mknod|net_admin|net_bind_service|net_broadcast|net_raw|setfcap|setgid|setpcap|setuid|syslog|sys_admin|sys_boot|sys_chroot|sys_module|sys_nice|sys_pacct|sys_ptrace|sys_rawio|sys_resource|sys_time|sys_tty_config|wake_alarm)\s+)*(audit_control|audit_read|audit_write|block_suspend|chown|dac_override|dac_read_search|fowner|fsetid|ipc_lock|ipc_owner|kill|lease|linux_immutable|mac_admin|mac_override|mknod|net_admin|net_bind_service|net_broadcast|net_raw|setfcap|setgid|setpcap|setuid|syslog|sys_admin|sys_boot|sys_chroot|sys_module|sys_nice|sys_pacct|sys_ptrace|sys_rawio|sys_resource|sys_time|sys_tty_config|wake_alarm)\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdCapKey,sdCapDanger,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
" all capabilities ('capability' without any keyword)
|
|
||||||
syn match sdCapDanger /\v^\s*(audit\s+)?(deny\s+|allow\s+)?capability\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" Network line
|
|
||||||
" Syntax: network domain (inet, ...) type (stream, ...) protocol (tcp, ...)
|
|
||||||
" TODO: 'owner' isn't supported, but will be (JJ, 2011-01-11)
|
|
||||||
syn match sdNetwork /\v^\s*(audit\s+)?(deny\s+|allow\s+)?network(\s+(unix|inet|ax25|ipx|appletalk|netrom|bridge|atmpvc|x25|inet6|rose|netbeui|security|key|netlink|packet|ash|econet|atmsvc|rds|sna|irda|pppox|wanpipe|llc|can|tipc|bluetooth|iucv|rxrpc|isdn|phonet|ieee802154|caif|alg|nfc|vsock))?(\s+(stream|dgram|seqpacket|rdm|packet))?(\s+tcp|\s+udp|\s+icmp)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
" network rules containing 'raw'
|
|
||||||
syn match sdNetworkDanger /\v^\s*(audit\s+)?(deny\s+|allow\s+)?network(\s+(unix|inet|ax25|ipx|appletalk|netrom|bridge|atmpvc|x25|inet6|rose|netbeui|security|key|netlink|packet|ash|econet|atmsvc|rds|sna|irda|pppox|wanpipe|llc|can|tipc|bluetooth|iucv|rxrpc|isdn|phonet|ieee802154|caif|alg|nfc|vsock))?(\s+(raw))(\s+tcp|\s+udp|\s+icmp)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
" 'all networking' includes raw -> mark as dangerous
|
|
||||||
syn match sdNetworkDanger /\v^\s*(audit\s+)?(deny\s+|allow\s+)?network\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
|
|
||||||
" Change Profile
|
|
||||||
" TODO: audit and deny support will be added (JJ, 2011-01-11)
|
|
||||||
syn match sdEntryChangeProfile /\v^\s*change_profile\s+-\>\s+\S+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
|
|
||||||
" rlimit
|
|
||||||
" TODO: audit and deny support will be added (JJ, 2011-01-11)
|
|
||||||
"
|
|
||||||
"syn match sdRLimit /\v^\s*rlimit\s+()\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+(nofile|ofile|nproc|rtprio)\s+\<\=\s+[0-9]+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+(locks|sigpending)\s+\<\=\s+[0-9]+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+(fsize|data|stack|core|rss|as|memlock|msgqueue)\s+\<\=\s+[0-9]+([KMG]B)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+nice\s+\<\=\s+(-1?[0-9]|-20|1?[0-9])\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+cpu\s+\<\=\s+[0-9]+(seconds|minutes|hours|days)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+rttime\s+\<\=\s+[0-9]+(ms|seconds|minutes)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
syn match sdRLimit /\v^\s*set\s+rlimit\s+(cpu|rttime|nofile|nproc|rtprio|locks|sigpending|fsize|data|stack|core|rss|as|memlock|msgqueue|nice)\s+\<\=\s+infinity\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment
|
|
||||||
|
|
||||||
" link rules
|
|
||||||
syn match sdEntryW /\v^\s+(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?link\s+(subset\s+)?(\/|\@\{\S*\})\S*\s+-\>\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob
|
|
||||||
|
|
||||||
|
|
||||||
syn match sdExtHat /\v^\s+(\^|profile\s+)\S+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdComment " hat without {...}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
syn match sdProfileName /\v^((profile\s+)?\/\S+|profile\s+([a-zA-Z0-9]\S*\s)?\S+)\s+((flags\s*\=\s*)?\(\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted)(\s*,\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted))*\s*\)\s+)=\{/ contains=sdProfileStart,sdHatName,sdFlags,sdComment,sdGlob
|
|
||||||
syn match sdProfileStart /{/ contained
|
|
||||||
syn match sdProfileEnd /^}\s*(#.*)?$/ contained " TODO: syn region does not (yet?) allow usage of comment in end=
|
|
||||||
" TODO: Removing the $ mark from end= will allow non-comments also :-(
|
|
||||||
syn match sdHatName /\v^\s+(\^|profile\s+)\S+\s+((flags\s*\=\s*)?\(\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted)(\s*,\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted))*\s*\)\s+)=\{/ contains=sdProfileStart,sdFlags,sdComment
|
|
||||||
syn match sdHatStart /{/ contained
|
|
||||||
syn match sdHatEnd /}/ contained " TODO: allow comments + [same as for syn match sdProfileEnd]
|
|
||||||
syn match sdFlags /\v((flags\s*\=\s*)?\(\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted)(\s*,\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted))*\s*\)\s+)/ contained contains=sdFlagKey
|
|
||||||
|
|
||||||
syn match sdComment /\s*#.*$/
|
|
||||||
" NOTE: contains=sdComment changes #include highlighting to comment color.
|
|
||||||
" NOTE: Comment highlighting still works without contains=sdComment.
|
|
||||||
syn match sdInclude /\s*#include\s<\S*>/ " TODO: doesn't check until $
|
|
||||||
syn match sdInclude /\s*include\s<\S*>/ " TODO: doesn't check until $
|
|
||||||
|
|
||||||
" basic profile block...
|
|
||||||
" \s+ does not work in end=, therefore using \s\s*
|
|
||||||
syn region Normal start=/\v^(profile\s+)?\S+\s+((flags\s*\=\s*)?\(\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted)(\s*,\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted))*\s*\)\s+)=\{/ matchgroup=sdProfileEnd end=/^}\s*$/ contains=sdProfileName,Hat,@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn region Hat start=/\v^\s+(\^|profile\s+)\S+\s+((flags\s*\=\s*)?\(\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted)(\s*,\s*(complain|audit|attach_disconnected|no_attach_disconnected|chroot_attach|chroot_no_attach|chroot_relative|namespace_relative|mediate_deleted|delegate_deleted))*\s*\)\s+)=\{/ matchgroup=sdHatEnd end=/^\s\s*}\s*$/ contains=sdHatName,@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" file permissions
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
" file rules added with create_file_rule()
|
|
||||||
|
|
||||||
" write + exec/mmap - danger! (known bug: accepts aw to keep things simple)
|
|
||||||
syn match sdEntryWriteExec /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(l|r|w|a|m|k|[iuUpPcC]x)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryWriteExec /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(l|r|w|a|m|k|[iuUpPcC]x)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryWriteExec /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(l|r|w|a|m|k|[iuUpPcC]x)+(\s+-\>\s+\S+)?\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryWriteExec /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(l|r|w|a|m|k|[iuUpPcC]x)+(\s+-\>\s+\S+)?\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" ux(mr) - unconstrained entry, flag the line red. also includes pux which is unconstrained if no profile exists
|
|
||||||
syn match sdEntryUX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k|ux|pux)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryUX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k|ux|pux)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryUX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|ux|pux)+(\s+-\>\s+\S+)?\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryUX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|ux|pux)+(\s+-\>\s+\S+)?\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" Ux(mr) and PUx(mr) - like ux + clean environment
|
|
||||||
syn match sdEntryUXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k|Ux|PUx)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryUXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k|Ux|PUx)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryUXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|Ux|PUx)+(\s+-\>\s+\S+)?\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryUXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|Ux|PUx)+(\s+-\>\s+\S+)?\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" px/cx/pix/cix(mrk) - standard exec entry, flag the line blue
|
|
||||||
syn match sdEntryPX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k|px|cx|pix|cix)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryPX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k|px|cx|pix|cix)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryPX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|px|cx|pix|cix)+(\s+-\>\s+\S+)?\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryPX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|px|cx|pix|cix)+(\s+-\>\s+\S+)?\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" Px/Cx/Pix/Cix(mrk) - like px/cx + clean environment
|
|
||||||
syn match sdEntryPXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k|Px|Cx|Pix|Cix)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryPXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k|Px|Cx|Pix|Cix)+(\s+-\>\s+\S+)?\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryPXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|Px|Cx|Pix|Cix)+(\s+-\>\s+\S+)?\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryPXe /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|Px|Cx|Pix|Cix)+(\s+-\>\s+\S+)?\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" ix(mr) - standard exec entry, flag the line green
|
|
||||||
syn match sdEntryIX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k|ix)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryIX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k|ix)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryIX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|ix)+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryIX /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k|ix)+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" mr - mmap with PROT_EXEC
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k)+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(r|m|k)+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" special case: deny x is allowed (does not need to be ix, px, ux or cx)
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?deny\s+(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(r|m|k|x)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?deny\s+(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(r|m|k|x)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?deny\s+(owner\s+|other\s+)?(r|m|k|x)+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryM /\v^\s*(audit\s+)?deny\s+(owner\s+|other\s+)?(r|m|k|x)+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" write + append is an error
|
|
||||||
syn match sdError /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+\S*(w\S*a|a\S*w)\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdError /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+\S*(w\S*a|a\S*w)\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdError /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?\S*(w\S*a|a\S*w)\S*\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdError /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?\S*(w\S*a|a\S*w)\S*\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" write entry, flag the line yellow
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(l|r|w|k)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(l|r|w|k)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(l|r|w|k)+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(l|r|w|k)+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" append entry, flag the line yellow
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+(l|r|a|k)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+(l|r|a|k)+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(l|r|a|k)+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryW /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(l|r|a|k)+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" read entry + locking, currently no highlighting
|
|
||||||
syn match sdEntryK /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+[rlk]+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryK /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+[rlk]+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryK /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?[rlk]+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryK /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?[rlk]+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
||||||
" read entry, no highlighting
|
|
||||||
syn match sdEntryR /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?(\/|\@\{\S*\})\S*\s+[rl]+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryR /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?"(\/|\@\{\S*\})\S*"\s+[rl]+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryR /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?[rl]+\s+(\/|\@\{\S*\})\S*\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
syn match sdEntryR /\v^\s*(audit\s+)?(deny\s+|allow\s+)?(owner\s+|other\s+)?[rl]+\s+"(\/|\@\{\S*\})\S*"+\s*,(\s*$|(\s*#.*$)\@=)/ contains=sdGlob,sdComment nextgroup=@sdEntry,sdComment,sdError,sdInclude
|
|
||||||
|
|
Loading…
Reference in a new issue