mirror of
https://github.com/WarrenHood/dotfiles.git
synced 2025-04-29 15:45:00 +01:00
Merge branch 'main' of https://github.com/warrenhood/dotfiles
This commit is contained in:
commit
d1e39bee5f
4
neovim/.config/nvim/.luarc.json
Normal file
4
neovim/.config/nvim/.luarc.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
|
||||
"Lua.workspace.checkThirdParty": false
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
require("warrenhood.settings")
|
||||
require("warrenhood.keybinds")
|
||||
require("warrenhood.plugins")
|
||||
require("warrenhood.plugins-config")
|
||||
require("warrenhood.mason-config")
|
||||
require("warrenhood.cmp-config")
|
||||
require("warrenhood.theme")
|
||||
|
|
64
neovim/.config/nvim/lua/warrenhood/cmp-config.lua
Normal file
64
neovim/.config/nvim/lua/warrenhood/cmp-config.lua
Normal file
|
@ -0,0 +1,64 @@
|
|||
-- Setup nvim-cmp
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
end,
|
||||
vim.lsp.buf.format,
|
||||
},
|
||||
window = {
|
||||
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
["<Tab>"] = cmp.mapping(function() if cmp.visible() then cmp.select_next_item() end end),
|
||||
["<S-Tab>"] = cmp.mapping(function() if cmp.visible() then cmp.select_prev_item() end end),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" }, -- For vsnip users.
|
||||
{ name = "treesitter" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}, {
|
||||
{ name = "stylua" },
|
||||
}),
|
||||
})
|
||||
|
|
@ -11,4 +11,12 @@ map('i', '<C-Q>', '<ESC>:wq<CR>')
|
|||
map('n', '<C-S>', ':w<CR>')
|
||||
map('i', '<C-S>', '<ESC>:w<CR>')
|
||||
|
||||
-- Telescope
|
||||
local telescope_builtin = require('telescope.builtin')
|
||||
map('n', '<leader>ff', telescope_builtin.find_files)
|
||||
map('n', '<leader>fg', telescope_builtin.live_grep)
|
||||
map('n', '<leader>fb', telescope_builtin.buffers)
|
||||
map('n', '<leader>fh', telescope_builtin.help_tags)
|
||||
|
||||
-- NvimTree Toggle (File Explorer)
|
||||
map('n', '<C-B>', ':NvimTreeToggle<CR>')
|
||||
|
|
42
neovim/.config/nvim/lua/warrenhood/mason-config.lua
Normal file
42
neovim/.config/nvim/lua/warrenhood/mason-config.lua
Normal file
|
@ -0,0 +1,42 @@
|
|||
-- Setup mason and language servers
|
||||
require("mason").setup()
|
||||
|
||||
|
||||
require("mason-lspconfig").setup({
|
||||
ensure_installed = { "sumneko_lua", "rust_analyzer", "pyright" }
|
||||
})
|
||||
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
require("mason-lspconfig").setup_handlers({
|
||||
-- default handler
|
||||
function(server_name) -- default handler (optional)
|
||||
require("lspconfig")[server_name].setup {}
|
||||
end,
|
||||
-- Overrides
|
||||
["sumneko_lua"] = function()
|
||||
lspconfig.sumneko_lua.setup {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { 'vim' },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = vim.api.nvim_get_runtime_file("", true),
|
||||
},
|
||||
-- Do not send telemetry data containing a randomized but unique identifier
|
||||
telemetry = {
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
})
|
||||
|
2
neovim/.config/nvim/lua/warrenhood/plugins-config.lua
Normal file
2
neovim/.config/nvim/lua/warrenhood/plugins-config.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
-- nvim-tree setup with defaults
|
||||
require("nvim-tree").setup()
|
|
@ -17,11 +17,17 @@ local packer_bootstrap = ensure_packer()
|
|||
local use = require("packer").use
|
||||
|
||||
require("packer").startup(function()
|
||||
use("wbthomason/packer.nvim") -- Package manager
|
||||
-- Packer package manager
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
-- OneDark color scheme
|
||||
use("navarasu/onedark.nvim")
|
||||
|
||||
-- LSP Stuff
|
||||
use({
|
||||
"williamboman/mason.nvim", -- LSP Server manager etc
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
"neovim/nvim-lspconfig", -- Configurations for Nvim LSP
|
||||
"neovim/nvim-lspconfig",
|
||||
})
|
||||
|
||||
-- Autocomplete
|
||||
|
@ -33,10 +39,24 @@ require("packer").startup(function()
|
|||
use("hrsh7th/cmp-vsnip")
|
||||
use("hrsh7th/vim-vsnip")
|
||||
|
||||
-- Treesitter
|
||||
use("nvim-treesitter/nvim-treesitter")
|
||||
|
||||
-- Auto format
|
||||
use("sbdchd/neoformat")
|
||||
|
||||
-- Telescope
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.0',
|
||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||
}
|
||||
|
||||
-- nvim-tree (File Explorer)
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons', -- file icons
|
||||
},
|
||||
tag = 'nightly'
|
||||
}
|
||||
|
||||
-- Automatically set up configuration after cloning packer.nvim
|
||||
if packer_bootstrap then
|
||||
|
@ -44,88 +64,4 @@ require("packer").startup(function()
|
|||
end
|
||||
end)
|
||||
|
||||
-- Setup mason
|
||||
require("mason").setup()
|
||||
require("mason-lspconfig").setup()
|
||||
|
||||
|
||||
|
||||
|
||||
-- Setup nvim-cmp
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
|
||||
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
|
||||
-- require('snippy').expand_snippet(args.body) -- For `snippy` users.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
|
||||
end,
|
||||
vim.lsp.buf.format,
|
||||
},
|
||||
window = {
|
||||
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "vsnip" }, -- For vsnip users.
|
||||
-- { name = 'luasnip' }, -- For luasnip users.
|
||||
-- { name = 'ultisnips' }, -- For ultisnips users.
|
||||
-- { name = 'snippy' }, -- For snippy users.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Set configuration for specific filetype.
|
||||
cmp.setup.filetype("gitcommit", {
|
||||
sources = cmp.config.sources({
|
||||
{ name = "cmp_git" }, -- You can specify the `cmp_git` source if you were installed it.
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ "/", "?" }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}, {
|
||||
{ name = "stylua" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
-- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
--for lsp_server_name,v in pairs(require('lspconfig')) do
|
||||
-- require('lspconfig')[lsp_server_name].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
-- end
|
||||
-- require('lspconfig')['stylua'].setup {
|
||||
-- capabilities = capabilities
|
||||
-- }
|
||||
|
|
|
@ -18,3 +18,13 @@ o.smartcase = true
|
|||
|
||||
-- Enable mouse
|
||||
o.mouse = 'a'
|
||||
|
||||
-- Enable termguicolors
|
||||
o.termguicolors = true
|
||||
|
||||
-- Use space for leader key
|
||||
g.mapleader = " "
|
||||
|
||||
-- Disable netrw
|
||||
g.loaded_netrw = 1
|
||||
g.loaded_netrwPlugin = 1
|
||||
|
|
5
neovim/.config/nvim/lua/warrenhood/theme.lua
Normal file
5
neovim/.config/nvim/lua/warrenhood/theme.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
-- OneDark Darker theme
|
||||
require('onedark').setup {
|
||||
style = 'darker'
|
||||
}
|
||||
require('onedark').load()
|
Loading…
Reference in a new issue