New neovim config based off theprimeagen

This commit is contained in:
z3rOR0ne 2022-12-18 18:17:43 -08:00
parent 74983413b8
commit 393c9eaa8a
19 changed files with 810 additions and 0 deletions

View file

@ -0,0 +1 @@
require('nvim-autopairs').setup()

View file

@ -0,0 +1 @@
require'colorizer'.setup()

View file

@ -0,0 +1,9 @@
function ColorMyPencils(color)
color = color or "nord"
vim.cmd.colorscheme(color)
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
end
ColorMyPencils()

View file

@ -0,0 +1,104 @@
local lsp = require("lsp-zero")
lsp.preset("recommended")
lsp.ensure_installed({
'tsserver',
'eslint',
'sumneko_lua',
'rust_analyzer',
})
-- Fix Undefined global 'vim'
lsp.configure('sumneko_lua', {
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})
local cmp = require('cmp')
cmp.setup({
window = {
completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(),
}
})
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
})
-- disable completion with tab
-- this helps with copilot setup
cmp_mappings['<Tab>'] = nil
cmp_mappings['<S-Tab>'] = nil
lsp.setup_nvim_cmp({
mapping = cmp_mappings
})
lsp.set_preferences({
suggest_lsp_servers = false,
sign_icons = {
error = 'E',
warn = 'W',
hint = 'H',
info = 'I'
}
})
lsp.on_attach(function(client, bufnr)
local opts = {buffer = bufnr, remap = false}
if client.name == "eslint" then
vim.cmd.LspStop('eslint')
return
end
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
vim.keymap.set("n", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
vim.keymap.set("n", "<leader>vd", vim.diagnostic.open_float, opts)
vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts)
vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts)
vim.keymap.set("n", "<leader>vca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
end)
-- function that is used with keybinding cm to toggle autocompletion
Mode = require('cmp.types').cmp.TriggerEvent.TextChanged
function SetAutoCmp(mode)
if mode then
cmp.setup({
completion = {
autocomplete = { Mode }
}
})
Mode = false
else
cmp.setup({
completion = {
autocomplete = Mode
}
})
Mode = require('cmp.types').cmp.TriggerEvent.TextChanged
end
end
SetAutoCmp(Mode)
lsp.setup()
vim.diagnostic.config({
virtual_text = true,
})

View file

@ -0,0 +1,3 @@
require('lualine').setup({
options = { them = 'nord' }
})

View file

@ -0,0 +1,2 @@
vim.g.mkdp_browser = 'librewolf'
vim.g.mkdp_theme = 'dark'

View file

@ -0,0 +1 @@
vim.opt.cursorcolumn = true

View file

@ -0,0 +1,6 @@
-- Create Default Mappings for NerdCommenter
vim.g.NERDCreateDefaultMappings = 1
-- Add spaces after NerdCommenter delimiters by default
vim.g.NERDSpaceDelims = 1
-- Enable Comments with Italics
-- vim.cmd[[highlight Comment cterm=italic gui=italic]]

View file

@ -0,0 +1,117 @@
-- Nvim_Tree configuration: -- setup with all defaults
-- each of these are documented in `:help nvim-tree.OPTION_NAME`
require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS
auto_reload_on_write = true,
disable_netrw = false,
-- hide_root_folder = false,
hijack_cursor = false,
hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false,
open_on_setup = false,
open_on_setup_file = false,
open_on_tab = false,
sort_by = "name",
update_cwd = false,
view = {
width = 25,
-- height = 30,
side = "right",
preserve_window_proportions = true,
number = false,
relativenumber = false,
signcolumn = "yes",
mappings = {
custom_only = false,
list = {
-- user mappings go here
},
},
},
renderer = {
indent_markers = {
enable = false,
icons = {
corner = "",
edge = "",
none = " ",
},
},
icons = {
webdev_colors = true,
},
},
hijack_directories = {
enable = true,
auto_open = true,
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {},
},
ignore_ft_on_setup = {},
system_open = {
cmd = nil,
args = {},
},
diagnostics = {
enable = false,
show_on_dirs = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
},
},
filters = {
dotfiles = false,
custom = {},
exclude = {},
},
git = {
enable = true,
ignore = true,
timeout = 400,
},
actions = {
use_system_clipboard = true,
change_dir = {
enable = true,
global = false,
restrict_above_cwd = false,
},
open_file = {
quit_on_open = false,
resize_window = false,
window_picker = {
enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" },
},
},
},
},
trash = {
cmd = "trash",
require_confirm = true,
},
log = {
enable = false,
truncate = false,
types = {
all = false,
config = false,
copy_paste = false,
diagnostics = false,
git = false,
profile = false,
},
},
} -- END_DEFAULT_OPTS for Nvim_Tree
-- Automatically closes Nvim tree if last window open
vim.cmd[[autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]]

View file

@ -0,0 +1 @@
vim.g.rainbow_active = 1

View file

@ -0,0 +1,12 @@
-- Enable use of ripgrep
require('nvim-ripgrep').setup{
runner = require('nvim-ripgrep.run').ripgrep, -- grep command
prompt = " ", -- prompt
window = {
width = 0.8,
border = "rounded",
};
open_qf_fn = function()
return vim.api.nvim_command('copen')
end,
}

View file

@ -0,0 +1,22 @@
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "rust", "vim", "vue", "wgsl", "yaml",},
-- 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,
highlight = {
-- `false` will disable the whole extension
enable = true,
-- 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 = false,
},
}

View file

@ -0,0 +1,2 @@
-- Use experimental features of vim-smoothie (gg and G)
vim.g.smoothie_experimental_mappings = 1