Fixed issues encountered on fresh install

This commit is contained in:
Ivar Fatland
2023-05-28 14:14:58 +02:00
parent 425134a4e2
commit c60eec9126
+37 -28
View File
@@ -22,6 +22,8 @@ local keymap = {
leader_key = ';',
}
local theme_with_real_colors = false
vim.g.mapleader = keymap.leader_key
vim.g.maplocalleader = keymap.leader_key
vim.opt.tabstop = 4 -- Character width of a tab
@@ -33,7 +35,7 @@ vim.opt.shiftround = true
vim.opt.expandtab = true
-- Will only run the first time nvim launches to install packer
local ensure_packer = function()
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
@@ -42,30 +44,55 @@ vim.opt.expandtab = true
return true
end
return false
end
local packer_bootstrap = ensure_packer()
end
local packer_bootstrap = ensure_packer()
-- Packages
local function packer_startup(use)
use 'wbthomason/packer.nvim'
use 'lervag/vimtex' -- Latex
use 'ellisonleao/gruvbox.nvim' -- Theme
use 'nvim-tree/nvim-tree.lua' -- File explorer
use 'nvim-tree/nvim-web-devicons' -- Icons for file explorer and info bar
use 'nvim-lualine/lualine.nvim' -- Lower info-bar
use 'nvim-treesitter/nvim-treesitter' -- Syntax highlighting
use 'hrsh7th/nvim-cmp' -- Autocompletion
use 'hrsh7th/cmp-nvim-lsp'
use 'L3MON4D3/LuaSnip'
use { -- LSP
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'neovim/nvim-lspconfig',
}
use { 'nvim-telescope/telescope.nvim', -- FuzzyFind
tag = '0.1.1',
requires = {
{'nvim-lua/plenary.nvim'},
{'BurntSushi/ripgrep'},
-- ripgrep might not actually
-- be a nvim package
}
}
if packer_bootstrap then --Comes after packages
require('packer').sync()
end
vim.g.vimtex_view_method = 'zathura'
use 'ellisonleao/gruvbox.nvim' -- Theme
if theme_with_real_colors then
vim.o.termguicolors = true
vim.o.background = "dark"
vim.cmd [[ colorscheme gruvbox ]]
end
use 'nvim-tree/nvim-tree.lua' -- File explorer
vim.g.loaded_netrw = 1
vim.g.loaded_netrwPlugin = 1
require('nvim-tree').setup()
vim.keymap.set('n', keymap.toggle_file_explorer, ':NvimTreeFindFileToggle<CR>')
use 'nvim-tree/nvim-web-devicons' -- Icons for file explorer and info bar
use 'nvim-lualine/lualine.nvim' -- Lower info-bar
require('lualine').setup {options = {icons_enabled = true, theme = 'gruvbox'}}
use 'nvim-treesitter/nvim-treesitter' -- Syntax highlighting
require('nvim-treesitter.configs').setup {
ensure_installed = 'all',
sync_install = false,
@@ -76,9 +103,6 @@ local function packer_startup(use)
}
}
use 'hrsh7th/nvim-cmp' -- Autocompletion
use 'hrsh7th/cmp-nvim-lsp'
use 'L3MON4D3/LuaSnip'
local cmp = require('cmp')
cmp.setup{
mapping = cmp.mapping.preset.insert {
@@ -102,11 +126,7 @@ local function packer_startup(use)
)
}
use { -- LSP
'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim',
'neovim/nvim-lspconfig',
} require('mason').setup()
require('mason').setup()
require('mason-lspconfig').setup{
ensure_installed = {
'clangd', 'golangci_lint_ls', 'kotlin_language_server',
@@ -128,23 +148,12 @@ local function packer_startup(use)
vim.keymap.set('n', keymap.show_references, require('telescope.builtin').lsp_references, {})
vim.keymap.set('n', keymap.hovering_documentation, vim.lsp.buf.hover, {})
use { 'nvim-telescope/telescope.nvim', -- FuzzyFind
tag = '0.1.1',
requires = {
{'nvim-lua/plenary.nvim'},
{'BurntSushi/ripgrep'},
-- ripgrep might not actually
-- be a nvim package
}
}; local builtin = require('telescope.builtin')
local builtin = require('telescope.builtin')
vim.keymap.set('n', keymap.search_for_files_in_working_directory, builtin.find_files, {})
vim.keymap.set('n', keymap.search_for_previously_opened_files, builtin.oldfiles, {})
vim.keymap.set('n', keymap.live_grep, builtin.live_grep, {})
vim.keymap.set('n', keymap.search_help_pages, builtin.help_tags, {})
if packer_bootstrap then -- Must be last instruction.
require('packer').sync()
end
end
return require('packer').startup(packer_startup)