Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/dependencies.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
`brew install ripgrep`
173 changes: 150 additions & 23 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ vim.g.mapleader = ' '
vim.g.maplocalleader = ' '

-- Set to true if you have a Nerd Font installed and selected in the terminal
vim.g.have_nerd_font = false
vim.g.have_nerd_font = true

-- [[ Setting options ]]
-- See `:help vim.opt`
Expand Down Expand Up @@ -228,6 +228,9 @@ vim.opt.rtp:prepend(lazypath)
--
-- NOTE: Here is where you install your plugins.
require('lazy').setup({
-- For autosave functionality
'pocco81/auto-save.nvim',

-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically

Expand Down Expand Up @@ -347,12 +350,21 @@ require('lazy').setup({
-- You can put your default mappings / updates / etc. in here
-- All the info you're looking for is in `:help telescope.setup()`
--
-- defaults = {
-- mappings = {
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
-- },
-- },
-- pickers = {}
defaults = {
layout_config = {
vertical = { height = 0.9 },
},
},
pickers = {
lsp_references = { theme = 'dropdown', layout_config = { width = 0.98, height = 0.4 }, previewer = true },
diagnostics = {
theme = 'dropdown',
previewer = false,
layout_config = {
width = 0.9,
},
},
},
extensions = {
['ui-select'] = {
require('telescope.themes').get_dropdown(),
Expand All @@ -372,11 +384,16 @@ require('lazy').setup({
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
vim.keymap.set('n', '<leader>sw', builtin.grep_string, { desc = '[S]earch current [W]ord' })
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })

vim.keymap.set('n', '<leader>sd', function()
builtin.diagnostics {
bufnr = 0,
}
end, { desc = '[S]earch [D]iagnostics' })

-- Slightly advanced example of overriding default behavior and theme
vim.keymap.set('n', '<leader>/', function()
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
Expand Down Expand Up @@ -511,6 +528,29 @@ require('lazy').setup({
-- For example, in C this would take you to the header.
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')

vim.api.nvim_create_autocmd('BufWritePre', {
pattern = '*.go',
callback = function()
local params = vim.lsp.util.make_range_params()
params.context = { only = { 'source.organizeImports' } }
-- buf_request_sync defaults to a 1000ms timeout. Depending on your
-- machine and codebase, you may want longer. Add an additional
-- argument after params if you find that you have to write the file
-- twice for changes to be saved.
-- E.g., vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 3000)
local result = vim.lsp.buf_request_sync(0, 'textDocument/codeAction', params)
for cid, res in pairs(result or {}) do
for _, r in pairs(res.result or {}) do
if r.edit then
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or 'utf-16'
vim.lsp.util.apply_workspace_edit(r.edit, enc)
end
end
end
vim.lsp.buf.format { async = false }
end,
})

-- The following two autocommands are used to highlight references of the
-- word under your cursor when your cursor rests there for a little while.
-- See `:help CursorHold` for information about when this is executed
Expand Down Expand Up @@ -569,8 +609,18 @@ require('lazy').setup({
-- - settings (table): Override the default settings passed when initializing the server.
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
ruby_lsp = {},
-- clangd = {},
-- gopls = {},
gopls = {
settings = {
gopls = {
analyses = {
unusedparams = true,
},
staticcheck = true,
},
},
},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
Expand Down Expand Up @@ -629,6 +679,45 @@ require('lazy').setup({
end,
},

{ 'nvim-neotest/nvim-nio' },

{
'nvim-neotest/neotest',
dependencies = {
'nvim-treesitter/nvim-treesitter',
'nvim-neotest/neotest-go',
},
opts = {},
config = function()
local neotest = require 'neotest'

neotest.setup {
adapters = {
-- require 'neotest-rspec' {
-- rspec_cmd = function()
-- return vim.tbl_flatten {
-- 'bundle',
-- 'exec',
-- 'rspec',
-- }
-- end,
-- },
require 'neotest-go',
},
output_panel = {
enabled = true,
open = 'botright split | resize 15',
},
quickfix = {
open = false,
},
}

vim.keymap.set('n', '<leader>rt', '<cmd>lua require(\'neotest\').run.run(vim.fn.expand("%"))<CR>', { desc = 'Run Test' })
vim.keymap.set('n', '<leader>rot', '<cmd>lua require("neotest").output.open({ enter = true })<CR>', { desc = 'Open Test Output' })
end,
},

{ -- Autoformat
'stevearc/conform.nvim',
event = { 'BufWritePre' },
Expand Down Expand Up @@ -657,6 +746,7 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
go = { 'gofmt' },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
Expand Down Expand Up @@ -782,21 +872,58 @@ require('lazy').setup({
end,
},

{ -- You can easily change to a different colorscheme.
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
-- { -- You can easily change to a different colorscheme.
-- -- Change the name of the colorscheme plugin below, and then
-- -- change the command in the config to whatever the name of that colorscheme is.
-- --
-- -- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
-- 'folke/tokyonight.nvim',
-- priority = 1000, -- Make sure to load this before all the other start plugins.
-- init = function()
-- -- Load the colorscheme here.
-- -- Like many other themes, this one has different styles, and you could load
-- -- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
-- vim.cmd.colorscheme 'tokyonight-moon'
--
-- -- You can configure highlights by doing something like:
-- vim.cmd.hi 'Comment gui=none'
-- end,
-- },

-- {
-- 'morhetz/gruvbox',
-- priority = 1000,
-- init = function()
-- vim.g.gruvbox_contrast_dark = 'hard'
-- vim.g.gruvbox_bold = 0
-- vim.cmd.colorscheme 'gruvbox'
-- end,
-- },

{
'sainnhe/everforest',
priority = 1000,
init = function()
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'
vim.g.everforest_enable_italic = true
vim.g.everforest_background = 'hard'
vim.cmd.colorscheme 'everforest'
end,
},

-- {
-- 'sainnhe/gruvbox-material',
-- priority = 1000,
-- init = function()
-- vim.g.gruvbox_material_enable_italic = true
-- vim.g.gruvbox_material_background = 'hard'
-- vim.cmd.colorscheme 'gruvbox-material'
-- end,
-- },

-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'
{
'vim-airline/vim-airline',
init = function()
vim.g.airline_theme = 'everforest'
end,
},

Expand Down Expand Up @@ -892,7 +1019,7 @@ require('lazy').setup({
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
Expand Down
4 changes: 3 additions & 1 deletion lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}
return {
{ dir = '~/.config/nvim/lua/custom/toms.nvim/' },
}
10 changes: 10 additions & 0 deletions lua/custom/toms.nvim/lua/toms.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
print 'loaded tom.lua'

function List_bufs()
vim.print(vim.api.nvim_list_bufs())
end

-- function ListDiag()
--
-- vim.print(vim.
-- end
1 change: 1 addition & 0 deletions lua/custom/toms.nvim/plugin/load.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require 'toms'