From 9d6a79dd6f2dd99eae34be81a1236eb0dc6bd644 Mon Sep 17 00:00:00 2001 From: Simon Cornet Date: Tue, 2 Apr 2024 21:26:08 +0200 Subject: [PATCH] [neovim] added tab complete and neo-treeOC --- nix/home/neovim/neovim.nix | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/nix/home/neovim/neovim.nix b/nix/home/neovim/neovim.nix index 74bdf78..9c34e99 100644 --- a/nix/home/neovim/neovim.nix +++ b/nix/home/neovim/neovim.nix @@ -66,6 +66,29 @@ vim.opt.shiftwidth = 2 vim.opt.expandtab = true vim.opt.smartindent = true + + -- load plugins + require("neo-tree").setup({ + window = { + position = "left", + width = 36, + }, + }) + require("neo-tree.sources.manager").show("filesystem") + + -- function for new line + _G.add_new_line = function() + local n_lines = vim.api.nvim_buf_line_count(0) + local last_nonblank = vim.fn.prevnonblank(n_lines) + if last_nonblank <= n_lines then vim.api.nvim_buf_set_lines(0, last_nonblank, n_lines, true, { ''' }) end + end + + vim.cmd([[ + augroup AddNewlineOnSave + autocmd! + autocmd BufWritePre * lua _G.add_new_line() + augroup END + ]]) ''; # auto-complete @@ -85,7 +108,8 @@ # plugins plugins = with pkgs.vimPlugins; [ - vim-nix + neo-tree-nvim ]; }; } +