Adding a neovim confing that is quite nice
This commit is contained in:
commit
d6ad21e502
3
lua/tobias/init.lua
Normal file
3
lua/tobias/init.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require("tobias.remap")
|
||||
require("tobias.set")
|
||||
require("tobias.lazy_init")
|
91
lua/tobias/lazy/colors.lua
Normal file
91
lua/tobias/lazy/colors.lua
Normal file
@ -0,0 +1,91 @@
|
||||
function ColorMyPencils(color)
|
||||
color = color or "rose-pine-moon"
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
|
||||
return {
|
||||
|
||||
{
|
||||
"erikbackman/brightburn.vim",
|
||||
},
|
||||
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = false,
|
||||
opts = {},
|
||||
config = function()
|
||||
ColorMyPencils()
|
||||
end
|
||||
},
|
||||
{
|
||||
"ellisonleao/gruvbox.nvim",
|
||||
name = "gruvbox",
|
||||
config = function()
|
||||
require("gruvbox").setup({
|
||||
terminal_colors = true, -- add neovim terminal colors
|
||||
undercurl = true,
|
||||
underline = false,
|
||||
bold = true,
|
||||
italic = {
|
||||
strings = false,
|
||||
emphasis = false,
|
||||
comments = false,
|
||||
operators = false,
|
||||
folds = false,
|
||||
},
|
||||
strikethrough = true,
|
||||
invert_selection = false,
|
||||
invert_signs = false,
|
||||
invert_tabline = false,
|
||||
invert_intend_guides = false,
|
||||
inverse = true, -- invert background for search, diffs, statuslines and errors
|
||||
contrast = "", -- can be "hard", "soft" or empty string
|
||||
palette_overrides = {},
|
||||
overrides = {},
|
||||
dim_inactive = false,
|
||||
transparent_mode = false,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
config = function()
|
||||
require("tokyonight").setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
style = "storm", -- The theme comes in three styles, `storm`, `moon`, a darker variant `night` and `day`
|
||||
transparent = true, -- Enable this to disable setting the background color
|
||||
terminal_colors = true, -- Configure the colors used when opening a `:terminal` in Neovim
|
||||
styles = {
|
||||
-- Style to be applied to different syntax groups
|
||||
-- Value is any valid attr-list value for `:help nvim_set_hl`
|
||||
comments = { italic = false },
|
||||
keywords = { italic = false },
|
||||
-- Background styles. Can be "dark", "transparent" or "normal"
|
||||
sidebars = "dark", -- style for sidebars, see below
|
||||
floats = "dark", -- style for floating windows
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"rose-pine/neovim",
|
||||
name = "rose-pine",
|
||||
config = function()
|
||||
require('rose-pine').setup({
|
||||
disable_background = true,
|
||||
styles = {
|
||||
italic = false,
|
||||
},
|
||||
})
|
||||
|
||||
ColorMyPencils();
|
||||
end
|
||||
},
|
||||
|
||||
|
||||
}
|
8
lua/tobias/lazy/init.lua
Normal file
8
lua/tobias/lazy/init.lua
Normal file
@ -0,0 +1,8 @@
|
||||
return {
|
||||
|
||||
{
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
|
||||
"eandrju/cellular-automaton.nvim",
|
||||
}
|
52
lua/tobias/lazy/lsp.lua
Normal file
52
lua/tobias/lazy/lsp.lua
Normal file
@ -0,0 +1,52 @@
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"stevearc/conform.nvim",
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/nvim-cmp",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"j-hui/fidget.nvim",
|
||||
},
|
||||
|
||||
config = function()
|
||||
require("conform").setup({
|
||||
formatters_by_ft = {
|
||||
}
|
||||
})
|
||||
local cmp = require('cmp')
|
||||
local cmp_lsp = require("cmp_nvim_lsp")
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
"force",
|
||||
{},
|
||||
vim.lsp.protocol.make_client_capabilities(),
|
||||
cmp_lsp.default_capabilities())
|
||||
|
||||
require("fidget").setup({})
|
||||
require("mason").setup()
|
||||
-- require("mason-lspconfig").setup({
|
||||
-- handlers = {
|
||||
-- function(server_name) -- default handler (optional)
|
||||
-- require("lspconfig")[server_name].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- end,
|
||||
|
||||
vim.diagnostic.config({
|
||||
-- update_in_insert = true,
|
||||
float = {
|
||||
focusable = false,
|
||||
style = "minimal",
|
||||
border = "rounded",
|
||||
source = "always",
|
||||
header = "",
|
||||
prefix = "",
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
29
lua/tobias/lazy/telescope.lua
Normal file
29
lua/tobias/lazy/telescope.lua
Normal file
@ -0,0 +1,29 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
|
||||
tag = "0.1.5",
|
||||
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
|
||||
config = function()
|
||||
require('telescope').setup({})
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>pf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>pws', function()
|
||||
local word = vim.fn.expand("<cword>")
|
||||
builtin.grep_string({ search = word })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>pWs', function()
|
||||
local word = vim.fn.expand("<cWORD>")
|
||||
builtin.grep_string({ search = word })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") })
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>vh', builtin.help_tags, {})
|
||||
end
|
||||
}
|
86
lua/tobias/lazy/treesitter.lua
Normal file
86
lua/tobias/lazy/treesitter.lua
Normal file
@ -0,0 +1,86 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = {
|
||||
"vimdoc", "lua", "bash", "yaml", -- "ansible",
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don"t have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
indent = {
|
||||
enable = true
|
||||
},
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
disable = function(lang, buf)
|
||||
if lang == "html" then
|
||||
print("disabled")
|
||||
return true
|
||||
end
|
||||
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
vim.notify(
|
||||
"File larger than 100KB treesitter disabled for performance",
|
||||
vim.log.levels.WARN,
|
||||
{title = "Treesitter"}
|
||||
)
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on "syntax" being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = { "markdown" },
|
||||
},
|
||||
})
|
||||
|
||||
local treesitter_parser_config = require("nvim-treesitter.parsers").get_parser_configs()
|
||||
treesitter_parser_config.templ = {
|
||||
install_info = {
|
||||
url = "https://github.com/vrischmann/tree-sitter-templ.git",
|
||||
files = {"src/parser.c", "src/scanner.c"},
|
||||
branch = "master",
|
||||
},
|
||||
}
|
||||
|
||||
vim.treesitter.language.register("templ", "templ")
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-context",
|
||||
after = "nvim-treesitter",
|
||||
config = function()
|
||||
require'treesitter-context'.setup{
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
multiwindow = false, -- Enable multiwindow support.
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to show for a single context
|
||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'cursor', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
-- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
separator = nil,
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||
}
|
||||
end
|
||||
}
|
||||
}
|
17
lua/tobias/lazy_init.lua
Normal file
17
lua/tobias/lazy_init.lua
Normal file
@ -0,0 +1,17 @@
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = "tobias.lazy",
|
||||
change_detection = { notify = false }
|
||||
})
|
25
lua/tobias/remap.lua
Normal file
25
lua/tobias/remap.lua
Normal file
@ -0,0 +1,25 @@
|
||||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
vim.keymap.set("n", "=ap", "ma=ap'a")
|
||||
|
||||
-- greatest remap ever
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
|
||||
-- next greatest remap ever : asbjornHaland
|
||||
vim.keymap.set({"n", "v"}, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
|
||||
vim.keymap.set({"n", "v"}, "<leader>d", "\"_d")
|
||||
|
||||
vim.keymap.set("i", "<C-c>", "<Esc>")
|
||||
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
13
lua/tobias/set.lua
Normal file
13
lua/tobias/set.lua
Normal file
@ -0,0 +1,13 @@
|
||||
vim.opt.nu = true
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
Loading…
x
Reference in New Issue
Block a user