feat: move config to single init.lua file
This commit is contained in:
174
init.lua
174
init.lua
@@ -12,9 +12,161 @@ end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
|
||||
vim.g.mapleader = " "
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{
|
||||
'windwp/nvim-ts-autotag',
|
||||
lazy = false,
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
'terrortylor/nvim-comment',
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('nvim_comment').setup({
|
||||
hook = function()
|
||||
require('ts_context_commentstring.internal').update_commentstring()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
dependencies = {
|
||||
-- To customize commentstring for e.g. svelte files, as the commentstring is depending on cursor position
|
||||
'JoosepAlviste/nvim-ts-context-commentstring'
|
||||
}
|
||||
},
|
||||
{
|
||||
{
|
||||
'williamboman/mason.nvim',
|
||||
lazy = false,
|
||||
config = true,
|
||||
},
|
||||
{
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
lazy = false,
|
||||
config = function()
|
||||
local lsp_zero = require('lsp-zero')
|
||||
|
||||
require("lazy").setup("plugins")
|
||||
lsp_zero.extend_lspconfig()
|
||||
|
||||
lsp_zero.on_attach(function(_, bufnr)
|
||||
-- see :help lsp-zero-keybindings
|
||||
-- to learn the available actions
|
||||
lsp_zero.default_keymaps({ buffer = bufnr })
|
||||
end)
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
ensure_installed = { 'rust_analyzer', 'lua_ls' },
|
||||
handlers = {
|
||||
lsp_zero.default_setup
|
||||
} }
|
||||
end,
|
||||
},
|
||||
|
||||
{ 'VonHeikemen/lsp-zero.nvim' },
|
||||
{ 'neovim/nvim-lspconfig' },
|
||||
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
lazy = false,
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.setup({
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
-- add Ctrl+z to default keymap from lsp-zero as replacement to Ctrl+y on german keyboard layout
|
||||
['<C-z>'] = cmp.mapping.confirm({ select = true }),
|
||||
})
|
||||
})
|
||||
end
|
||||
}
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
lazy = false,
|
||||
opts = {
|
||||
notify_on_error = true,
|
||||
formatters_by_ft = {
|
||||
templ = { "templ" },
|
||||
},
|
||||
format_on_save = {
|
||||
lsp_fallback = true,
|
||||
timeout_ms = 1500,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local plug = require('conform')
|
||||
plug.setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
-- status line
|
||||
'nvim-lualine/lualine.nvim',
|
||||
lazy = false,
|
||||
config = true,
|
||||
opts = {
|
||||
options = {
|
||||
theme = "everforest",
|
||||
},
|
||||
},
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' }
|
||||
},
|
||||
{
|
||||
'rcarriga/nvim-notify',
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.notify = require('notify')
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
lazy = false,
|
||||
config = function()
|
||||
require('oil').setup({
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
sort = {
|
||||
{ "type", "asc" },
|
||||
{ "name", "asc" },
|
||||
},
|
||||
},
|
||||
})
|
||||
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
||||
end,
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
opts = {
|
||||
defaults = {
|
||||
path_display = { "smart" },
|
||||
file_ignore_patterns = { "node%_modules/.*" }
|
||||
}
|
||||
},
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
},
|
||||
{
|
||||
"sainnhe/everforest",
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
config = function()
|
||||
vim.cmd([[colorscheme everforest]])
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup {
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
vim.cmd([[TSUpdate]])
|
||||
end
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- line numbers
|
||||
vim.opt.rnu = true
|
||||
@@ -28,13 +180,16 @@ vim.opt.ignorecase = true
|
||||
vim.opt.ts = 4
|
||||
vim.opt.sw = 0
|
||||
|
||||
--folding
|
||||
-- folding
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldlevel = 99
|
||||
|
||||
--clipboard
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
|
||||
-- other
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
-- colortheme
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
@@ -47,3 +202,16 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
})
|
||||
|
||||
vim.filetype.add({ extension = { templ = "templ" } })
|
||||
|
||||
|
||||
vim.keymap.set('n', '<leader>q', ':q<CR>', {})
|
||||
vim.keymap.set('n', '<leader>w', ':w<CR>', {})
|
||||
vim.keymap.set('n', '<leader>c', ':noh<CR>', {})
|
||||
vim.keymap.set('n', '<leader>en', vim.diagnostic.goto_next, {})
|
||||
vim.keymap.set('n', '<leader>ep', vim.diagnostic.goto_prev, {})
|
||||
|
||||
local telescope = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', telescope.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', telescope.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', telescope.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fh', telescope.help_tags, {})
|
||||
|
||||
Reference in New Issue
Block a user