ft: add initial nvim config
This commit is contained in:
6
files/nvim/nvim/init.lua
Normal file
6
files/nvim/nvim/init.lua
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
require 'plugins' -- Load plugins
|
||||||
|
require 'settings' -- General settings
|
||||||
|
require 'mappings' -- Keyboard mappings
|
||||||
|
|
||||||
|
-- Plugin specific
|
||||||
|
require 'lsp'
|
||||||
207
files/nvim/nvim/lua/icons.lua
Normal file
207
files/nvim/nvim/lua/icons.lua
Normal file
@@ -0,0 +1,207 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.lspkind = {
|
||||||
|
Namespace = "",
|
||||||
|
Text = " ",
|
||||||
|
Method = " ",
|
||||||
|
Function = " ",
|
||||||
|
Constructor = " ",
|
||||||
|
Field = "ﰠ ",
|
||||||
|
Variable = " ",
|
||||||
|
Class = "ﴯ ",
|
||||||
|
Interface = " ",
|
||||||
|
Module = " ",
|
||||||
|
Property = "ﰠ ",
|
||||||
|
Unit = "塞 ",
|
||||||
|
Value = " ",
|
||||||
|
Enum = " ",
|
||||||
|
Keyword = " ",
|
||||||
|
Snippet = " ",
|
||||||
|
Color = " ",
|
||||||
|
File = " ",
|
||||||
|
Reference = " ",
|
||||||
|
Folder = " ",
|
||||||
|
EnumMember = " ",
|
||||||
|
Constant = " ",
|
||||||
|
Struct = "פּ ",
|
||||||
|
Event = " ",
|
||||||
|
Operator = " ",
|
||||||
|
TypeParameter = " ",
|
||||||
|
Table = "",
|
||||||
|
Object = " ",
|
||||||
|
Tag = "",
|
||||||
|
Array = "[]",
|
||||||
|
Boolean = " ",
|
||||||
|
Number = " ",
|
||||||
|
Null = "ﳠ",
|
||||||
|
String = " ",
|
||||||
|
Calendar = "",
|
||||||
|
Watch = " ",
|
||||||
|
Package = "",
|
||||||
|
}
|
||||||
|
|
||||||
|
M.statusline_separators = {
|
||||||
|
default = {
|
||||||
|
left = "",
|
||||||
|
right = " ",
|
||||||
|
},
|
||||||
|
|
||||||
|
round = {
|
||||||
|
left = "",
|
||||||
|
right = "",
|
||||||
|
},
|
||||||
|
|
||||||
|
block = {
|
||||||
|
left = "█",
|
||||||
|
right = "█",
|
||||||
|
},
|
||||||
|
|
||||||
|
arrow = {
|
||||||
|
left = "",
|
||||||
|
right = "",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
M.devicons = {
|
||||||
|
default_icon = {
|
||||||
|
icon = "",
|
||||||
|
name = "Default",
|
||||||
|
},
|
||||||
|
|
||||||
|
c = {
|
||||||
|
icon = "",
|
||||||
|
name = "c",
|
||||||
|
},
|
||||||
|
|
||||||
|
css = {
|
||||||
|
icon = "",
|
||||||
|
name = "css",
|
||||||
|
},
|
||||||
|
|
||||||
|
deb = {
|
||||||
|
icon = "",
|
||||||
|
name = "deb",
|
||||||
|
},
|
||||||
|
|
||||||
|
Dockerfile = {
|
||||||
|
icon = "",
|
||||||
|
name = "Dockerfile",
|
||||||
|
},
|
||||||
|
|
||||||
|
html = {
|
||||||
|
icon = "",
|
||||||
|
name = "html",
|
||||||
|
},
|
||||||
|
|
||||||
|
jpeg = {
|
||||||
|
icon = "",
|
||||||
|
name = "jpeg",
|
||||||
|
},
|
||||||
|
|
||||||
|
jpg = {
|
||||||
|
icon = "",
|
||||||
|
name = "jpg",
|
||||||
|
},
|
||||||
|
|
||||||
|
js = {
|
||||||
|
icon = "",
|
||||||
|
name = "js",
|
||||||
|
},
|
||||||
|
|
||||||
|
kt = {
|
||||||
|
icon = "",
|
||||||
|
name = "kt",
|
||||||
|
},
|
||||||
|
|
||||||
|
lock = {
|
||||||
|
icon = "",
|
||||||
|
name = "lock",
|
||||||
|
},
|
||||||
|
|
||||||
|
lua = {
|
||||||
|
icon = "",
|
||||||
|
name = "lua",
|
||||||
|
},
|
||||||
|
|
||||||
|
mp3 = {
|
||||||
|
icon = "",
|
||||||
|
name = "mp3",
|
||||||
|
},
|
||||||
|
|
||||||
|
mp4 = {
|
||||||
|
icon = "",
|
||||||
|
name = "mp4",
|
||||||
|
},
|
||||||
|
|
||||||
|
out = {
|
||||||
|
icon = "",
|
||||||
|
name = "out",
|
||||||
|
},
|
||||||
|
|
||||||
|
png = {
|
||||||
|
icon = "",
|
||||||
|
name = "png",
|
||||||
|
},
|
||||||
|
|
||||||
|
py = {
|
||||||
|
icon = "",
|
||||||
|
name = "py",
|
||||||
|
},
|
||||||
|
|
||||||
|
["robots.txt"] = {
|
||||||
|
icon = "ﮧ",
|
||||||
|
name = "robots",
|
||||||
|
},
|
||||||
|
|
||||||
|
toml = {
|
||||||
|
icon = "",
|
||||||
|
name = "toml",
|
||||||
|
},
|
||||||
|
|
||||||
|
ts = {
|
||||||
|
icon = "ﯤ",
|
||||||
|
name = "ts",
|
||||||
|
},
|
||||||
|
|
||||||
|
ttf = {
|
||||||
|
icon = "",
|
||||||
|
name = "TrueTypeFont",
|
||||||
|
},
|
||||||
|
|
||||||
|
rb = {
|
||||||
|
icon = "",
|
||||||
|
name = "rb",
|
||||||
|
},
|
||||||
|
|
||||||
|
rpm = {
|
||||||
|
icon = "",
|
||||||
|
name = "rpm",
|
||||||
|
},
|
||||||
|
|
||||||
|
vue = {
|
||||||
|
icon = "﵂",
|
||||||
|
name = "vue",
|
||||||
|
},
|
||||||
|
|
||||||
|
woff = {
|
||||||
|
icon = "",
|
||||||
|
name = "WebOpenFontFormat",
|
||||||
|
},
|
||||||
|
|
||||||
|
woff2 = {
|
||||||
|
icon = "",
|
||||||
|
name = "WebOpenFontFormat2",
|
||||||
|
},
|
||||||
|
|
||||||
|
xz = {
|
||||||
|
icon = "",
|
||||||
|
name = "xz",
|
||||||
|
},
|
||||||
|
|
||||||
|
zip = {
|
||||||
|
icon = "",
|
||||||
|
name = "zip",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return M
|
||||||
50
files/nvim/nvim/lua/lsp.lua
Normal file
50
files/nvim/nvim/lua/lsp.lua
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
-- Custom warning symbols
|
||||||
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
|
for type, icon in pairs(signs) do
|
||||||
|
local hl = "DiagnosticSign" .. type
|
||||||
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Easily install LSPs with `:LSPInstall`
|
||||||
|
require("nvim-lsp-installer").setup({
|
||||||
|
automatic_installation = true,
|
||||||
|
ui = {
|
||||||
|
icons = {
|
||||||
|
server_installed = "✓",
|
||||||
|
server_pending = "➜",
|
||||||
|
server_uninstalled = "✗",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
local lsp = require('lspconfig')
|
||||||
|
|
||||||
|
-- Normal LSPs
|
||||||
|
lsp.pylsp.setup({})
|
||||||
|
lsp.texlab.setup({})
|
||||||
|
lsp.sumneko_lua.setup({})
|
||||||
|
lsp.hls.setup({})
|
||||||
|
|
||||||
|
-- Rust (use rust-tools to setup lsp, because it has more features)
|
||||||
|
local opts = {
|
||||||
|
tools = {
|
||||||
|
autoSetHints = true,
|
||||||
|
hover_with_actions = true,
|
||||||
|
inlay_hints = {
|
||||||
|
show_parameter_hints = false,
|
||||||
|
parameter_hints_prefix = "",
|
||||||
|
other_hints_prefix = "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
server = {
|
||||||
|
settings = {
|
||||||
|
["rust-analyzer"] = {
|
||||||
|
checkOnSave = {
|
||||||
|
command = "clippy"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
require('rust-tools').setup(opts)
|
||||||
45
files/nvim/nvim/lua/mappings.lua
Normal file
45
files/nvim/nvim/lua/mappings.lua
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
local map = vim.api.nvim_set_keymap
|
||||||
|
local default_opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- Telescope
|
||||||
|
local telescope = require'telescope'
|
||||||
|
local actions = require "telescope.actions"
|
||||||
|
telescope.setup({
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
},
|
||||||
|
n = {
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
map("n", "<C-f>", "<cmd> Telescope find_files<CR>", default_opts)
|
||||||
|
map("n", "<C-g>", "<cmd> Telescope live_grep<CR>", default_opts)
|
||||||
|
map("n", "<C-k>", "<cmd> Telescope keymaps<CR>", default_opts)
|
||||||
|
|
||||||
|
-- Telescope + LSP
|
||||||
|
map("n", "<leader>ls", "<cmd> Telescope lsp_workspace_symbols<CR>", default_opts)
|
||||||
|
map("n", "<leader>ld", "<cmd> Telescope lsp_definitions<CR>", default_opts)
|
||||||
|
map("n", "<leader>lr", "<cmd> Telescope lsp_references<CR>", default_opts)
|
||||||
|
map("n", "<leader>le", "<cmd> TroubleToggle<CR>", default_opts)
|
||||||
|
map("n", "<leader>la", "<cmd> lua vim.lsp.buf.code_action<CR>", default_opts)
|
||||||
|
|
||||||
|
-- Telescope + git(1)
|
||||||
|
map("n", "<leader>gs", "<cmd> Telescope git_status<CR>", default_opts)
|
||||||
|
|
||||||
|
-- cmp
|
||||||
|
local cmp = require'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
mapping = {
|
||||||
|
["<C-k>"] = cmp.mapping.select_prev_item(),
|
||||||
|
["<C-j>"] = cmp.mapping.select_next_item(),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
136
files/nvim/nvim/lua/plugins.lua
Normal file
136
files/nvim/nvim/lua/plugins.lua
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
|
||||||
|
-- TODO: null-ls (Formatting)
|
||||||
|
-- TODO: TODO Marking
|
||||||
|
-- TODO: Latex stuff (synctex, bibtex)
|
||||||
|
|
||||||
|
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
|
||||||
|
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||||
|
end
|
||||||
|
|
||||||
|
return require('packer').startup(function(use)
|
||||||
|
-- Packer can manage itself
|
||||||
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
-- Theme
|
||||||
|
use({
|
||||||
|
'sainnhe/everforest',
|
||||||
|
config = function()
|
||||||
|
vim.cmd("set background=light")
|
||||||
|
vim.cmd("let g:everforest_background = 'hard'")
|
||||||
|
vim.cmd("colorscheme everforest")
|
||||||
|
vim.cmd("set termguicolors")
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- LuaLine
|
||||||
|
use({
|
||||||
|
"nvim-lualine/lualine.nvim",
|
||||||
|
requires = { "kyazdani42/nvim-web-devicons", opt = true },
|
||||||
|
config = function()
|
||||||
|
require('lualine').setup({ options = { theme = 'everforest' } })
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Fuzzy Finder (Files etc)
|
||||||
|
use({
|
||||||
|
"nvim-telescope/telescope.nvim",
|
||||||
|
requires = { { "nvim-lua/plenary.nvim" } },
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Auto Indentation
|
||||||
|
use({
|
||||||
|
'nmac427/guess-indent.nvim',
|
||||||
|
config = function() require('guess-indent').setup {} end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Autopairs
|
||||||
|
use({
|
||||||
|
"windwp/nvim-autopairs",
|
||||||
|
config = function()
|
||||||
|
require('nvim-autopairs').setup({})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
use({
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
config = function()
|
||||||
|
require('nvim-treesitter.configs').setup({
|
||||||
|
ensure_installed = { "c", "rust", "lua", "python", "haskell" },
|
||||||
|
auto_intall = true,
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
additional_vim_regex_highlighting = false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
use("neovim/nvim-lspconfig")
|
||||||
|
use("williamboman/nvim-lsp-installer")
|
||||||
|
use("simrat39/rust-tools.nvim") -- Cooler LSP stuff for Rust
|
||||||
|
use {
|
||||||
|
"folke/trouble.nvim",
|
||||||
|
requires = {
|
||||||
|
"kyazdani42/nvim-web-devicons",
|
||||||
|
"folke/lsp-colors.nvim",
|
||||||
|
},
|
||||||
|
config = function() require("trouble").setup {} end,
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Snippets
|
||||||
|
-- TODO: texlab doenst show snippets? (happy snippets)
|
||||||
|
-- TODO: add friendly snippets
|
||||||
|
-- https://github.com/deniserdogan/dotfiles/blob/master/lua/dannzi.lua
|
||||||
|
use({
|
||||||
|
'hrsh7th/nvim-cmp',
|
||||||
|
requires = {
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
|
"L3MON4D3/LuaSnip",
|
||||||
|
"hrsh7th/cmp-path",
|
||||||
|
"hrsh7th/cmp-buffer",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local cmp = require'cmp'
|
||||||
|
cmp.setup({
|
||||||
|
-- snippet = {
|
||||||
|
-- expand = function(args)
|
||||||
|
-- require("luasnip").lsp_expand(args.body)
|
||||||
|
-- end,
|
||||||
|
-- },
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'buffer' },
|
||||||
|
},
|
||||||
|
formatting = {
|
||||||
|
format = function(_, vim_item)
|
||||||
|
local icons = require("icons").lspkind
|
||||||
|
vim_item.kind = string.format("%s %s", icons[vim_item.kind], vim_item.kind)
|
||||||
|
return vim_item
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- which-key
|
||||||
|
use {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
config = function()
|
||||||
|
require("which-key").setup { }
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
|
-- Put this at the end after all plugins
|
||||||
|
if packer_bootstrap then
|
||||||
|
require('packer').sync()
|
||||||
|
end
|
||||||
|
end)
|
||||||
11
files/nvim/nvim/lua/settings.lua
Normal file
11
files/nvim/nvim/lua/settings.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local opt = vim.opt
|
||||||
|
|
||||||
|
opt.colorcolumn = "80"
|
||||||
|
opt.cursorline = true
|
||||||
|
opt.number = true
|
||||||
|
opt.relativenumber = true
|
||||||
|
opt.scrolloff = 12
|
||||||
|
opt.signcolumn = "yes"
|
||||||
|
opt.swapfile = false
|
||||||
|
|
||||||
|
opt.smartindent = true -- autoindent new lines
|
||||||
Reference in New Issue
Block a user