create config dir & changed formatting

This commit is contained in:
Jeremie Fraeys 2023-09-24 13:13:19 -04:00
parent 4f160cfe77
commit c54236b7ac
2 changed files with 189 additions and 79 deletions

122
init.lua
View File

@ -4,6 +4,9 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
--import options
require('config.options')
-- Install package manager
-- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info
@ -20,6 +23,28 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
local opts = {
git = { log = { '--since=3 days ago' } },
ui = { custom_keys = { false } },
performance = {
rtp = {
disabled_plugins = {
'gzip',
-- 'netrwPlugin',
'tarPlugin',
'tohtml',
'tutor',
'zipPlugin',
'rplugin',
'editorconfig',
'matchparen',
'matchit',
},
},
},
checker = { enabled = false },
}
-- NOTE: Here is where you install your plugins.
-- You can configure plugins using the `config` key.
--
@ -47,7 +72,11 @@ require('lazy').setup({
-- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
{
'j-hui/fidget.nvim',
tag = 'legacy',
opts = {}
},
-- Additional lua configuration, makes nvim stuff amazing!
'folke/neodev.nvim',
@ -71,7 +100,10 @@ require('lazy').setup({
},
-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{
'folke/which-key.nvim',
opts = {}
},
{
-- Adds git related signs to the gutter, as well as utilities for managing changes
'lewis6991/gitsigns.nvim',
@ -89,16 +121,16 @@ require('lazy').setup({
-- don't override the built-in and fugitive keymaps
local gs = package.loaded.gitsigns
vim.keymap.set({'n', 'v'}, ']c', function()
vim.keymap.set({ 'n', 'v' }, ']c', function()
if vim.wo.diff then return ']c' end
vim.schedule(function() gs.next_hunk() end)
return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to next hunk"})
vim.keymap.set({'n', 'v'}, '[c', function()
end, { expr = true, buffer = bufnr, desc = "Jump to next hunk" })
vim.keymap.set({ 'n', 'v' }, '[c', function()
if vim.wo.diff then return '[c' end
vim.schedule(function() gs.prev_hunk() end)
return '<Ignore>'
end, {expr=true, buffer = bufnr, desc = "Jump to previous hunk"})
end, { expr = true, buffer = bufnr, desc = "Jump to previous hunk" })
end,
},
},
@ -146,7 +178,11 @@ require('lazy').setup({
},
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
{
'numToStr/Comment.nvim',
opts = {},
lazy = false
},
-- Fuzzy Finder (files, lsp, etc)
{
@ -192,70 +228,7 @@ require('lazy').setup({
--
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
{ import = 'custom.plugins' },
}, {}) -- [[ Setting options ]]
-- See `:help vim.opt`
-- NOTE: You can change these options as you wish!
-- Set highlight on search
vim.opt.hlsearch = false
-- Make line numbers default
vim.wo.number = true
vim.opt.relativenumber = true
-- Enable mouse mode
vim.opt.mouse = 'a'
-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.opt.clipboard = 'unnamedplus'
-- Enable break indent
vim.opt.breakindent = true
-- Indent Configuration
vim.o.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
vim.opt.smartindent = true
-- Disable line wrap
vim.opt.wrap = false
-- Save undo history_list
vim.opt.swapfile = false
vim.opt.backup = false
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true
-- Searching Configuration
vim.opt.hlsearch = false
vim.opt.incsearch = true
-- Case-insensitive searching UNLESS \C or capital in search
vim.opt.ignorecase = true
vim.opt.smartcase = true
-- Keep signcolumn on by default
vim.wo.signcolumn = 'yes'
-- Decrease update time
vim.opt.updatetime = 50
vim.opt.timeoutlen = 300
-- Set completeopt to have a better completion experience
vim.opt.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.opt.termguicolors = true
vim.opt.scrolloff = 10
-- vim.opt.isfname:append("@-@")
vim.opt.colorcolumn = "80"
}, opts)
-- [[ Basic Keymaps ]]
@ -473,15 +446,18 @@ local servers = {
clangd = {},
-- gopls = {},
pyright = {
settings = { pyright = { autoImportCompletion = true, } },
settings = {
pyright = { autoImportCompletion = true, },
python = {
pythonPath = "/usr/bin/python3",
analysis = {
autoSearchPaths = true,
diagnosticMode = 'openFilesOnly',
useLibraryCodeForTypes = true,
typeCheckingMode = 'off',
},
}
},
},
},
-- rust_analyzer = {},
-- tsserver = {},

134
lua/config/options.lua Normal file
View File

@ -0,0 +1,134 @@
local opt = vim.opt
local g = vim.g
local options = {
-- Make line numbers default
relativenumber = true,
-- Enable mouse mode
mouse = 'a',
-- Enable break indent
breakindent = true,
-- Indent Configuration
tabstop = 4,
softtabstop = 4,
shiftwidth = 4,
expandtab = true,
smartindent = true,
-- Disable line wrap
wrap = false,
-- Save undo history_list
swapfile = false,
backup = false,
undodir = os.getenv("HOME") .. "/.vim/undodir",
undofile = true,
-- Searching Configuration
hlsearch = false,
incsearch = true,
-- Case-insensitive searching UNLESS \C or capital in search
ignorecase = true,
smartcase = true,
-- Decrease update time
updatetime = 50,
timeoutlen = 300,
-- Set completeopt to have a better completion experience
completeopt = 'menuone,noselect',
-- NOTE: You should make sure your terminal supports this
termguicolors = true,
scrolloff = 10,
-- isfname:append("@-@"),
colorcolumn = "80",
-- part of the neovim imprioving command below
pyxversion = 3
}
for k, v in pairs(options) do
vim.opt[k] = v
end
local win_local = {
signcolumn = 'yes',
number = true,
}
for k, v in pairs(win_local) do
vim.wo[k] = v
end
-- disable builtins plugins
local disabled_built_ins = {
"2html_plugin",
"getscript",
"getscriptPlugin",
"gzip",
"logipat",
"matchit",
-- "netrw",
"netrwFileHandlers",
"loaded_remote_plugins",
"loaded_tutor_mode_plugin",
-- "netrwPlugin",
"netrwSettings",
"rrhelper",
"spellfile_plugin",
"tar",
"tarPlugin",
"vimball",
"vimballPlugin",
"zip",
"zipPlugin",
"matchparen", -- matchparen.nvim disables the default
}
for _, plugin in pairs(disabled_built_ins) do
vim.g["loaded_" .. plugin] = 1
end
--
-- IMPROVE NEOVIM STARTUP
-- https://github.com/editorconfig/editorconfig-vim/issues/50
local global_let_opts = {
loaded_python_provier = 0,
loaded_python3_provider = 0,
python_host_skip_check = 1,
-- python_host_prog = '/bin/python2',
python3_host_skip_check = 1,
python3_host_prog = '/usr/local/bin/python3',
EditorConfig_core_mode = 'external_command',
-- https://vi.stackexchange.com/a/5318/7339
matchparen_timeout = 20,
matchparen_insert_timeout = 20,
}
for k, v in pairs(global_let_opts) do
vim.g[k] = v
end
opt.formatoptions = "l"
opt.formatoptions = opt.formatoptions
- "a" -- Auto formatting is BAD.
- "t" -- Don't auto format my code. I got linters for that.
+ "c" -- In general, I like it when comments respect textwidth
- "o" -- O and o, don't continue comments
+ "r" -- But do continue when pressing enter.
+ "n" -- Indent past the formatlistpat, not underneath it.
+ "j" -- Auto-remove comments if possible.
- "2" -- I'm not in gradeschool anymore
opt.guicursor = {
"n-v:block",
"i-c-ci-ve:ver25",
"r-cr:hor20",
"o:hor50",
"i:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor",
"sm:block-blinkwait175-blinkoff150-blinkon175",
}