Improve nvim configs
This commit is contained in:
parent
807b84f1e9
commit
58d49da5c2
4 changed files with 26 additions and 5 deletions
|
@ -14,6 +14,7 @@
|
||||||
require("set")
|
require("set")
|
||||||
require("remap")
|
require("remap")
|
||||||
require("plugins")
|
require("plugins")
|
||||||
|
require("utils")
|
||||||
|
|
||||||
local status, ts_install = pcall(require, "nvim-treesitter.install")
|
local status, ts_install = pcall(require, "nvim-treesitter.install")
|
||||||
if(status) then
|
if(status) then
|
||||||
|
|
|
@ -3,10 +3,9 @@ local lsp = require("lsp-zero")
|
||||||
lsp.preset("recommended")
|
lsp.preset("recommended")
|
||||||
|
|
||||||
lsp.ensure_installed({
|
lsp.ensure_installed({
|
||||||
-- 'bashls',
|
'bashls',
|
||||||
-- 'lua_ls',
|
'lua_ls',
|
||||||
-- 'pylsp',
|
'yamlls',
|
||||||
-- 'rnix',
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Fix Undefined global 'vim'
|
-- Fix Undefined global 'vim'
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
local builtin = require('telescope.builtin')
|
local builtin = require('telescope.builtin')
|
||||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
vim.keymap.set('n', '<leader>pg', builtin.git_files, {})
|
||||||
vim.keymap.set('n', '<leader>ps', function()
|
vim.keymap.set('n', '<leader>ps', function()
|
||||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||||
end)
|
end)
|
||||||
|
|
21
.config/nvim/lua/utils.lua
Normal file
21
.config/nvim/lua/utils.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
-- 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
|
||||||
|
}
|
Loading…
Reference in a new issue