nvim: Switch to lua for all the things

This commit is contained in:
2023-10-21 12:54:32 +02:00
parent 7c6fd745cd
commit 059ac7737b
10 changed files with 731 additions and 296 deletions

View File

@ -0,0 +1,7 @@
local builtin = require('telescope.builtin')
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
vim.keymap.set('n', '<leader>fs', builtin.treesitter, {}) -- find symbols
vim.keymap.set('n', 'U', ":redo<Enter>", {}) -- find symbols

View File

@ -0,0 +1,52 @@
local opt = vim.opt
-- Use system clipboard
vim.opt.clipboard="unnamedplus"
-- [[ Context ]]
opt.colorcolumn = '100' -- str: Show col for max line length
opt.number = true -- bool: Show line numbers
opt.relativenumber = true -- bool: Show relative line numbers
opt.scrolloff = 4 -- int: Min num lines of context
opt.signcolumn = "yes" -- str: Show the sign column
-- [[ Filetypes ]]
opt.encoding = 'utf8' -- str: String encoding to use
opt.fileencoding = 'utf8' -- str: File encoding to use
-- [[ Theme ]]
opt.syntax = "ON" -- str: Allow syntax highlighting
opt.termguicolors = true -- bool: If term supports ui color then enable
-- [[ Search ]]
opt.ignorecase = true -- bool: Ignore case in search patterns
opt.smartcase = true -- bool: Override ignorecase if search contains capitals
opt.incsearch = true -- bool: Use incremental search
opt.hlsearch = false -- bool: Highlight search matches
-- [[ Whitespace ]]
-- opt.expandtab = true -- bool: Use spaces instead of tabs
opt.shiftwidth = 4 -- num: Size of an indent
opt.softtabstop = 4 -- num: Number of spaces tabs count for in insert mode
opt.tabstop = 4 -- num: Number of spaces tabs count for
-- [[ Splits ]]
opt.splitright = true -- bool: Place new window to right of current one
opt.splitbelow = true -- bool: Place new window below the current one
--Set completeopt to have a better completion experience
-- :help completeopt
-- menuone: popup even when there's only one match
-- noinsert: Do not insert text until a selection is made
-- noselect: Do not select, force to select one from the menu
-- shortness: avoid showing extra messages when using completion
-- updatetime: set updatetime for CursorHold
vim.opt.completeopt = {'menuone', 'noselect', 'noinsert'}
vim.opt.shortmess = vim.opt.shortmess + { c = true}
vim.api.nvim_set_option('updatetime', 300)
-- Uncomment to enable treesitter folding by default
--vim.wo.foldmethod = 'expr'
--vim.wo.foldexpr = 'nvim_treesitter#foldexpr()'

View File

@ -0,0 +1,116 @@
-- vim.cmd([[
-- augroup packer_user_config
-- autocmd!
-- autocmd BufWritePost plugins.lua source <afile> | PackerCompile
-- augroup end
-- ]])
return require('packer').startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Simple plugins can be specified as strings
use 'rstacruz/vim-closer'
-- Lazy loading:
-- Load on specific commands
use {'tpope/vim-dispatch', opt = true, cmd = {'Dispatch', 'Make', 'Focus', 'Start'}}
-- Load on an autocommand event
use {'andymass/vim-matchup', event = 'VimEnter'}
-- Load on a combination of conditions: specific filetypes or commands
-- Also run code after load (see the "config" key)
use {
'w0rp/ale',
ft = {'sh', 'zsh', 'bash', 'c', 'cpp', 'cmake', 'html', 'markdown', 'racket', 'vim', 'tex'},
cmd = 'ALEEnable',
config = 'vim.cmd[[ALEEnable]]'
}
-- Plugins can have dependencies on other plugins
use {
'haorenW1025/completion-nvim',
opt = true,
requires = {{'hrsh7th/vim-vsnip', opt = true}, {'hrsh7th/vim-vsnip-integ', opt = true}}
}
-- Plugins can also depend on rocks from luarocks.org:
--use {
-- 'my/supercoolplugin',
-- rocks = {'lpeg', {'lua-cjson', version = '2.1.0'}}
--}
-- You can specify rocks in isolation
use_rocks 'penlight'
use_rocks {'lua-resty-http', 'lpeg'}
-- Local plugins can be included
--use '~/projects/personal/hover.nvim'
-- Plugins can have post-install/update hooks
use {'iamcco/markdown-preview.nvim', run = 'cd app && yarn install', cmd = 'MarkdownPreview'}
-- Post-install/update hook with neovim command
use 'nvim-treesitter/nvim-treesitter'
-- Post-install/update hook with call of vimscript function with argument
use { 'glacambre/firenvim', run = function() vim.fn['firenvim#install'](0) end }
-- Use specific branch, dependency and run lua file after load
--use {
-- 'glepnir/galaxyline.nvim', branch = 'main', config = function() require'statusline' end,
-- requires = {'kyazdani42/nvim-web-devicons'}
--}
-- Use dependency and run lua function after load
--use {
-- 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' },
-- config = function() require('gitsigns').setup() end
--}
-- You can specify multiple plugins in a single call
use {'tjdevries/colorbuddy.vim', {'nvim-treesitter/nvim-treesitter', opt = true}}
-- You can alias plugin names
use {'dracula/vim', as = 'dracula'}
-- example plugins above
-- my stuff below
use 'ellisonleao/gruvbox.nvim'
use 'danilamihailov/beacon.nvim'
-- language server stuff
use 'williamboman/mason.nvim'
use 'williamboman/mason-lspconfig.nvim'
use 'neovim/nvim-lspconfig'
use 'simrat39/rust-tools.nvim'
use 'WhoIsSethDaniel/lualine-lsp-progress.nvim'
-- Completion framework:
use 'hrsh7th/nvim-cmp'
-- LSP completion source:
use 'hrsh7th/cmp-nvim-lsp'
-- Useful completion sources:
use 'hrsh7th/cmp-nvim-lua'
use 'hrsh7th/cmp-nvim-lsp-signature-help'
use 'hrsh7th/cmp-vsnip'
use 'hrsh7th/cmp-path'
use 'hrsh7th/cmp-buffer'
use 'hrsh7th/vim-vsnip'
-- telescope
use "nvim-lua/plenary.nvim"
use {
'nvim-telescope/telescope.nvim', branch = '0.1.x',
requires = { {'nvim-lua/plenary.nvim'} }
}
-- status line
use {
'nvim-lualine/lualine.nvim',
requires = { 'nvim-tree/nvim-web-devicons', opt = true }
}
end)

View File

@ -0,0 +1,43 @@
require('lualine').setup {
options = {
icons_enabled = true,
theme = 'auto',
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 = {{
'lsp_progress',
timer = { progress_enddelay = 20, spinner = 20, lsp_client_name_enddelay = 20 },
}},
lualine_y = {'encoding', 'fileformat', 'filetype'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}

View File

@ -0,0 +1,30 @@
-- setup must be called before loading the colorscheme
-- Default options:
require("gruvbox").setup({
terminal_colors = true, -- add neovim terminal colors
undercurl = true,
underline = true,
bold = true,
italic = {
strings = true,
emphasis = true,
comments = true,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = false,
})
vim.o.background = "dark" -- or "light" for light mode
vim.cmd([[colorscheme gruvbox]])

View File

@ -0,0 +1,4 @@
local g = vim.g
g.t_co = 256
g.background = "dark"