Switch nvim to astronvim

This commit is contained in:
Tobias Reisinger 2024-02-25 18:53:24 +01:00
parent a1d2535956
commit 6ec64f09c8
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
31 changed files with 414 additions and 319 deletions

View file

@ -4,6 +4,7 @@ declare -A mapper=(
[".e"]="$HOME/.bin/.e" [".e"]="$HOME/.bin/.e"
[".t"]="$HOME/.bin/.t" [".t"]="$HOME/.bin/.t"
["alacritty"]="$HOME/.config/alacritty/alacritty.toml" ["alacritty"]="$HOME/.config/alacritty/alacritty.toml"
["astronvim"]="$HOME/.config/astronvim/lua/user/init.lua"
["autoinstall.toml"]="$HOME/.config/autoinstall.toml" ["autoinstall.toml"]="$HOME/.config/autoinstall.toml"
["autostart.toml"]="$HOME/.config/autostart.toml" ["autostart.toml"]="$HOME/.config/autostart.toml"
["backup"]="$HOME/.bin/host-backup-$(cat /proc/sys/kernel/hostname)" ["backup"]="$HOME/.bin/host-backup-$(cat /proc/sys/kernel/hostname)"

View file

@ -0,0 +1,18 @@
-- Global objects
globals = {
"astronvim",
"astronvim_installation",
"vim",
"bit",
}
-- Rerun tests only if their modification time changed
cache = true
-- Don't report unused self arguments of methods
self = false
ignore = {
"631", -- max_line_length
"212/_.*", -- unused argument, for vars with "_" prefix
}

View file

@ -0,0 +1,20 @@
{
"neodev": {
"library": {
"enabled": true,
"plugins": true
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
},
"lspconfig": {
"lua_ls": {
"Lua.format.enable": false
}
}
}

View file

@ -0,0 +1,7 @@
column_width = 120
line_endings = "Unix"
indent_type = "Spaces"
indent_width = 2
quote_style = "AutoPreferDouble"
call_parentheses = "None"
collapse_simple_statement = "Always"

View file

@ -0,0 +1,36 @@
# AstroNvim User Configuration Example
A user configuration template for [AstroNvim](https://github.com/AstroNvim/AstroNvim)
## 🛠️ Installation
#### Make a backup of your current nvim and shared folder
```shell
mv ~/.config/nvim ~/.config/nvim.bak
mv ~/.local/share/nvim ~/.local/share/nvim.bak
```
#### Clone AstroNvim
```shell
git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim
```
#### Create a new user repository from this template
Press the "Use this template" button above to create a new repository to store your user configuration.
You can also just clone this repository directly if you do not want to track your user configuration in GitHub.
#### Clone the repository
```shell
git clone https://github.com/<your_user>/<your_repository> ~/.config/nvim/lua/user
```
#### Start Neovim
```shell
nvim
```

View file

@ -0,0 +1,3 @@
return { -- a table of overrides/changes to the duskfox theme
Normal = { bg = "#000000" },
}

View file

@ -0,0 +1,3 @@
return { -- this table overrides highlights in all themes
-- Normal = { bg = "#000000" },
}

View file

@ -0,0 +1,85 @@
return {
-- Configure AstroNvim updates
updater = {
remote = "origin", -- remote to use
channel = "stable", -- "stable" or "nightly"
version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY)
branch = "nightly", -- branch name (NIGHTLY ONLY)
commit = nil, -- commit hash (NIGHTLY ONLY)
pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only)
skip_prompts = false, -- skip prompts about breaking changes
show_changelog = true, -- show the changelog after performing an update
auto_quit = false, -- automatically quit the current session after a successful update
remotes = { -- easily add new remotes to track
-- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url
-- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut,
-- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork
},
},
-- Set colorscheme to use
colorscheme = "dracula",
-- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on
diagnostics = {
virtual_text = true,
underline = true,
},
lsp = {
-- customize lsp formatting options
formatting = {
-- control auto formatting on save
format_on_save = {
enabled = true, -- enable or disable format on save globally
allow_filetypes = { -- enable format on save for specified filetypes only
-- "go",
},
ignore_filetypes = { -- disable format on save for specified filetypes
-- "python",
},
},
disabled = { -- disable formatting capabilities for the listed language servers
-- disable lua_ls formatting capability if you want to use StyLua to format your lua code
-- "lua_ls",
},
timeout_ms = 1000, -- default format timeout
-- filter = function(client) -- fully override the default formatting function
-- return true
-- end
},
-- enable servers that you already have installed without mason
servers = {
-- "pyright"
},
},
-- Configure require("lazy").setup() options
lazy = {
defaults = { lazy = true },
performance = {
rtp = {
-- customize default disabled vim plugins
disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" },
},
},
},
-- This function is run last and is a good place to configuring
-- augroups/autocommands and custom filetypes also this just pure lua so
-- anything that doesn't fit in the normal config locations above can go here
polish = function()
-- Set up custom filetypes
-- vim.filetype.add {
-- extension = {
-- foo = "fooscript",
-- },
-- filename = {
-- ["Foofile"] = "fooscript",
-- },
-- pattern = {
-- ["~/%.config/foo/.*"] = "fooscript",
-- },
-- }
end,
}

View file

@ -0,0 +1,40 @@
-- Mapping data with "desc" stored directly by vim.keymap.set().
--
-- Please use this mappings table to set keyboard mapping since this is the
-- lower level configuration and more robust one. (which-key will
-- automatically pick-up stored data by this setting.)
return {
-- first key is the mode
n = {
-- second key is the lefthand side of the map
-- navigate buffer tabs with `H` and `L`
-- L = {
-- function() require("astronvim.utils.buffer").nav(vim.v.count > 0 and vim.v.count or 1) end,
-- desc = "Next buffer",
-- },
-- H = {
-- function() require("astronvim.utils.buffer").nav(-(vim.v.count > 0 and vim.v.count or 1)) end,
-- desc = "Previous buffer",
-- },
-- mappings seen under group name "Buffer"
["<leader>bD"] = {
function()
require("astronvim.utils.status").heirline.buffer_picker(
function(bufnr) require("astronvim.utils.buffer").close(bufnr) end
)
end,
desc = "Pick to close",
},
-- tables with the `name` key will be registered with which-key if it's installed
-- this is useful for naming menus
["<leader>b"] = { name = "Buffers" },
-- quick save
-- ["<C-s>"] = { ":w!<cr>", desc = "Save File" }, -- change description but the same command
},
t = {
-- setting a mapping to false will disable it
-- ["<esc>"] = false,
},
}

View file

@ -0,0 +1,38 @@
-- set vim options here (vim.<first_key>.<second_key> = value)
return {
opt = {
-- set to true or false etc.
clipboard = "", -- disable direct connection to the system clipboard
relativenumber = true, -- sets vim.opt.relativenumber
number = true, -- sets vim.opt.number
shiftwidth = 2, -- number of space inserted for indentation
spell = false, -- sets vim.opt.spell
signcolumn = "auto", -- sets vim.opt.signcolumn to auto
wrap = false, -- sets vim.opt.wrap
},
g = {
mapleader = " ", -- sets vim.g.mapleader
autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled)
cmp_enabled = true, -- enable completion at start
autopairs_enabled = true, -- enable autopairs at start
diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on)
icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing)
ui_notifications_enabled = true, -- disable notifications when toggling UI elements
resession_enabled = true, -- enable experimental resession.nvim session management (will be default in AstroNvim v4)
git_worktrees = {
{
toplevel = vim.env.HOME,
gitdir = vim.env.HOME .. "/.local/share/yadm/repo.git"
},
},
},
}
-- If you need more control, you can use the function()...end notation
-- return function(local_vim)
-- local_vim.opt.relativenumber = true
-- local_vim.g.mapleader = " "
-- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list
-- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list
--
-- return local_vim
-- end

View file

@ -0,0 +1,9 @@
return {
-- Add the community repository of plugin specifications
"AstroNvim/astrocommunity",
-- example of importing a plugin, comment out to use it or add your own
-- available plugins can be found at https://github.com/AstroNvim/astrocommunity
{ import = "astrocommunity.colorscheme.dracula-nvim" },
-- { import = "astrocommunity.completion.copilot-lua-cmp" },
}

View file

@ -0,0 +1,77 @@
return {
-- customize alpha options
{
"goolord/alpha-nvim",
opts = function(_, opts)
-- customize the dashboard header
opts.section.header.val = {
" █████ ███████ ████████ ██████ ██████",
"██ ██ ██ ██ ██ ██ ██ ██",
"███████ ███████ ██ ██████ ██ ██",
"██ ██ ██ ██ ██ ██ ██ ██",
"██ ██ ███████ ██ ██ ██ ██████",
" ",
" ███  ██ ██  ██ ██ ███  ███",
" ████  ██ ██  ██ ██ ████  ████",
" ██ ██  ██ ██  ██ ██ ██ ████ ██",
" ██  ██ ██  ██  ██  ██ ██  ██  ██",
" ██   ████   ████   ██ ██  ██",
}
return opts
end,
},
-- You can disable default plugins as follows:
-- { "max397574/better-escape.nvim", enabled = false },
--
-- You can also easily customize additional setup of plugins that is outside of the plugin's setup call
-- {
-- "L3MON4D3/LuaSnip",
-- config = function(plugin, opts)
-- require "plugins.configs.luasnip"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- add more custom luasnip configuration such as filetype extend or custom snippets
-- local luasnip = require "luasnip"
-- luasnip.filetype_extend("javascript", { "javascriptreact" })
-- end,
-- },
-- {
-- "windwp/nvim-autopairs",
-- config = function(plugin, opts)
-- require "plugins.configs.nvim-autopairs"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- add more custom autopairs configuration such as custom rules
-- local npairs = require "nvim-autopairs"
-- local Rule = require "nvim-autopairs.rule"
-- local cond = require "nvim-autopairs.conds"
-- npairs.add_rules(
-- {
-- Rule("$", "$", { "tex", "latex" })
-- -- don't add a pair if the next character is %
-- :with_pair(cond.not_after_regex "%%")
-- -- don't add a pair if the previous character is xxx
-- :with_pair(
-- cond.not_before_regex("xxx", 3)
-- )
-- -- don't move right when repeat character
-- :with_move(cond.none())
-- -- don't delete if the next character is xx
-- :with_del(cond.not_after_regex "xx")
-- -- disable adding a newline when you press <cr>
-- :with_cr(cond.none()),
-- },
-- -- disable for .vim files, but it work for another filetypes
-- Rule("a", "a", "-vim")
-- )
-- end,
-- },
-- By adding to the which-key config and using our helper function you can add more which-key registered bindings
-- {
-- "folke/which-key.nvim",
-- config = function(plugin, opts)
-- require "plugins.configs.which-key"(plugin, opts) -- include the default astronvim config that calls the setup call
-- -- Add bindings which show up as group name
-- local wk = require "which-key"
-- wk.register({
-- b = { name = "Buffer" },
-- }, { mode = "n", prefix = "<leader>" })
-- end,
-- },
}

