Updated Neovim config to lua

This commit is contained in:
Jesper Fussing Mørk 2022-08-25 14:11:17 +02:00
parent 80a176b9b5
commit d47ae6c9a7
7 changed files with 146 additions and 0 deletions

View File

@ -0,0 +1,12 @@
require('plugins')
require('visuals')
require('completion')
require('python')
require('keybindings')
vim.opt.tabstop = 2
vim.opt.shiftwidth = 2
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.clipboard = 'unnamedplus'
vim.opt.smartindent = true

View File

@ -0,0 +1,26 @@
local cmp = require("cmp")
cmp.setup({
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
end,
},
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 }),
}),
sources = cmp.config.sources({
{ name = 'copilot', group_index = 2 },
{ name = 'nvim_lsp', group_index = 2 },
}, {
{ name = 'buffer' },
})
})

View File

@ -0,0 +1,12 @@
vim.api.nvim_set_keymap('n', '<M-1>',
"<cmd>lua require('fzf-lua').files()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap('n', '<M-2>',
"<cmd>lua require('fzf-lua').buffers()<CR>",
{ noremap = true, silent = true }
)
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)

View File

@ -0,0 +1,39 @@
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Visuals
use 'shaunsingh/nord.nvim'
use 'kyazdani42/nvim-web-devicons'
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true }
}
-- File Handling
use { 'ibhagwan/fzf-lua',
requires = { 'kyazdani42/nvim-web-devicons' }
}
-- Completion
use 'github/copilot.vim'
use 'hrsh7th/nvim-cmp'
use 'L3MON4D3/LuaSnip'
use {
"zbirenbaum/copilot.lua",
event = {"VimEnter"},
config = function()
vim.defer_fn(function()
require("copilot").setup()
end, 100)
end,
}
use {
"zbirenbaum/copilot-cmp",
module = "copilot_cmp",
}
use 'hrsh7th/cmp-nvim-lsp'
-- Python
use 'neovim/nvim-lspconfig'
end)

View File

@ -0,0 +1,6 @@
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
require'lspconfig'.pyright.setup{
capabilities = capabilities,
}

View File

@ -0,0 +1,8 @@
def __main__():
print("Hello World")
return 0
if __name__ == "__main__":
__main__()
print("Hello World")
return 0 # This is a comment

View File

@ -0,0 +1,43 @@
vim.opt.termguicolors = true
vim.cmd[[colorscheme nord]]
require('lualine').setup {
options = {
icons_enabled = false,
theme = 'nord',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'encoding', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}