.dotfiles/configs/init.lua

150 lines
3.7 KiB
Lua
Raw Normal View History

2021-08-19 17:04:46 +02:00
local u = require("utils")
2021-08-10 21:50:49 +02:00
local o = vim.o
local g = vim.g
2021-09-06 13:29:42 +02:00
local cmd = vim.cmd
2021-08-19 16:59:40 +02:00
2021-08-19 15:57:07 +02:00
require("install-paq")
2021-08-19 16:44:25 +02:00
2021-09-06 13:29:42 +02:00
local paq = require("paq")
paq:setup({verbose = true}) {
2021-09-02 13:26:22 +02:00
"savq/paq-nvim", -- Let Paq manage itself
2021-09-06 13:29:42 +02:00
-- General Helper Function
"nvim-lua/plenary.nvim",
2021-08-19 15:57:07 +02:00
-- Theming Plugins
2021-09-02 13:26:22 +02:00
"kaicataldo/material.vim",
"ryanoasis/vim-devicons",
"xiyaowong/nvim-transparent",
2021-08-19 15:57:07 +02:00
-- Layout Plugins
2021-09-02 13:26:22 +02:00
"preservim/nerdtree",
"jistr/vim-nerdtree-tabs",
2021-08-19 15:57:07 +02:00
-- Code Navigation
2021-09-06 13:29:42 +02:00
"junegunn/fzf",
2021-09-02 13:26:22 +02:00
"nvim-lua/popup.nvim",
"nvim-telescope/telescope.nvim",
2021-09-06 13:29:42 +02:00
-- Postman like featuresi
"NTBBloodbath/rest.nvim",
2021-09-12 16:35:38 +02:00
-- Obsidian / Roam features
"lervag/wiki.vim",
2021-08-19 15:57:07 +02:00
-- Syntax / Autocomplete
2021-09-02 13:26:22 +02:00
"neovim/nvim-lspconfig",
2021-09-12 16:35:38 +02:00
"kabouzeid/nvim-lspinstall",
2021-09-02 13:26:22 +02:00
"nvim-lua/lsp-status.nvim",
2021-09-06 13:29:42 +02:00
"hrsh7th/nvim-cmp", -- Autocompletion plugin
"hrsh7th/cmp-nvim-lsp", -- LSP source for nvim-cmp
2021-09-22 11:39:26 +02:00
--"saadparwaiz1/cmp_luasnip", -- Snippets source for nvim-cmp
2021-09-06 13:29:42 +02:00
"L3MON4D3/LuaSnip", -- Snippets plugin
2021-09-02 13:26:22 +02:00
{"nvim-treesitter/nvim-treesitter", run = ":TSUpdate"},
2021-08-19 15:57:07 +02:00
-- Formatting
2021-09-02 13:26:22 +02:00
"mhartington/formatter.nvim",
2021-08-19 15:57:07 +02:00
-- Git Interface
2021-09-06 13:29:42 +02:00
"akinsho/nvim-toggleterm.lua",
-- Database Interface
"tpope/vim-dadbod",
"kristijanhusak/vim-dadbod-ui"
2021-08-19 15:57:07 +02:00
}
2021-09-06 13:29:42 +02:00
if u.has_plugin("cmp") then
2021-08-19 17:14:34 +02:00
-- Global options
o.number = true
o.tabstop = 2
o.shiftwidth = 2 -- Indents will have a width of 4
o.softtabstop = 2 -- Sets the number of columns for a TAB
o.expandtab = false -- Expand TABs to spaces
cmd [[set mouse=a]]
cmd [[set undofile]]
2021-08-19 17:14:34 +02:00
-- Apply Theme
o.syntax = "enable"
o.termguicolors = true
g.NERDTreeShowHidden = true
g.NERDTreeAutoDeleteBuffer = true
g.NERDTreeMinimalUI = true
g.NERDTreeDirArrows = true
2021-09-06 13:29:42 +02:00
-- g.NERDTreeCustomOpenArgs = {file = {where = "t"}}
g.hidden = true
g.material_terminal_italics = 1
g.material_theme_style = "darker"
2021-09-12 16:35:38 +02:00
g.wiki_root = "~/Notes"
g.wiki_filetypes = {"md"}
g.wiki_link_extension = ".md"
2021-09-06 13:29:42 +02:00
cmd("colorscheme material")
2021-08-19 17:14:34 +02:00
-- Remove background color
2021-09-06 13:29:42 +02:00
require("transparent").setup({enable = true})
2021-08-19 17:24:36 +02:00
cmd("highlight Normal guibg=none")
cmd("highlight NonText guibg=none")
2021-08-10 21:50:49 +02:00
2021-08-19 17:14:34 +02:00
-- KeyBindings
g.mapleader = " "
require "keymappings"
2021-08-10 21:50:49 +02:00
2021-08-19 17:14:34 +02:00
-- Treesitter config
2021-09-06 13:29:42 +02:00
local parser_configs = require("nvim-treesitter.parsers").get_parser_configs()
parser_configs.http = {
install_info = {
url = "https://github.com/NTBBloodbath/tree-sitter-http",
files = {"src/parser.c"},
branch = "main"
}
}
require "nvim-treesitter.configs".setup {
2021-09-12 16:35:38 +02:00
ensure_installed = {
"bash",
"yaml",
"http",
"svelte",
"css",
"svelte",
"typescript",
"javascript",
"go",
"lua",
"yaml"
},
2021-09-06 13:29:42 +02:00
highlight = {enable = true}
}
2021-08-19 17:14:34 +02:00
-- Toggleterm / Lazygit setup
require "lazy-git"
2021-09-06 13:29:42 +02:00
2021-08-19 17:14:34 +02:00
-- Autocommands
u.create_augroup(
{
{"VimEnter", "*", "if (@% == '') | NERDTree | endif"},
2021-09-06 13:29:42 +02:00
{"BufEnter", "*", 'if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif'},
{"BufWinEnter", "*", "NERDTreeMirrorOpen"}
--{"BufEnter", "*", "if &modifiable | NERDTreeFind | wincmd p | endif"}
2021-08-19 17:14:34 +02:00
},
"Nerdtree"
)
2021-08-10 21:50:49 +02:00
2021-09-06 13:29:42 +02:00
-- Setup rest.vim
require("rest-nvim").setup(
{
-- Open request results in a horizontal split
result_split_horizontal = false,
-- Skip SSL verification, useful for unknown certificates
skip_ssl_verification = false,
-- Highlight request on run
highlight = {
enabled = true,
timeout = 150
},
-- Jump to request line on run
jump_to_request = false
}
)
2021-08-19 17:14:34 +02:00
-- Autocompletion Setup
2021-09-06 13:29:42 +02:00
o.completeopt = "menuone,noselect"
2021-08-19 17:14:34 +02:00
require "autocomplete"
2021-08-10 21:50:49 +02:00
2021-08-19 17:14:34 +02:00
-- LSP Config
2021-09-12 16:35:38 +02:00
require "lspinstall".setup()
2021-08-19 17:14:34 +02:00
require "lsp-utils"
2021-08-10 21:50:49 +02:00
2021-08-19 17:14:34 +02:00
-- Autoformat
require "autoformatter"
2021-08-19 17:24:36 +02:00
else
2021-09-06 13:29:42 +02:00
paq.install()
2021-08-31 21:22:57 +02:00
end