chore: make it modular

This commit is contained in:
MBvisti 2024-03-18 16:52:33 +01:00
parent a222805c61
commit 1a37e123f5
4 changed files with 239 additions and 21 deletions

View file

@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-- Set to true if you have a Nerd Font installed
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true -- new
-- [[ Setting options ]]
-- See `:help vim.opt`
@ -159,6 +159,9 @@ vim.opt.scrolloff = 10
-- Set highlight on search, but clear on pressing <Esc> in normal mode
vim.opt.hlsearch = true
require 'options'
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
-- Diagnostic keymaps
@ -176,10 +179,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
-- TIP: Disable arrow keys in normal mode
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
@ -190,6 +193,8 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
require 'keymaps'
-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
@ -368,7 +373,7 @@ require('lazy').setup({
local builtin = require 'telescope.builtin'
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[S]earch [F]iles' })
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
@ -540,7 +545,17 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
gopls = {},
tailwindcss = {
filetypes = { "templ" },
init_options = { userLanguages = { templ = "html" } },
},
htmx = {
filetypes = { 'templ', 'html' }
},
emmet_ls = {
filetypes = { 'html', 'templ' }
},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
@ -692,7 +707,7 @@ require('lazy').setup({
-- Accept ([y]es) the completion.
-- This will auto-import if your LSP supports it.
-- This will expand snippets if the LSP sent a snippet.
['<C-y>'] = cmp.mapping.confirm { select = true },
['<CR>'] = cmp.mapping.confirm { select = true },
-- Manually trigger a completion from nvim-cmp.
-- Generally you don't need this, because nvim-cmp will display
@ -735,17 +750,17 @@ require('lazy').setup({
-- change the command in the config to whatever the name of that colorscheme is
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`
'folke/tokyonight.nvim',
priority = 1000, -- make sure to load this before all the other start plugins
init = function()
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'
-- You can configure highlights by doing something like
vim.cmd.hi 'Comment gui=none'
end,
-- 'folke/tokyonight.nvim',
-- priority = 1000, -- make sure to load this before all the other start plugins
-- init = function()
-- -- Load the colorscheme here.
-- -- Like many other themes, this one has different styles, and you could load
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
-- vim.cmd.colorscheme 'tokyonight-night'
--
-- -- You can configure highlights by doing something like
-- vim.cmd.hi 'Comment gui=none'
-- end,
},
-- Highlight todo, notes, etc in comments
@ -793,7 +808,7 @@ require('lazy').setup({
'nvim-treesitter/nvim-treesitter',
build = ':TSUpdate',
opts = {
ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc' },
ensure_installed = { 'go', 'lua', 'rust', 'vimdoc', 'vim', 'bash', 'templ' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {