feat: initial commit
This commit is contained in:
commit
dadc8060ca
4
default.nix
Normal file
4
default.nix
Normal file
@ -0,0 +1,4 @@
|
||||
{ pkgs ? import <nixpkgs> {} }: with pkgs;
|
||||
mkShell {
|
||||
buildInputs = [ lua-language-server ];
|
||||
}
|
||||
11
init.lua
Normal file
11
init.lua
Normal file
@ -0,0 +1,11 @@
|
||||
require 'plugins'
|
||||
|
||||
if vim.g.neovide then
|
||||
require 'neovide'
|
||||
end
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = false
|
||||
vim.opt.relativenumber = true
|
||||
28
lazy-lock.json
Normal file
28
lazy-lock.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp-under-comparator": { "branch": "master", "commit": "6857f10272c3cfe930cece2afa2406e1385bfef8" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"diffview.nvim": { "branch": "main", "commit": "72c6983f422689f310b379a04fd555799b0d7cfc" },
|
||||
"direnv.vim": { "branch": "master", "commit": "ab2a7e08dd630060cd81d7946739ac7442a4f269" },
|
||||
"drex.nvim": { "branch": "main", "commit": "acccc1225e61a3977d86a590420b868e708cc64a" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "ce9a2e8eaba5649b553529c5498acb43a6c317cd" },
|
||||
"neogit": { "branch": "master", "commit": "bc0c609e3568a171e0549b449aa1b2b4b5b20e8c" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "5260e5e8ecadaf13e6b82cf867a909f54e15fd07" },
|
||||
"nvim-dap": { "branch": "master", "commit": "5a2f7121869394502521c52b2bc581ab22c69447" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "eadcee1573ca9d0e0cd36a49f620186a8dfdc607" },
|
||||
"nvim-surround": { "branch": "main", "commit": "79aaa42da1f698ed31bcbe7f83081f69dca7ba17" },
|
||||
"nvim-test": { "branch": "main", "commit": "e06f3d029ee161f3ead6193cf27354d1eb8723c3" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "30de5e7e9486fb1b1b8c2a1e71052b13f94f1cb0" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "e37bb1feee9e7320c76050a55443fa843b4b6f83" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" },
|
||||
"rose-pine": { "branch": "main", "commit": "b6fe88c3282cf9f117a3e836d761c2d78d02f417" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "676187908a1ce35ffcd727c654ed68d851299d3e" },
|
||||
"suda.vim": { "branch": "master", "commit": "b97fab52f9cdeabe2bbb5eb98d82356899f30829" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "4aed63995a69e343b068c7469491a8d1592c339f" }
|
||||
}
|
||||
21
lua/.luarc.json
Normal file
21
lua/.luarc.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"workspace.library": [
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/neodev.nvim/types/stable",
|
||||
"/nix/store/ax8sn0k1ranydy6f6w21lcvszipc117z-neovim-unwrapped-0.9.1/share/nvim/runtime/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/opt/nvim-cmp/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/opt/nvim-lspconfig/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/LuaSnip/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/cmp-buffer/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/cmp-cmdline/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/cmp-path/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/cmp_luasnip/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/neodev.nvim/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/nvim-cmp/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/nvim-lspconfig/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/packer.nvim/lua",
|
||||
"/home/fey/.local/share/nvim/site/pack/packer/start/rose-pine/lua",
|
||||
"/home/fey/.config/nvim/lua",
|
||||
"${3rd}/luv/library"
|
||||
]
|
||||
}
|
||||
23
lua/cmp-setup.lua
Normal file
23
lua/cmp-setup.lua
Normal file
@ -0,0 +1,23 @@
|
||||
local cmp = require 'cmp'
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end
|
||||
},
|
||||
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 = 'buffer' },
|
||||
})
|
||||
})
|
||||
58
lua/lsp-setup.lua
Normal file
58
lua/lsp-setup.lua
Normal file
@ -0,0 +1,58 @@
|
||||
require('neodev').setup({})
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
lspconfig.lua_ls.setup {}
|
||||
lspconfig.tsserver.setup {}
|
||||
|
||||
-- Global mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist)
|
||||
|
||||
-- Use LspAttach autocommand to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('UserLspConfig', {}),
|
||||
callback = function(ev)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.bo[ev.buf].omnifunc = 'v:lua.vim.lsp.omnifunc'
|
||||
|
||||
-- Buffer local mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local opts = { buffer = ev.buf }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, opts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, opts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, opts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, opts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, opts)
|
||||
vim.keymap.set({ 'n', 'v' }, '<space>ca', vim.lsp.buf.code_action, opts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, opts)
|
||||
vim.keymap.set('n', '<space>f', function()
|
||||
vim.lsp.buf.format { async = true }
|
||||
end, opts)
|
||||
end,
|
||||
})
|
||||
|
||||
local rt = require("rust-tools")
|
||||
|
||||
rt.setup({
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Hover actions
|
||||
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
4
lua/neovide.lua
Normal file
4
lua/neovide.lua
Normal file
@ -0,0 +1,4 @@
|
||||
vim.o.guifont = "Monoid Nerd Font:h12"
|
||||
vim.g.neovide_scale_factor = 0.75
|
||||
vim.g.neovide_cursor_animation_length = 0
|
||||
|
||||
88
lua/plugins.lua
Normal file
88
lua/plugins.lua
Normal file
@ -0,0 +1,88 @@
|
||||
-- bootstrap lazy
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or 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)
|
||||
|
||||
return require('lazy').setup {
|
||||
spec = {
|
||||
{
|
||||
'rose-pine/neovim',
|
||||
name = 'rose-pine',
|
||||
config = function() vim.cmd [[colorscheme rose-pine-moon]] end
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
build = "make install_jsregexp"
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
config = function() require 'cmp-setup' end
|
||||
},
|
||||
"lukas-reineke/cmp-under-comparator",
|
||||
'folke/neodev.nvim',
|
||||
{ 'neovim/nvim-lspconfig', config = function() require 'lsp-setup' end, after = 'neodev.nvim' },
|
||||
'simrat39/rust-tools.nvim',
|
||||
'mfussenegger/nvim-dap',
|
||||
{
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
},
|
||||
{
|
||||
"NeogitOrg/neogit",
|
||||
version = "v0.0.1",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim", -- required
|
||||
"nvim-telescope/telescope.nvim", -- optional
|
||||
"sindrets/diffview.nvim", -- optional
|
||||
},
|
||||
config = true,
|
||||
},
|
||||
'lambdalisue/suda.vim',
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||
config = function()
|
||||
require("nvim-surround").setup({})
|
||||
end
|
||||
},
|
||||
{
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config = function() require 'nvim-treesitter.configs'.setup({}) end,
|
||||
build = function()
|
||||
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
|
||||
ts_update()
|
||||
end,
|
||||
},
|
||||
{
|
||||
'theblob42/drex.nvim',
|
||||
dependencies = 'kyazdani42/nvim-web-devicons',
|
||||
config = function()
|
||||
vim.keymap.set('n', '<F2>', ':DrexDrawerToggle<CR>')
|
||||
end
|
||||
},
|
||||
{
|
||||
"klen/nvim-test",
|
||||
config = function()
|
||||
require('nvim-test').setup()
|
||||
end
|
||||
},
|
||||
'direnv/direnv.vim'
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user