View file

@ -0,0 +1,36 @@
-- customize mason plugins
return {
-- use mason-lspconfig to configure LSP installations
{
"williamboman/mason-lspconfig.nvim",
-- overrides `require("mason-lspconfig").setup(...)`
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
-- "lua_ls",
})
end,
},
-- use mason-null-ls to configure Formatters/Linter installation for null-ls sources
{
"jay-babu/mason-null-ls.nvim",
-- overrides `require("mason-null-ls").setup(...)`
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
-- "prettier",
-- "stylua",
})
end,
},
{
"jay-babu/mason-nvim-dap.nvim",
-- overrides `require("mason-nvim-dap").setup(...)`
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
-- "python",
})
end,
},
}

View file

@ -0,0 +1,17 @@
return {
"jose-elias-alvarez/null-ls.nvim",
opts = function(_, config)
-- config variable is the default configuration table for the setup function call
-- local null_ls = require "null-ls"
-- Check supported formatters and linters
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
config.sources = {
-- Set a formatter
-- null_ls.builtins.formatting.stylua,
-- null_ls.builtins.formatting.prettier,
}
return config -- return final config table
end,
}

View file

@ -0,0 +1,9 @@
return {
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
-- add more things to the ensure_installed table protecting against community packs modifying it
opts.ensure_installed = require("astronvim.utils").list_insert_unique(opts.ensure_installed, {
-- "lua"
})
end,
}

