diff --git a/home/init.lua b/home/init.lua new file mode 100644 index 0000000..11e3fbb --- /dev/null +++ b/home/init.lua @@ -0,0 +1,66 @@ +-- Basics +vim.o.relativenumber = true +vim.o.mouse = "nvi" -- mouse mode in normal, visual and insert +vim.o.textwidth = 88 -- A vaguely sensible default textwidth +vim.o.colorcolumn = "+0" -- Mark the textwidth +vim.o.shiftwidth = 4 +vim.o.tabstop = 4 +vim.o.softtabstop = 4 + +vim.o.list = true +vim.o.listchars = "trail:ยท" -- show trailing spaces + +-- Colors +vim.cmd "colorscheme gruvbox" +vim.o.termguicolors = true + +-- Keybinds +vim.api.nvim_set_keymap('n','', ' FZF', { noremap=true }) + +-- LSP +local opts = { noremap=true, silent=true } +local on_attach = function(client, bufnr) + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'f', 'lua vim.lsp.buf.formatting()', opts) +end + +-- Enable Language LSPs +require'lspconfig'.gopls.setup{ + on_attach = on_attach, +} +require'lspconfig'.pylsp.setup{ + on_attach = on_attach, + handlers = { + ["textDocument/publishDiagnostics"] = vim.lsp.with( + vim.lsp.diagnostic.on_publish_diagnostics, { + -- Disable virtual_text + virtual_text = false + } + ), + } +} +require'lspconfig'.rnix.setup{ + on_attach = on_attach +} + +-- Diags with Trouble +require('trouble').setup { + icons = false, + signs = { + error = "E", + warning = "W", + hint = "H", + information = "I" + } +} + +vim.g.rustfmt_autosave = 1 + +-- Tree-sitter +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true + } +} diff --git a/home/vim.nix b/home/vim.nix index 8f2a619..1f26cab 100644 --- a/home/vim.nix +++ b/home/vim.nix @@ -1,14 +1,34 @@ -# This module sets up a "full" neovim install with plugins and unicorns. It also -# makes neovim the default editor and aliases vim to nvim. +# This module sets up a "full" neovim install with plugins and unicorns. It +# also makes neovim the default editor and aliases vim to nvim. { pkgs, ... }: { home.sessionVariables = { "EDITOR" = "nvim"; }; + home.packages = with pkgs; [ rnix-lsp ripgrep ]; programs.neovim = { enable = true; - plugins = with pkgs.vimPlugins; [ vim-nix rust-vim ]; + viAlias = true; + vimAlias = true; + plugins = with pkgs.vimPlugins; [ + # Basic stuff + vim-sensible + vim-noctu # 16color colorscheme + gruvbox-nvim + fzfWrapper + # More fancy shit + nvim-treesitter + # Language stuff + nvim-lspconfig + trouble-nvim + vim-nix + rust-vim + vim-go + # Git stuff + fugitive + vim-gitgutter + ]; extraConfig = '' - set relativenumber - let g:rustfmt_autosave = 1 + lua <