From c5706f1cd856ca49ebe5a933256111eb17fa30d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Wed, 28 Feb 2024 10:01:01 +0100 Subject: [PATCH] Improve neovim config --- home/editor/neovim/default.nix | 4 ++ home/editor/neovim/keybinds.lua | 4 ++ home/editor/neovim/options.lua | 1 + home/editor/neovim/plugins.lua | 66 +++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) diff --git a/home/editor/neovim/default.nix b/home/editor/neovim/default.nix index 9453089..dbdef48 100644 --- a/home/editor/neovim/default.nix +++ b/home/editor/neovim/default.nix @@ -14,9 +14,13 @@ lsp-zero-nvim vim-floaterm luasnip + lualine-nvim + vim-sleuth (nvim-treesitter.withPlugins (p: [ + p.tree-sitter-yaml p.tree-sitter-nix p.tree-sitter-go + p.tree-sitter-lua p.tree-sitter-vim p.tree-sitter-bash p.tree-sitter-json diff --git a/home/editor/neovim/keybinds.lua b/home/editor/neovim/keybinds.lua index 1dc44b4..f91c9ca 100644 --- a/home/editor/neovim/keybinds.lua +++ b/home/editor/neovim/keybinds.lua @@ -16,3 +16,7 @@ vim.keymap.set('n', '?', require('telescope.builtin').oldfiles, { desc = '[?] FInd recently opened files' }) vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, { desc = '[F]ind [F]iles' }) +vim.keymap.set('n', 'ff', require('telescope.builtin').find_files, + { desc = '[F]ind [F]iles' }) +vim.keymap.set('n', 'fg', require('telescope.builtin').live_grep, + { desc = '[F]ind by [G]rep' }) diff --git a/home/editor/neovim/options.lua b/home/editor/neovim/options.lua index 9141099..f43e875 100644 --- a/home/editor/neovim/options.lua +++ b/home/editor/neovim/options.lua @@ -10,3 +10,4 @@ vim.o.relativenumber = true vim.o.tabstop = 4 vim.o.shiftwidth = 4 +vim.o.expandtab = true diff --git a/home/editor/neovim/plugins.lua b/home/editor/neovim/plugins.lua index 3b6a859..7aa36d9 100644 --- a/home/editor/neovim/plugins.lua +++ b/home/editor/neovim/plugins.lua @@ -49,3 +49,69 @@ require('telescope').setup({ } }, }) + +-- Tresitter stuff +require('nvim-treesitter.configs').setup { + ensure_installed = {}, + auto_install = false, + highlight = { enable = true }, + indent = { enable = true}, + + incremental_selection = { + enable = true, + keymaps = { + init_selection = '', + node_incremental = '', + scope_incremental = '', + node_decremental = '', + }, + }, + textobjects = { + select = { + enable = true, + lookahead = true, + + keymaps = { + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + } + } + } +} + +-- Lualine +require('lualine').setup({ + options = { + icons_enabled = false, + component_separators = '|', + disabled_filetypes = {}, + always_divide_middle = true, + globalstatus = true, + }, + sections = { + lualine_a = { 'mode' }, + lualine_b = { 'branch', 'diff', 'diagnostics' }, + lualine_c = { + { + 'filename', + file_status = true, + newfile_status = true, + path = 3, + shorting_target = 30, + symbols = { + modified = '[+]', + readonly = '[-]', + unnamed = '[No name]', + newfile = '[New]' + } + } + }, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = { 'progress' }, + lualine_z = { 'location' } + } +})