Initial experiments with Lua config
This commit is contained in:
commit
20954190a8
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
lazy-lock.json
|
31
init.lua
Normal file
31
init.lua
Normal file
@ -0,0 +1,31 @@
|
||||
require('settings')
|
||||
require('mappings')
|
||||
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not 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)
|
||||
|
||||
require('lazy').setup({
|
||||
import = 'plugins',
|
||||
change_detection = {
|
||||
enabled = false,
|
||||
},
|
||||
})
|
||||
-- {
|
||||
-- { 'nvim-telescope/telescope.nvim', dependencies = { 'nvim-lua/plenary.nvim' } },
|
||||
-- { 'neovim/nvim-lspconfig' },
|
||||
-- })
|
||||
|
||||
-- require('telescope').setup()
|
||||
-- require('lspconfig').clangd.setup()
|
||||
-- require('lspconfig').cmake.setup()
|
||||
-- require('lspconfig').lua_ls.setup()
|
23
lua/mappings.lua
Normal file
23
lua/mappings.lua
Normal file
@ -0,0 +1,23 @@
|
||||
vim.g.mapleader = ' '
|
||||
|
||||
-- Quick write
|
||||
vim.keymap.set('n', '<leader>w', ':w!<CR>', {noremap = true})
|
||||
|
||||
-- Treat long lines as line containing breaks
|
||||
vim.keymap.set('n', 'j', 'gj', {noremap = true})
|
||||
vim.keymap.set('n', 'k', 'gk', {noremap = true})
|
||||
|
||||
vim.keymap.set('n', '<leader>tn', ':tabnew<Space>', {noremap = true})
|
||||
vim.keymap.set('n', '<leader>tc', ':tabclose<CR>', {noremap = true})
|
||||
vim.keymap.set('n', '<leader>to', ':tabonly<CR>', {noremap = true})
|
||||
vim.keymap.set('n', '<leader>tm', ':tabmove<Space>', {noremap = true})
|
||||
|
||||
-- Quickly access spelling menu
|
||||
vim.keymap.set('i', '<C-s>', '<C-g>u<C-X>s', {noremap = true})
|
||||
vim.keymap.set('n', '<C-s>', 'i<C-g>u<C-X>s', {noremap = true})
|
||||
|
||||
-- Clear search highlights
|
||||
vim.keymap.set('n', '<leader><Space>', ':nohlsearch<CR>', {noremap = true})
|
||||
|
||||
-- Disable 'Q' from opening Ex mode
|
||||
vim.keymap.set('n', 'Q', '<nop>', {noremap = true})
|
11
lua/plugins/colorscheme.lua
Normal file
11
lua/plugins/colorscheme.lua
Normal file
@ -0,0 +1,11 @@
|
||||
return {
|
||||
'rose-pine/neovim', name = 'rose-pine',
|
||||
config = function()
|
||||
require('rose-pine').setup({
|
||||
styles = {
|
||||
transparency = true,
|
||||
},
|
||||
})
|
||||
vim.cmd('colorscheme rose-pine')
|
||||
end
|
||||
}
|
46
lua/plugins/completions.lua
Normal file
46
lua/plugins/completions.lua
Normal file
@ -0,0 +1,46 @@
|
||||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
'neovim/nvim-lspconfig',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-cmdline',
|
||||
'hrsh7th/nvim-cmp',
|
||||
|
||||
'folke/neodev.nvim',
|
||||
|
||||
-- TODO: https://github.com/j-hui/fidget.nvim
|
||||
-- TODO: https://github.com/nvimtools/none-ls.nvim
|
||||
-- TODO: https://github.com/mfussenegger/nvim-dap
|
||||
-- TODO: https://github.com/rcarriga/nvim-dap-ui
|
||||
},
|
||||
config = function()
|
||||
require('neodev').setup()
|
||||
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'clangd',
|
||||
'cmake',
|
||||
'lua_ls',
|
||||
},
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({})
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
require('cmp').setup({
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
-- TODO: snippets
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
9
lua/plugins/statusline.lua
Normal file
9
lua/plugins/statusline.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
-- config = function()
|
||||
-- require('lualine').setup()
|
||||
-- end
|
||||
}
|
66
lua/plugins/treesitter.lua
Normal file
66
lua/plugins/treesitter.lua
Normal file
@ -0,0 +1,66 @@
|
||||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
config = function()
|
||||
require('nvim-treesitter').setup()
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
configs.setup({
|
||||
ensure_installed = {
|
||||
"asm",
|
||||
"bash",
|
||||
"c",
|
||||
"cmake",
|
||||
"cpp",
|
||||
"css",
|
||||
"csv",
|
||||
"cuda",
|
||||
"diff",
|
||||
"disassembly",
|
||||
"dockerfile",
|
||||
"dot",
|
||||
"doxygen",
|
||||
"git_config",
|
||||
"git_rebase",
|
||||
"gitattributes",
|
||||
"gitignore",
|
||||
"glsl",
|
||||
"gpg",
|
||||
"hlsl",
|
||||
"html",
|
||||
"ini",
|
||||
"javascript",
|
||||
"jq",
|
||||
"json",
|
||||
"llvm",
|
||||
"lua",
|
||||
"make",
|
||||
"meson",
|
||||
"ninja",
|
||||
"objc",
|
||||
"objdump",
|
||||
"printf",
|
||||
"proto",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"requirements",
|
||||
"rst",
|
||||
"ssh_config",
|
||||
"strace",
|
||||
"tmux",
|
||||
"toml",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"xml",
|
||||
"yaml",
|
||||
},
|
||||
sync_install = false,
|
||||
highlight = {
|
||||
enable = true,
|
||||
},
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
end
|
||||
}
|
21
lua/settings.lua
Normal file
21
lua/settings.lua
Normal file
@ -0,0 +1,21 @@
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.sidescrolloff = 5
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = 'nbsp:⦸,trail:·,tab:▹┄,extends:»,precedes:«'
|
||||
vim.opt.wrap = true
|
||||
vim.opt.linebreak = true
|
||||
vim.opt.showbreak = '↳ '
|
||||
vim.opt.showmode = false
|
||||
vim.opt.writebackup = false
|
||||
vim.opt.hlsearch = true
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.fileignorecase = false
|
||||
vim.opt.hidden = true
|
||||
vim.opt.splitbelow = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.switchbuf = 'usetab'
|
||||
vim.opt.autowrite = true
|
||||
vim.opt.joinspaces = false
|
||||
vim.opt.mouse = 'a'
|
Loading…
x
Reference in New Issue
Block a user