View file

@ -0,0 +1,12 @@
return {
-- You can also add new plugins here as well:
-- Add plugins, the lazy syntax
-- "andweeb/presence.nvim",
-- {
-- "ray-x/lsp_signature.nvim",
-- event = "BufRead",
-- config = function()
-- require("lsp_signature").setup()
-- end,
-- },
}

View file

@ -7,9 +7,9 @@ groups = ["base"]
[[autoinstall]] [[autoinstall]]
type = "git" type = "git"
source = "https://github.com/wbthomason/packer.nvim" source = "https://github.com/AstroNvim/AstroNvim"
target = "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" target = "$HOME/.config/nvim"
hook = '[ -x "$(command -v nvim)" ] && nvim --headless -c "autocmd User PackerComplete quitall" -c "PackerSync"' hook = '[ -x "$(command -v nvim)" ] && nvim --headless +q'
groups = ["base"] groups = ["base"]
[[autoinstall]] [[autoinstall]]

View file

@ -1 +0,0 @@
init.lua

View file

@ -1,8 +0,0 @@
local dracula = require("dracula")
dracula.setup({
-- show the '~' characters after the end of buffers
show_end_of_buffer = true, -- default false
-- use transparent background
transparent_bg = true, -- default false
})
vim.cmd('colorscheme dracula')

View file

@ -1 +0,0 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)

View file

@ -1,67 +0,0 @@
local lsp = require("lsp-zero")
lsp.preset("recommended")
lsp.ensure_installed({
'bashls',
'lua_ls',
'yamlls',
})
-- Fix Undefined global 'vim'
require('lspconfig').lua_ls.setup({
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})
local cmp = require('cmp')
local cmp_select = { behavior = cmp.SelectBehavior.Select }
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
})
cmp_mappings['<Tab>'] = nil
cmp_mappings['<S-Tab>'] = nil
lsp.setup_nvim_cmp({
mapping = cmp_mappings
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})
lsp.on_attach(function(client, bufnr)
local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
end)
lsp.setup()
vim.diagnostic.config({
virtual_text = true
})

View file

@ -1,41 +0,0 @@
local function window()
return vim.api.nvim_win_get_number(0)
end
require('lualine').setup({
options = {
icons_enabled = true,
theme = 'dracula',
},
sections = {
lualine_a = { 'mode' },
lualine_b = { 'branch', 'diff', 'diagnostics' },
lualine_c = { {
'filename',
path = 1,
} },
lualine_x = { 'encoding', '%<0x%B', 'filesize', 'fileformat' },
lualine_y = { 'filetype' },
lualine_z = { 'location', window }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { 'filename' },
lualine_x = { 'location', window },
lualine_y = {},
lualine_z = {}
},
tabline = {
lualine_a = { {
'tabs',
max_length = vim.o.columns / 2,
mode = 2
} },
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = { 'branch' },
lualine_z = {}
}
})

View file

@ -1,6 +0,0 @@
local swap = require('sibling-swap')
swap.setup({
use_default_keymaps = true
})
vim.keymap.set('n', 'g<', swap.swap_with_left, {})
vim.keymap.set('n', 'g>', swap.swap_with_right, {})

View file

@ -1,7 +0,0 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
vim.keymap.set('n', '<leader>pg', builtin.git_files, {})
vim.keymap.set('n', '<leader>ps', function()
builtin.grep_string({ search = vim.fn.input("Grep > ") })
end)
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})

