Update Neovim config

This commit is contained in:
Gabriel Arazas 2022-01-11 22:21:04 +08:00
parent 28e926a473
commit e7c33a7896
3 changed files with 27 additions and 39 deletions

View File

@ -15,13 +15,16 @@ g['syntax'] = true
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) packer_bootstrap = fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path})
api.nvim_command('packadd packer.nvim')
end end
cmd [[packadd packer.nvim]] cmd [[packadd packer.nvim]]
-- Plugins -- Plugins
require("packer").startup(function() require("packer").startup(function(use)
if packer_bootstrap then
require("packer").sync()
end
-- Let the package manager manage itself. -- Let the package manager manage itself.
use { "wbthomason/packer.nvim", opt = true } use { "wbthomason/packer.nvim", opt = true }
@ -52,14 +55,12 @@ require("packer").startup(function()
requires = "honza/vim-snippets" 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 -- Fuzzy finder of lists
use { use {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
config = function() config = function()
vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>fF', '<cmd>Telescope file_browser<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>Telescope grep_string<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>Telescope grep_string<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>fG', '<cmd>Telescope live_grep<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>fG', '<cmd>Telescope live_grep<cr>', { noremap = true })
vim.api.nvim_set_keymap('n', '<leader>fb', '<cmd>Telescope buffers<cr>', { noremap = true }) vim.api.nvim_set_keymap('n', '<leader>fb', '<cmd>Telescope buffers<cr>', { noremap = true })
@ -187,38 +188,6 @@ require("packer").startup(function()
requires = "junegunn/fzf.vim" 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. -- Enable visuals for addition/deletion of lines in the gutter (side) similar to Visual Studio Code.
use { "airblade/vim-gitgutter" } use { "airblade/vim-gitgutter" }

View File

@ -38,7 +38,7 @@ function setup()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
-- Enable the following language servers -- 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 for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,

View File

@ -0,0 +1,19 @@
snippet shell "Nix shell template" b
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
mkShell {
buildInputs = [
${1}
];
}
endsnippet
snippet mkDerivation "Shorthand for stdenv.mkDerivation" b
{ stdenv, lib, $1 }:
stdenv.mkDerivation rec {
$2
}
endsnippet