Several changes to lvim config

This commit is contained in:
ItsDrike 2022-11-07 22:50:23 +01:00
parent 50efe01b09
commit 2bf1f949e4
No known key found for this signature in database
GPG key ID: B014E761034AF742
13 changed files with 257 additions and 555 deletions

View file

@ -9,11 +9,11 @@ vim.api.nvim_create_autocmd("BufReadPost", {
pattern = "*",
command = [[if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif]],
})
-- Highlight current line number
-- 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" })
-- vim.api.nvim_create_autocmd("BufRead", { pattern = "*.axml", command = "set ft=xml" })

View file

@ -1,4 +1,4 @@
-- keymappings [view all the defaults by pressing <leader>Lk]
-- keymappings (view all the lunarvim keybinds with <leader>Lk or list every mapping with :map)
lvim.leader = "space"
-- Common shortcuts
@ -7,7 +7,7 @@ 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>"
-- Moevements
-- Horizonal movements
lvim.keys.normal_mode["H"] = "^"
lvim.keys.normal_mode["L"] = "$"
@ -41,14 +41,6 @@ lvim.keys.normal_mode["<F10>"] = ":DapStepOver<CR>"
lvim.keys.normal_mode["<F11>"] = ":DapStepInto<CR>"
lvim.keys.normal_mode["<S-F11>"] = ":DapStepOut<CR>"
lvim.builtin.which_key.mappings["h"] = {
name = "+Hop",
w = { "<cmd>HopWord<CR>", "Word" },
p = { "<cmd>HopPattern<CR>", "Pattern" },
a = { "<cmd>HopAnywhere<CR>", "Anywhere" },
v = { "<cmd>HopVertical<CR>", "Vertical" },
}
-- Quick word replacing (use . for next word)
lvim.keys.normal_mode["cn"] = "*``cgn"
lvim.keys.normal_mode["cN"] = "*``cgN"

View file

@ -63,6 +63,6 @@ linters.setup {
-- 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" } },
{ command = "codespell", filetypes = { "javascript", "python", "lua" } },
{ command = "luacheck", filetypes = { "lua" } },
}

View file

@ -1,3 +1,4 @@
-- 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 }

View file

@ -4,7 +4,7 @@ vim.opt.listchars = { tab = " ", trail = "·" } -- Specify which characters t
-- Theme options
vim.opt.cursorline = true -- Highlight cursor line
vim.opt.laststatus = 2 -- Always show status line
-- vim.opt.laststatus = 2 -- Always show status line
vim.opt.relativenumber = true -- Use relative line numbers
vim.opt.wrap = true -- Allow line wrapping
@ -12,13 +12,41 @@ vim.opt.wrap = true -- Allow line wrapping
-- vim.opt.autoindent = true -- Enable automatic indenting
-- vim.opt.expandtab = true -- Expand tabs into spaces
-- vim.opt.tabstop = 2 -- Number of spaces a tab in file accounts for
-- vim.opt.shiftwidth = 4 -- Indentation size for Tab
-- vim.opt.shiftwidth = 4 -- Visual number of spaces inserted for each indentation
-- vim.opt.softtabstop = 4 -- Tabs/Spaces interlop
-- vim.opt.tabpagemax = 50 -- More tabs
-- vim.opt.shiftround = true -- Always round indent to multiple of shiftwidth
--
-- 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"

View file

@ -31,26 +31,18 @@ lvim.plugins = {
vim.cmd "let g:minimap_width = 10"
end,
},
{
-- Integrated lf file manager
"ptzz/lf.vim",
config = function()
vim.g.lf_map_keys = 0
end,
requires = "voldikss/vim-floaterm",
},
-- Github copilot for code completion
{
"zbirenbaum/copilot.lua",
event = { "VimEnter" },
config = function()
vim.defer_fn(function()
require("copilot").setup()
end, 100)
end,
},
{ "zbirenbaum/copilot-cmp", after = { "copilot.lua", "nvim-cmp" } },
-- {
-- "zbirenbaum/copilot.lua",
-- event = { "VimEnter" },
-- config = function()
-- vim.defer_fn(function()
-- require("copilot").setup()
-- end, 100)
-- end,
-- },
-- { "zbirenbaum/copilot-cmp", after = { "copilot.lua", "nvim-cmp" } },
--
{ "jasonccox/vim-wayland-clipboard" },
@ -97,5 +89,5 @@ lvim.plugins = {
}
-- Register copilot as cmp source
lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)"
table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" })
-- lvim.builtin.cmp.formatting.source_names["copilot"] = "(Copilot)"
-- table.insert(lvim.builtin.cmp.sources, 1, { name = "copilot" })

View file

@ -18,21 +18,21 @@ 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"
-- 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 treesitter
lvim.keys.normal_mode["gu"] = ":TSUpdate apparmor<CR>"