View file

@ -1,21 +0,0 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "pkl", "query", "vim", "vimdoc" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
}

View file

@ -1 +0,0 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)

View file

@ -1,67 +0,0 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
vim.cmd [[packadd packer.nvim]]
return require('packer').startup(function(use)
-- Packer can manage itself
use('wbthomason/packer.nvim')
use({
'nvim-telescope/telescope.nvim',
tag = '0.1.0',
requires = { { 'nvim-lua/plenary.nvim' } }
})
use({
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate'
})
use("apple/pkl-neovim")
use("github/copilot.vim")
use("mbbill/undotree")
use("Wansmer/sibling-swap.nvim")
use({
'VonHeikemen/lsp-zero.nvim',
branch = 'v1.x',
requires = {
-- LSP Support
{ 'neovim/nvim-lspconfig' },
{ 'williamboman/mason.nvim' },
{ 'williamboman/mason-lspconfig.nvim' },
-- Autocompletion
{ 'hrsh7th/nvim-cmp' },
{ 'hrsh7th/cmp-buffer' },
{ 'hrsh7th/cmp-path' },
{ 'saadparwaiz1/cmp_luasnip' },
{ 'hrsh7th/cmp-nvim-lsp' },
{ 'hrsh7th/cmp-nvim-lua' },
-- Snippets
{ 'L3MON4D3/LuaSnip' },
{ 'rafamadriz/friendly-snippets' },
}
})
use({
'lewis6991/gitsigns.nvim',
config = function()
require('gitsigns').setup()
end
})
use({
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
})
use('Mofiqul/dracula.nvim')
local wakatime_api_key = os.getenv("WAKATIME_API_KEY")
if wakatime_api_key then
use('wakatime/vim-wakatime')
end
end)

View file

@ -1,26 +0,0 @@
vim.g.mapleader = " "
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
-- keep cursor centered in screen
vim.keymap.set("n", "<C-d>", "<C-d>zz")
vim.keymap.set("n", "<C-u>", "<C-u>zz")
vim.keymap.set("n", "n", "nzzzv")
vim.keymap.set("n", "N", "Nzzzv")
-- paste, but don't overwrite buffer
vim.keymap.set("x", "<leader>p", "\"_dP")
vim.keymap.set("n", "<CR>", "<cmd>noh<CR><CR>")
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])

View file

@ -1,47 +0,0 @@
vim.opt.guicursor = ""
vim.opt.nu = true
vim.opt.relativenumber = true
vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = false
vim.opt.splitbelow = true
vim.opt.splitright = true
vim.opt.smartindent = true
vim.opt.wrap = false
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.cache/vim/undo"
vim.opt.undofile = true
vim.opt.hlsearch = true
vim.opt.incsearch = true
vim.opt.wildmode = "longest,list,full"
vim.opt.termguicolors = true
vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50
vim.opt.colorcolumn = "80"
vim.opt.foldenable = false
vim.api.nvim_create_autocmd('TextYankPost', {
group = vim.api.nvim_create_augroup('highlight_yank', {}),
desc = 'Hightlight selection on yank',
pattern = '*',
callback = function()
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 250 }
end,
})

View file

@ -1,21 +0,0 @@
-- Check file extension and set syntax highlighting
vim.cmd([[
augroup Jinja2Syntax
autocmd!
autocmd BufNewFile,BufRead *.j2 lua require('utils').set_jinja2_syntax()
augroup END
]])
-- Function to determine Jinja2 syntax highlighting
local function set_jinja2_syntax()
local file_extension = vim.fn.expand("%:e")
if file_extension == "j2" then
local base_filename = vim.fn.expand("%:r")
local base_filetype = vim.fn.fnamemodify(base_filename, ":t")
vim.opt.syntax = base_filetype
end
end
return {
set_jinja2_syntax = set_jinja2_syntax
}

View file

@ -1,2 +0,0 @@
*
!.gitignore