2025-07-06 21:49:22 +01:00
|
|
|
-- Global settings
|
|
|
|
vim.g.loaded_netrw = 1
|
|
|
|
vim.g.loaded_netrwPlugin = 1
|
|
|
|
vim.g.mapleader = " "
|
|
|
|
|
|
|
|
vim.opt.termguicolors = true
|
2025-07-07 21:55:13 +01:00
|
|
|
|
2025-07-07 22:24:58 +01:00
|
|
|
vim.opt.tabstop = 2
|
|
|
|
vim.opt.softtabstop = 2
|
|
|
|
vim.opt.shiftwidth = 2
|
2025-07-06 21:49:22 +01:00
|
|
|
vim.opt.expandtab = true
|
|
|
|
|
2025-07-07 21:55:13 +01:00
|
|
|
vim.opt.number = true
|
|
|
|
vim.opt.relativenumber = true
|
|
|
|
vim.opt.scrolloff = 8
|
|
|
|
|
2025-07-07 22:24:58 +01:00
|
|
|
vim.opt.colorcolumn = "+1,+2"
|
|
|
|
vim.opt.cursorline = true
|
|
|
|
vim.opt.signcolumn = 'yes'
|
|
|
|
|
2025-07-07 21:55:13 +01:00
|
|
|
vim.cmd.colorscheme "catppuccin-mocha"
|
2025-07-06 21:49:22 +01:00
|
|
|
|
2025-07-07 21:55:13 +01:00
|
|
|
-- Custom bindings for buffer navigation
|
2025-07-07 22:24:58 +01:00
|
|
|
vim.keymap.set("n", "<leader>n", "<cmd>bn<CR>")
|
|
|
|
vim.keymap.set("n", "<leader>p", "<cmd>bp<CR>")
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<Esc>", "<cmd>nohlsearch<CR>")
|
2025-07-06 21:49:22 +01:00
|
|
|
|
|
|
|
-- Bufferline (tabs)
|
2025-07-07 23:57:15 +01:00
|
|
|
require("bufferline").setup {}
|
2025-07-06 21:49:22 +01:00
|
|
|
|
|
|
|
-- Lualine (status line)
|
2025-07-07 23:57:15 +01:00
|
|
|
require("lualine").setup {
|
|
|
|
options = {
|
|
|
|
section_separators = { left = '', right = '' }
|
|
|
|
}
|
|
|
|
}
|
2025-07-06 21:49:22 +01:00
|
|
|
|
|
|
|
-- Telescope (anything search)
|
2025-07-07 22:24:58 +01:00
|
|
|
vim.keymap.set("n", "<leader>b", "<cmd>Telescope buffers<CR>")
|
|
|
|
vim.keymap.set("n", "<leader>f", "<cmd>Telescope find_files<CR>")
|
|
|
|
vim.keymap.set("n", "<leader>g", "<cmd>Telescope git_files<CR>")
|
2025-07-07 21:55:13 +01:00
|
|
|
|
|
|
|
-- Tree (file manager)
|
|
|
|
require("nvim-tree").setup()
|
|
|
|
vim.keymap.set("n", "<leader>t", "<cmd>NvimTreeToggle<CR>", { noremap = true, silent = true })
|
2025-07-06 21:49:22 +01:00
|
|
|
|
|
|
|
-- lspconfig (LSPs)
|
2025-07-07 21:55:13 +01:00
|
|
|
vim.lsp.enable("lua_ls")
|
|
|
|
vim.lsp.enable("nil_ls")
|
2025-07-06 21:49:22 +01:00
|
|
|
vim.lsp.enable("pyright")
|
2025-07-07 21:55:13 +01:00
|
|
|
vim.lsp.enable("rust_analyzer")
|
|
|
|
|
|
|
|
vim.keymap.set("n", "<leader>o", vim.lsp.buf.format)
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('LspAttach', {
|
|
|
|
desc = 'LSP actions',
|
|
|
|
callback = function()
|
|
|
|
local bufmap = function(mode, lhs, rhs)
|
2025-07-07 23:57:15 +01:00
|
|
|
local opts = { buffer = true }
|
2025-07-07 21:55:13 +01:00
|
|
|
vim.keymap.set(mode, lhs, rhs, opts)
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Displays hover information about the symbol under the cursor
|
|
|
|
bufmap('n', 'K', vim.lsp.buf.hover)
|
|
|
|
|
|
|
|
-- Jump to the definition
|
|
|
|
bufmap('n', 'gd', vim.lsp.buf.definition)
|
|
|
|
|
|
|
|
-- Jump to declaration
|
|
|
|
bufmap('n', 'gD', vim.lsp.buf.declaration)
|
|
|
|
|
|
|
|
-- Lists all the implementations for the symbol under the cursor
|
|
|
|
bufmap('n', 'gi', vim.lsp.buf.implementation)
|
|
|
|
|
|
|
|
-- Jumps to the definition of the type symbol
|
|
|
|
bufmap('n', 'go', vim.lsp.buf.type_definition)
|
|
|
|
|
2025-07-07 23:57:15 +01:00
|
|
|
-- Lists all the references
|
2025-07-07 21:55:13 +01:00
|
|
|
bufmap('n', 'gr', vim.lsp.buf.references)
|
|
|
|
|
|
|
|
-- Displays a function's signature information
|
|
|
|
bufmap('n', '<C-k>', vim.lsp.buf.signature_help)
|
|
|
|
|
|
|
|
-- Renames all references to the symbol under the cursor
|
|
|
|
bufmap('n', '<leader>R', vim.lsp.buf.rename)
|
|
|
|
|
|
|
|
-- Show diagnostics in a floating window
|
|
|
|
bufmap('n', 'gl', vim.diagnostic.open_float)
|
|
|
|
|
|
|
|
-- Move to the previous diagnostic
|
|
|
|
bufmap('n', '[d', vim.diagnostic.goto_prev)
|
|
|
|
|
|
|
|
-- Move to the next diagnostic
|
|
|
|
bufmap('n', ']d', vim.diagnostic.goto_next)
|
|
|
|
end
|
|
|
|
})
|