updated nvim config
This commit is contained in:
parent
e0c8d6457f
commit
acf6213415
8 changed files with 181 additions and 19 deletions
1
.config/nvim/after/plugin/fugitive.lua
Normal file
1
.config/nvim/after/plugin/fugitive.lua
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
vim.keymap.set("n", "<leader>gs", vim.cmd.Git);
|
||||||
40
.config/nvim/after/plugin/lsp.lua
Normal file
40
.config/nvim/after/plugin/lsp.lua
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
require('mason').setup({
|
||||||
|
ui = {
|
||||||
|
border = 'rounded'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
-- Install language servers
|
||||||
|
require('mason-lspconfig').setup {
|
||||||
|
ensure_installed = {
|
||||||
|
'lua_ls', 'clangd', 'pylsp', 'yamlls'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
local lsp = require('lsp-zero').preset({})
|
||||||
|
|
||||||
|
lsp.on_attach(function(client, bufnr)
|
||||||
|
lsp.default_keymaps({buffer = bufnr})
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- (Optional) Configure lua language server for neovim
|
||||||
|
require('lspconfig').lua_ls.setup(lsp.nvim_lua_ls())
|
||||||
|
|
||||||
|
lsp.setup()
|
||||||
|
|
||||||
|
local cmp = require('cmp')
|
||||||
|
local cmp_action= require('lsp-zero').cmp_action()
|
||||||
|
|
||||||
|
-- configure auto complete key
|
||||||
|
cmp.setup({
|
||||||
|
mapping = {
|
||||||
|
['<Tab>'] = cmp_action.tab_complete(),
|
||||||
|
['<S-Tab>'] = cmp_action.select_prev_or_fallback(),
|
||||||
|
['<C-e>'] = cmp.mapping.abort(),
|
||||||
|
['<C-space>'] = cmp.mapping.complete(),
|
||||||
|
['<C-j>'] = cmp.mapping.scroll_docs(1),
|
||||||
|
['<C-k>'] = cmp.mapping.scroll_docs(-1),
|
||||||
|
},
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
require'nvim-treesitter.configs'.setup {
|
require('nvim-treesitter.configs').setup {
|
||||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||||
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "cpp", "python", "yaml" },
|
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "cpp", "python", "yaml" },
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,4 @@
|
||||||
require("lennartalff.remap")
|
require('lennartalff.remap')
|
||||||
print("hello from my package")
|
require('lennartalff.packer')
|
||||||
|
require('lennartalff.set')
|
||||||
|
vim.cmd('colorscheme rose-pine')
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,43 @@
|
||||||
vim.cmd [[packadd packer.nvim]]
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
|
||||||
return require('packer').startup(function(use)
|
return require('packer').startup(function(use)
|
||||||
-- Packer can manage itself
|
-- Packer can manage itself
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
use {
|
use {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
||||||
-- or , branch = '0.1.x',
|
-- or , branch = '0.1.x',
|
||||||
requires = { {'nvim-lua/plenary.nvim'} }
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
}
|
}
|
||||||
use({ 'rose-pine/neovim', as = 'rose-pine' })
|
use({ 'rose-pine/neovim', as = 'rose-pine' })
|
||||||
|
|
||||||
vim.cmd('colorscheme rose-pine')
|
use {
|
||||||
use {
|
'nvim-treesitter/nvim-treesitter',
|
||||||
'nvim-treesitter/nvim-treesitter',
|
run = function()
|
||||||
run = function()
|
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
|
||||||
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
|
ts_update()
|
||||||
ts_update()
|
end,
|
||||||
end,
|
}
|
||||||
}
|
use 'tpope/vim-fugitive'
|
||||||
|
use {
|
||||||
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
|
branch = 'v2.x',
|
||||||
|
requires = {
|
||||||
|
-- LSP Support
|
||||||
|
{'neovim/nvim-lspconfig'}, -- Required
|
||||||
|
{ -- Optional
|
||||||
|
'williamboman/mason.nvim',
|
||||||
|
run = function()
|
||||||
|
pcall(vim.cmd, 'MasonUpdate')
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||||
|
|
||||||
|
-- Autocompletion
|
||||||
|
{'hrsh7th/nvim-cmp'}, -- Required
|
||||||
|
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||||
|
{'L3MON4D3/LuaSnip'}, -- Required
|
||||||
|
{'mhartington/formatter.nvim'},
|
||||||
|
}
|
||||||
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,34 @@
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||||
|
|
||||||
|
-- move selected text
|
||||||
|
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')
|
||||||
|
|
||||||
|
-- yank to clipboard
|
||||||
|
vim.keymap.set('n', '<leader>y', '"+y')
|
||||||
|
vim.keymap.set('v', '<leader>y', '"+y')
|
||||||
|
|
||||||
|
-- delete to void
|
||||||
|
vim.keymap.set('n', '<leader>d', '"_d')
|
||||||
|
vim.keymap.set('v', '<leader>d', '"_d')
|
||||||
|
|
||||||
|
vim.keymap.set('i', '<C-c>', '<Esc>')
|
||||||
|
|
||||||
|
-- avoid accidentally closing everything!
|
||||||
|
vim.keymap.set('n', 'Q', '<nop>')
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>f', function()
|
||||||
|
vim.lsp.buf.format()
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- quickfix navigation
|
||||||
|
vim.keymap.set('n', '<C-k>', '<cmd>cnext<CR>zz')
|
||||||
|
vim.keymap.set('n', '<C-j>', '<cmd>cprev<CR>zz')
|
||||||
|
vim.keymap.set('n', '<leader>k', '<cmd>lnext<CR>zz')
|
||||||
|
vim.keymap.set('n', '<leader>j', '<cmd>lprev<CR>zz')
|
||||||
|
|
|
||||||
21
.config/nvim/lua/lennartalff/set.lua
Normal file
21
.config/nvim/lua/lennartalff/set.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
vim.opt.guicursor = ''
|
||||||
|
|
||||||
|
-- line numbers
|
||||||
|
vim.opt.nu = true
|
||||||
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- default indentation
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.softtabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
|
||||||
|
vim.opt.smartindent = true
|
||||||
|
|
||||||
|
vim.opt.wrap = false
|
||||||
|
|
||||||
|
vim.opt.scrolloff = 8
|
||||||
|
vim.opt.signcolumn = 'yes'
|
||||||
|
vim.opt.updatetime = 500
|
||||||
|
vim.opt.colorcolumn = '80'
|
||||||
|
|
||||||
|
|
@ -74,6 +74,46 @@ end
|
||||||
time([[try_loadstring definition]], false)
|
time([[try_loadstring definition]], false)
|
||||||
time([[Defining packer_plugins]], true)
|
time([[Defining packer_plugins]], true)
|
||||||
_G.packer_plugins = {
|
_G.packer_plugins = {
|
||||||
|
LuaSnip = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||||
|
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||||
|
},
|
||||||
|
["cmp-nvim-lsp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||||
|
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||||
|
},
|
||||||
|
["formatter.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/formatter.nvim",
|
||||||
|
url = "https://github.com/mhartington/formatter.nvim"
|
||||||
|
},
|
||||||
|
["lsp-zero.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim",
|
||||||
|
url = "https://github.com/VonHeikemen/lsp-zero.nvim"
|
||||||
|
},
|
||||||
|
["mason-lspconfig.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||||
|
},
|
||||||
|
["mason.nvim"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||||
|
url = "https://github.com/williamboman/mason.nvim"
|
||||||
|
},
|
||||||
|
["nvim-cmp"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||||
|
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||||
|
},
|
||||||
|
["nvim-lspconfig"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||||
|
url = "https://github.com/neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
["nvim-treesitter"] = {
|
["nvim-treesitter"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||||
|
|
@ -98,6 +138,11 @@ _G.packer_plugins = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||||
|
},
|
||||||
|
["vim-fugitive"] = {
|
||||||
|
loaded = true,
|
||||||
|
path = "/home/lennartalff/.local/share/nvim/site/pack/packer/start/vim-fugitive",
|
||||||
|
url = "https://github.com/tpope/vim-fugitive"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue