.dotfiles/configs/init.lua

226 lines
5.5 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",
"xiyaowong/nvim-transparent",
2021-08-19 15:57:07 +02:00
-- Layout Plugins
2021-09-22 11:44:12 +02:00
--"preservim/nerdtree",
--"unkiwii/vim-nerdtree-sync",
"kyazdani42/nvim-web-devicons",
"kyazdani42/nvim-tree.lua",
"karb94/neoscroll.nvim",
"alexghergh/nvim-tmux-navigation",
2021-08-19 15:57:07 +02:00
-- Code Navigation
2021-10-06 14:48:32 +02:00
"dense-analysis/ale",
"nathanmsmith/nvim-ale-diagnostic",
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",
-- For better git support
"tpope/vim-fugitive",
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-22 11:44:12 +02:00
"preservim/nerdcommenter",
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-10-06 14:48:32 +02:00
"weilbith/nvim-code-action-menu",
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-09-24 12:47:15 +02:00
cmd [[set fcs=eob:\ ]]
cmd [[set noshowmode]] --to get rid of thing like --INSERT--
cmd [[set noshowcmd]] --to get rid of display of last command
cmd [[set shortmess+=F]] --to get rid of the file name displayed in the command line bar
cmd [[set noruler]]
2021-08-19 17:14:34 +02:00
-- Apply Theme
o.syntax = "enable"
o.termguicolors = true
2021-09-22 11:44:12 +02:00
--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"}}
2021-09-22 11:44:12 +02:00
2021-09-24 12:47:15 +02:00
g.nvim_tree_root_folder_modifier = ":~:."
g.nvim_tree_special_files = {}
g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "*",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = ""
},
folder = {
2021-09-24 12:47:15 +02:00
arrow_open = "",
arrow_closed = "",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = ""
},
lsp = {
hint = "",
info = "",
warning = "",
error = ""
}
}
2021-09-06 13:29:42 +02:00
g.hidden = true
2021-09-22 11:44:12 +02:00
g.filetype = true
2021-09-06 13:29:42 +02:00
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
require "nvim-tmux-navigation".setup {
keybindings = {
left = "<C-h>",
down = "<C-j>",
up = "<C-k>",
right = "<C-l>",
last_active = "<C-\\>",
next = "<C-Space>"
}
}
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-10-06 14:48:32 +02:00
require("nvim-tree").setup {
auto_open = 1,
gitignore = 1,
lsp_diagnostics = 1,
group_empty = 1,
hide_root_folder = true,
view = {
winopts = {
signcolumn = "no"
}
}
}
2021-08-10 21:50:49 +02:00
2021-09-22 11:44:12 +02:00
-- Autocommands
--[[ u.create_augroup(]]
--[[{]]
--[[{"StdinReadPre", "*", "let s:std_in=1"},]]
--[[{"VimEnter", "*", "if argc() == 0 && !exists('s:std_in') | NERDTree | endif"},]]
--[[{"BufEnter", "*", 'if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif'},]]
--[[{"BufWinEnter", "*", "if getcmdwintype() == '' | silent NERDTreeMirror | endif"}]]
--[[},]]
--[["Nerdtree"]]
--[[)]]
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-09-22 11:44:12 +02:00
-- Smooth Scrolling
require("neoscroll").setup()
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-09-24 12:47:15 +02:00
cmd [[source $MYVIMRC]]
2021-08-31 21:22:57 +02:00
end