.dotfiles/configs/nvim/init.lua

212 lines
4.1 KiB
Lua
Raw Normal View History

2021-10-25 19:44:21 +02:00
require("install-packer")
2021-10-11 18:02:04 +02:00
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-11-10 13:09:54 +01:00
local opt = vim.opt
2021-08-19 16:59:40 +02:00
2021-10-25 19:44:21 +02:00
require ("plugins")
2021-08-19 15:57:07 +02:00
2021-09-06 13:29:42 +02:00
if u.has_plugin("cmp") then
2021-11-17 13:55:37 +01:00
vim.g.did_load_filetypes = 1
2021-11-17 12:54:51 +01:00
-- Global options
o.number = true -- show line number
2021-10-27 20:37:42 +02:00
o.showmatch = true -- show matching brackets
o.swapfile = false
2021-11-17 12:54:51 +01:00
-- Indentation options
vim.cmd [[
set autoindent
set expandtab
set shiftwidth=2
set softtabstop=2
set tabstop=2
]]
-- Debug indentations
if false then
vim.cmd [[
set list
set listchars=eol:,tab:->,trail:_,nbsp:
]]
end
g.hidden = true --unload buffers when hidden
g.filetype = true -- execute autocommands based on filetype
2021-11-10 13:09:54 +01:00
o.autoread = true
o.lazyredraw = true
-- Search
o.inccommand = 'nosplit' -- show substitutions incrementally
o.ignorecase = true
o.smartcase = true
opt.wildignore:append('.git/*', 'node_modules/*')
o.wildignorecase = true
o.lazyredraw = true
opt.listchars:append({
extends = "#",
eol = '',
space = '',
tab = '',
})
-- Shortmess
cmd [[set shortmess+=F]]
g.loaded_netrw = 1
g.loaded_netrwPlugin = 1
g.loaded_zipPlugin = 1
g.loaded_zip = 1
2021-09-24 12:47:15 +02:00
2021-10-27 20:37:42 +02:00
cmd [[set mouse=a]] -- enable mouse interaction
2021-11-17 12:54:51 +01:00
cmd [[set undofile]]
cmd [[set fcs=eob:\ ]] --disable showing ~ in empty lines
2021-11-08 01:29:28 +01:00
cmd [[command Format :lua vim.lsp.buf.formatting()]]
2021-11-17 12:58:48 +01:00
cmd [[command FormatSync :lua vim.lsp.buf.formatting_sync()]]
2021-10-27 20:37:42 +02:00
2021-11-17 12:54:51 +01:00
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
2021-11-08 01:29:28 +01:00
cmd [[set noruler]]
g.ale_fixers = {"prettier", "eslint"}
2021-10-27 20:37:42 +02:00
-- Enable Theming / Syntax
2021-11-17 12:54:51 +01:00
o.syntax = "enable"
o.termguicolors = true
2021-10-27 20:37:42 +02:00
cmd("colorscheme material")
g.material_terminal_italics = 1
g.material_theme_style = "darker"
2021-11-17 12:54:51 +01:00
-- Remove background color
require("transparent").setup({enable = true})
cmd("highlight Normal guibg=none")
cmd("highlight NonText guibg=none")
2021-10-27 20:37:42 +02:00
require('neoscroll').setup()
2021-11-17 12:54:51 +01:00
2021-10-27 20:37:42 +02:00
-- Configure nvim-tree
g.nvim_tree_special_files = {}
2021-11-17 12:54:51 +01:00
g.nvim_tree_icons = {
default = "",
symlink = "",
git = {
unstaged = "*",
staged = "",
unmerged = "",
renamed = "",
untracked = "",
deleted = "",
ignored = ""
},
folder = {
arrow_open = " ",
arrow_closed = " ",
default = "",
open = "",
empty = "",
empty_open = "",
symlink = "",
symlink_open = ""
},
lsp = {
hint = "",
info = "",
warning = "",
error = ""
}
}
require("nvim-tree").setup {
auto_open = 1,
gitignore = 1,
group_empty = 1,
2021-10-27 20:37:42 +02:00
hijack_cursor = 1,
update_focused_file = {
enable = false,
},
2021-11-17 12:54:51 +01:00
diagnostics = {
2021-10-27 20:37:42 +02:00
enable = true
},
view = {
auto_resize = true,
hide_root_folder = true,
2021-11-17 12:54:51 +01:00
winopts = {
signcolumn = "no"
}
}
}
2021-10-27 20:37:42 +02:00
require('nvim-tree.view').View.winopts.signcolumn = 'no'
-- Configure Wiki
2021-11-17 12:54:51 +01:00
g.wiki_root = "~/Notes"
g.wiki_filetypes = {"md"}
g.wiki_link_extension = ".md"
-- KeyBindings
g.mapleader = " "
require "keymappings"
require "nvim-tmux-navigation".setup {
keybindings = {
left = "<C-h>",
down = "<C-j>",
up = "<C-k>",
right = "<C-l>",
last_active = "<C-\\>",
next = "<C-Space>"
}
}
require'nvim-autopairs'.setup()
-- Treesitter config
require "treesitter-conf"
2021-10-27 20:37:42 +02:00
2021-11-17 12:54:51 +01:00
-- Autocompletion Setup
o.completeopt = "menuone,noselect,noinsert"
require "autocomplete"
2021-11-17 13:55:37 +01:00
require "snippets"
2021-11-17 12:54:51 +01:00
-- LSP Config
require "lspinstaller-conf"
2021-08-19 17:14:34 +02:00
require "lazy-git"
2021-09-06 13:29:42 +02:00
2021-11-10 13:09:54 +01:00
require "autocommands"
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-10-27 20:37:42 +02:00
o.completeopt = "menuone,noselect,noinsert"
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-10-27 20:37:42 +02:00
require "lspinstaller-conf"
require "lsp-utils"
2021-08-10 21:50:49 +02:00
2021-08-19 17:24:36 +02:00
else
2021-10-25 19:44:21 +02:00
vim.cmd[[PackerSync]]
2021-08-31 21:22:57 +02:00
end