Slowly building out nvim.lua

This commit is contained in:
Joseph Ferano 2022-12-19 03:01:32 +07:00
parent a09f8b04c8
commit 84a221def0
4 changed files with 171 additions and 42 deletions

View File

@ -1103,6 +1103,12 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i
#+begin_src emacs-lisp
(setq compilation-auto-jump-to-first-error t)
#+end_src
** Debugging
*** DAP
#+begin_src emacs-lisp
(straight-use-package 'dap-mode)
#+end_src
** Languages
*** Rust
#+begin_src emacs-lisp

View File

@ -1,50 +1,30 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt`
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
vim.cmd [[packadd packer.nvim]]
return true
end return false
end
require('plugins')
local map = vim.keymap.set
local packer_bootstrap = ensure_packer()
local packer = require('packer')
vim.o.clipboard = 'unnamedplus'
vim.o.wrap = false
vim.o.hlsearch = false
vim.wo.number = true
vim.wo.relativenumber = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.termguicolors = true
packer.startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use {
'marko-cerovac/material.nvim',
config = function()
vim.g.material_style = "palenight"
vim.cmd [[colorscheme material]]
end
}
use { 'TimUntersberger/neogit', requires = 'nvim-lua/plenary.nvim' }
end)
vim.g.mapleader = " "
if packer_bootstrap then
require('packer').sync()
end
map("n", "<C-s>", vim.cmd.w)
map("n", "<C-q>", vim.cmd.wq)
map("n", "vv", "^vg_", { noremap = true })
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup
local telescope = require('telescope.builtin')
map('n', '<leader><leader>f', telescope.find_files, {})
map('n', '<leader><leader>g', telescope.live_grep, {})
map('n', '<leader><leader>b', telescope.buffers, {})
map('n', '<leader><leader>t', telescope.help_tags, {})
autocmd('BufWritePost', {
group = augroup('packer_user_config', { clear = true }),
pattern = "init.lua",
once = true,
callback = function()
vim.cmd('source $MYVIMRC')
packer.compile()
end
})
local neogit = require('neogit')
neogit.setup {}
-- local neogit = require('neogit')
--
-- neogit.setup {}

View File

@ -0,0 +1,142 @@
-- Only required if you have packer configured as `opt`
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({ 'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path })
vim.cmd [[packadd packer.nvim]]
return true
end return false
end
local packer_bootstrap = ensure_packer()
local packer = require('packer')
packer.startup(function(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
use 'nvim-lua/plenary.nvim'
use {
'nvim-telescope/telescope-fzf-native.nvim',
run = 'make',
cond = vim.fn.executable 'make' == 1
}
use {
'marko-cerovac/material.nvim',
config = function()
vim.g.material_style = "palenight"
vim.cmd [[colorscheme material]]
end
}
use {
'nvim-treesitter/nvim-treesitter',
run = function()
local ts_update = require('nvim-treesitter.install').update({ with_sync = true })
ts_update()
end
}
use { -- Additional text objects via treesitter
'nvim-treesitter/nvim-treesitter-textobjects',
after = 'nvim-treesitter',
}
use {
'nvim-telescope/telescope.nvim', tag = '0.1.0',
requires = { {'nvim-lua/plenary.nvim'} }
}
use {
'numToStr/Comment.nvim',
config = function()
require('Comment').setup()
end
}
use {
"kylechui/nvim-surround",
tag = "*", -- Use for stability; omit to use `main` branch for the latest features
config = function()
require("nvim-surround").setup({})
end
}
-- use { 'TimUntersberger/neogit', requires = 'nvim-lua/plenary.nvim' }
end)
if packer_bootstrap then
require('packer').sync()
end
local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup
autocmd(('BufWritePost'), {
group = augroup('packer_user_config', { clear = true }),
pattern = "plugins.lua",
once = true,
callback = function()
vim.cmd('source ~/.config/nvim/lua/plugins.lua')
packer.compile()
end
})
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'bash', 'rust', 'go', 'help', 'haskell', 'ocaml' },
highlight = {
enable = true,
additional_vim_regex_highlighting = false
},
indent = { enable = true },
incremental_selection = {
enable = true,
keymaps = {
init_selection = '<c-space>',
node_incremental = '<c-space>',
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
},
},
textobjects = {
select = {
enable = true,
lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim
keymaps = {
-- You can use the capture groups defined in textobjects.scm
['aa'] = '@parameter.outer',
['ia'] = '@parameter.inner',
['af'] = '@function.outer',
['if'] = '@function.inner',
['ac'] = '@class.outer',
['ic'] = '@class.inner',
},
},
move = {
enable = true,
set_jumps = true, -- whether to set jumps in the jumplist
goto_next_start = {
[')'] = '@function.outer',
[']]'] = '@class.outer',
},
goto_next_end = {
[']M'] = '@function.outer',
[']['] = '@class.outer',
},
goto_previous_start = {
['('] = '@function.outer',
['[['] = '@class.outer',
},
goto_previous_end = {
['[M'] = '@function.outer',
['[]'] = '@class.outer',
},
},
-- TODO: Fix this
swap = {
enable = true,
swap_next = {
['<leader>a'] = '@parameter.inner',
},
swap_previous = {
['<leader>A'] = '@parameter.inner',
},
},
},
}

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.config/emacs/*
!.config/emacs/init.org
/.config/nvim/plugin/