diff --git a/nvim/init.lua b/nvim/init.lua index ba84772..38b5fa7 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -15,13 +15,16 @@ g['syntax'] = true local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) - api.nvim_command('packadd packer.nvim') + packer_bootstrap = fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) end cmd [[packadd packer.nvim]] -- Plugins -require("packer").startup(function() +require("packer").startup(function(use) + if packer_bootstrap then + require("packer").sync() + end + -- Let the package manager manage itself. use { "wbthomason/packer.nvim", opt = true } @@ -52,14 +55,12 @@ require("packer").startup(function() requires = "honza/vim-snippets" } - -- Text editor integration for the browser - use {"subnut/nvim-ghost.nvim", run = ":call nvim_ghost#installer#install()"} - -- Fuzzy finder of lists use { "nvim-telescope/telescope.nvim", config = function() vim.api.nvim_set_keymap('n', 'ff', 'Telescope find_files', { noremap = true }) + vim.api.nvim_set_keymap('n', 'fF', 'Telescope file_browser', { noremap = true }) vim.api.nvim_set_keymap('n', 'fg', 'Telescope grep_string', { noremap = true }) vim.api.nvim_set_keymap('n', 'fG', 'Telescope live_grep', { noremap = true }) vim.api.nvim_set_keymap('n', 'fb', 'Telescope buffers', { noremap = true }) @@ -187,38 +188,6 @@ require("packer").startup(function() requires = "junegunn/fzf.vim" } - -- A full LaTeX toolchain plugin for Vim. - -- Also a must-have for me since writing LaTeX can be a PITA. - -- Most of the snippets and workflow is inspired from Gilles Castel's posts (at https://castel.dev/). - use { - "lervag/vimtex", - cmd = "ALEEnable", - config = function() - -- Vimtex configuration - g["tex_flavor"] = "latex" - g["vimtex_view_method"] = "zathura" - g["vimtex_quickfix_mode"] = 0 - g["tex_conceal"] = "abdmg" - g["vimtex_compiler_latexmk"] = { - options = { - "-bibtex", - "-shell-escape", - "-verbose", - "-file-line-error", - } - } - - -- I use LuaLaTeX for my documents so let me have it as the default, please? - g["vimtex_compiler_latexmk_engines"] = { - _ = "-lualatex", - pdflatex = "-pdf", - dvipdfex = "-pdfdvi", - lualatex = "-lualatex", - xelatex = "-xelatex", - } - end - } - -- Enable visuals for addition/deletion of lines in the gutter (side) similar to Visual Studio Code. use { "airblade/vim-gitgutter" } diff --git a/nvim/lua/lsp-user-config.lua b/nvim/lua/lsp-user-config.lua index a9281ec..cf5cb02 100644 --- a/nvim/lua/lsp-user-config.lua +++ b/nvim/lua/lsp-user-config.lua @@ -38,7 +38,7 @@ function setup() capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) -- Enable the following language servers - local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver' } + local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver', 'rnix' } for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, diff --git a/nvim/own-snippets/nix.snippets b/nvim/own-snippets/nix.snippets new file mode 100644 index 0000000..596a1d7 --- /dev/null +++ b/nvim/own-snippets/nix.snippets @@ -0,0 +1,19 @@ +snippet shell "Nix shell template" b +{ pkgs ? import {} }: + +with pkgs; + +mkShell { + buildInputs = [ + ${1} + ]; +} +endsnippet + +snippet mkDerivation "Shorthand for stdenv.mkDerivation" b +{ stdenv, lib, $1 }: + +stdenv.mkDerivation rec { + $2 +} +endsnippet