|
-- ----------------------------------------------------------------------------------------------- |
|
-- General configuration |
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Basic settings |
|
vim.opt.hlsearch = true |
|
vim.opt.number = true |
|
vim.opt.relativenumber = true |
|
vim.opt.mouse = "a" |
|
vim.opt.showmode = false |
|
vim.opt.spelllang = "en_gb" |
|
|
|
-- use nvim-tree instead |
|
vim.g.loaded_netrw = 1 |
|
vim.g.loaded_netrwPlugin = 1 |
|
|
|
-- Use system clipboard |
|
vim.opt.clipboard:append({ "unnamed", "unnamedplus" }) |
|
|
|
-- Display settings |
|
vim.opt.termguicolors = true |
|
|
|
-- scroll a bit extra horizontally and vertically when at the end/bottom |
|
vim.opt.cursorline = true |
|
vim.opt.signcolumn = 'yes' |
|
vim.opt.wrap = false |
|
|
|
-- Title |
|
vim.opt.title = true -- set the title of window to the value of the titlestring |
|
vim.opt.titlestring = "%<%F%=%l/%L - nvim" -- what the title of the window will be set to |
|
|
|
-- Persist undo |
|
vim.opt.undodir = vim.fn.stdpath("cache") .. "/undo" |
|
vim.opt.undofile = true |
|
|
|
-- Tab stuff |
|
vim.opt.tabstop = 2 |
|
vim.opt.shiftwidth = 2 |
|
vim.opt.expandtab = true |
|
vim.opt.autoindent = true |
|
|
|
-- Search configuration |
|
vim.opt.ignorecase = true |
|
vim.opt.smartcase = true |
|
vim.opt.gdefault = true |
|
|
|
-- scroll a bit extra horizontally and vertically when at the end/bottom |
|
vim.opt.sidescrolloff = 8 |
|
vim.opt.scrolloff = 8 |
|
|
|
-- open new split panes to right and below (as you probably expect) |
|
vim.opt.splitright = true |
|
vim.opt.splitbelow = true |
|
|
|
-- Highlight trailing characters |
|
vim.opt.listchars = { |
|
-- eol = "↲", |
|
tab = "▸ ", |
|
trail = "·", |
|
} |
|
vim.opt.list = true |
|
|
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Keymap settings |
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Basic keys |
|
vim.g.mapleader = " " |
|
|
|
-- Easier redo |
|
vim.keymap.set("n", "q", "<C-r>") |
|
|
|
-- Search and Replace |
|
vim.keymap.set("n", "<leader>h", ":%s/") |
|
vim.keymap.set("n", "<leader>l", ":nohlsearch<CR><C-L>") |
|
|
|
-- nvim-tree |
|
vim.keymap.set("n", "<C-t>", ":NvimTreeFocus<CR>") |
|
vim.keymap.set("n", "<C-f>", ":NvimTreeFindFile<CR>") |
|
vim.keymap.set("n", "<C-c>", ":NvimTreeClose<CR>") |
|
|
|
|
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Plugin list |
|
-- ----------------------------------------------------------------------------------------------- |
|
|
|
local plugins = { |
|
{ "nvim-lua/plenary.nvim" }, |
|
|
|
-- Gruvbox theme with Treesitter support |
|
{ "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" }, |
|
{ "ellisonleao/gruvbox.nvim" }, |
|
|
|
-- Used by LuaLine and nvim-tree |
|
{ |
|
"nvim-tree/nvim-web-devicons", |
|
lazy = true, |
|
}, |
|
|
|
-- Pretty indentation lines |
|
{ "lukas-reineke/indent-blankline.nvim", main = "ibl" }, |
|
|
|
-- Status line at the bottom |
|
{ "nvim-lualine/lualine.nvim" }, |
|
|
|
-- File browser |
|
{ "nvim-tree/nvim-tree.lua" }, |
|
|
|
-- LSP |
|
{ |
|
{ 'mason-org/mason.nvim', opts = {} }, |
|
{ |
|
'mason-org/mason-lspconfig.nvim', |
|
dependencies = { 'neovim/nvim-lspconfig' }, |
|
opts = {} |
|
}, |
|
}, |
|
} |
|
|
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Plugin installation |
|
-- ----------------------------------------------------------------------------------------------- |
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" |
|
if not vim.loop.fs_stat(lazypath) then |
|
vim.fn.system({ |
|
"git", |
|
"clone", |
|
"--filter=blob:none", |
|
"https://github.com/folke/lazy.nvim.git", |
|
"--branch=stable", |
|
lazypath, |
|
}) |
|
end |
|
vim.opt.rtp:prepend(lazypath) |
|
require("lazy").setup(plugins) |
|
|
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Plugin config |
|
-- ----------------------------------------------------------------------------------------------- |
|
vim.cmd.colorscheme("gruvbox") |
|
|
|
require("nvim-tree").setup({ |
|
filters = { |
|
dotfiles = true, |
|
}, |
|
}) |
|
|
|
require("ibl").setup({ |
|
debounce = 100, |
|
indent = { char = "▏" }, |
|
whitespace = { highlight = { "Whitespace", "NonText" } }, |
|
}) |
|
|
|
require("lualine").setup({ |
|
sections = { |
|
lualine_a = {}, |
|
lualine_b = { "diff", "diagnostics" }, |
|
lualine_c = { { "filename", path = 1 } }, |
|
lualine_x = {}, |
|
lualine_y = { "progress" }, |
|
lualine_z = { "location" }, |
|
}, |
|
}) |
|
|
|
-- ----------------------------------------------------------------------------------------------- |
|
-- Treesitter |
|
-- ----------------------------------------------------------------------------------------------- |
|
require("nvim-treesitter.configs").setup({ |
|
-- A list of parser names, or "all" |
|
-- https://github.com/nvim-treesitter/nvim-treesitter/tree/master#supported-languages |
|
ensure_installed = { |
|
"bash", |
|
"diff", |
|
"dockerfile", |
|
"git_rebase", |
|
"terraform", |
|
"yaml", |
|
}, |
|
sync_install = false, |
|
auto_install = true, |
|
highlight = { |
|
enable = true, |
|
}, |
|
}) |
|
vim.opt.foldmethod = "expr" |
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()" |
|
vim.opt.foldlevel = 99 |
|
|
|
-- ----------------------------------------------------------------------------------------------- |
|
-- LSP stuff |
|
-- ----------------------------------------------------------------------------------------------- |
|
require("mason").setup({}) |
|
require("mason-lspconfig").setup({ |
|
-- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers |
|
ensure_installed = { |
|
"bashls", |
|
"dockerls", |
|
"docker_compose_language_service", |
|
"terraformls", |
|
"yamlls", |
|
}, |
|
}) |