Skip to content

Commit 9071a08

Browse files
revamp of everything. sorta working
illuminate still doesn't work. rust tools still don't work. everything else works.
1 parent 688fe58 commit 9071a08

File tree

13 files changed

+204
-212
lines changed

13 files changed

+204
-212
lines changed

init.lua

Lines changed: 79 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ require('lazy').setup({
3434
'tpope/vim-rhubarb',
3535

3636
-- Detect tabstop and shiftwidth automatically
37-
--'tpope/vim-sleuth',
37+
'tpope/vim-sleuth',
3838

3939
-- NOTE: This is where your plugins related to LSP can be installed.
4040
-- The configuration is done below. Search for lspconfig to find it below.
@@ -48,18 +48,50 @@ require('lazy').setup({
4848

4949
-- Useful status updates for LSP
5050
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
51-
{ 'j-hui/fidget.nvim', tag = 'legacy', opts = {} },
51+
{ 'j-hui/fidget.nvim', opts = {} },
5252

5353
-- Additional lua configuration, makes nvim stuff amazing!
5454
'folke/neodev.nvim',
5555
},
5656
},
5757

58+
{
59+
-- Autocompletion
60+
'hrsh7th/nvim-cmp',
61+
dependencies = {
62+
-- Snippet Engine & its associated nvim-cmp source
63+
'L3MON4D3/LuaSnip',
64+
'saadparwaiz1/cmp_luasnip',
65+
66+
-- Adds LSP completion capabilities
67+
'hrsh7th/cmp-nvim-lsp',
68+
69+
-- Adds a number of user-friendly snippets
70+
'rafamadriz/friendly-snippets',
71+
},
72+
opts = function()
73+
local cmp_window = require 'cmp.config.window'
74+
return {
75+
window = {
76+
completion = cmp_window.bordered {
77+
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
78+
},
79+
documentation = cmp_window.bordered {
80+
winhighlight = 'Normal:Normal,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None',
81+
},
82+
},
83+
--mapping = {
84+
---- pressing return should not select item
85+
--["<CR>"] = vim.NIL,
86+
--},
87+
}
88+
end,
89+
},
90+
5891
-- Useful plugin to show you pending keybinds.
5992
{ 'folke/which-key.nvim', opts = {} },
60-
61-
-- Adds git related signs to the gutter, as well as utilities for managing changes
6293
{
94+
-- Adds git related signs to the gutter, as well as utilities for managing changes
6395
'lewis6991/gitsigns.nvim',
6496
opts = {
6597
-- See `:help gitsigns.txt`
@@ -97,14 +129,28 @@ require('lazy').setup({
97129
},
98130
},
99131

100-
-- Set lualine as statusline
132+
-- colorscheme
101133
{
134+
'folke/tokyonight.nvim',
135+
lazy = false,
136+
priority = 1000,
137+
opts = {
138+
dim_inactive = true,
139+
style = 'night',
140+
on_colors = function(colors)
141+
colors.border = colors.yellow
142+
end,
143+
},
144+
},
145+
146+
{
147+
-- Set lualine as statusline
102148
'nvim-lualine/lualine.nvim',
103149
-- See `:help lualine.txt`
104150
opts = {
105151
options = {
106152
icons_enabled = true,
107-
theme = 'onedark',
153+
theme = 'tokyonight',
108154
component_separators = '|',
109155
section_separators = '',
110156
},
@@ -117,11 +163,33 @@ require('lazy').setup({
117163
---- Enable `lukas-reineke/indent-blankline.nvim`
118164
---- See `:help ibl`
119165
--main = 'ibl',
120-
--opts = {
121-
--scope = { enabled = false },
122-
--},
166+
--opts = {},
123167
--},
124168

169+
-- "gc" to comment visual regions/lines
170+
--{ 'numToStr/Comment.nvim', opts = {} },
171+
172+
-- Fuzzy Finder (files, lsp, etc)
173+
{
174+
'nvim-telescope/telescope.nvim',
175+
branch = '0.1.x',
176+
dependencies = {
177+
'nvim-lua/plenary.nvim',
178+
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
179+
-- Only load if `make` is available. Make sure you have the system
180+
-- requirements installed.
181+
{
182+
'nvim-telescope/telescope-fzf-native.nvim',
183+
-- NOTE: If you are having trouble with this installation,
184+
-- refer to the README for telescope-fzf-native for more instructions.
185+
build = 'make',
186+
cond = function()
187+
return vim.fn.executable 'make' == 1
188+
end,
189+
},
190+
},
191+
},
192+
125193
{
126194
-- Highlight, edit, and navigate code
127195
'nvim-treesitter/nvim-treesitter',
@@ -133,6 +201,7 @@ require('lazy').setup({
133201

134202
{ import = 'plugins' },
135203
}, {
204+
install = { colorscheme = { 'tokyonight', 'habamax' } },
136205
})
137206

138207
require 'config.options'
@@ -142,6 +211,7 @@ require 'config.telescope'
142211
require 'config.treesitter'
143212
require 'config.lsp'
144213
require 'config.completion'
214+
145215
require 'config.highlight-yank'
146216

147217
require 'config.rust'

lua/config/lsp.lua

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,20 @@ require('mason-lspconfig').setup()
6767
-- If you want to override the default filetypes that your language server will attach to you can
6868
-- define the property 'filetypes' to the map in question.
6969
local servers = {
70-
clangd = {},
70+
clangd = {},
7171
-- gopls = {},
7272
-- pyright = {},
7373
rust_analyzer = {
7474
keys = {
75-
{ "K", "<cmd>RustHoverActions<cr>", desc = "Hover Actions (Rust)" },
76-
{ "<leader>cR", "<cmd>RustCodeAction<cr>", desc = "Code Action (Rust)" },
77-
{ "<leader>dr", "<cmd>RustDebuggables<cr>", desc = "Run Debuggables (Rust)" },
75+
{ 'K', '<cmd>RustHoverActions<cr>', desc = 'Hover Actions (Rust)' },
76+
{ '<leader>cR', '<cmd>RustCodeAction<cr>', desc = 'Code Action (Rust)' },
77+
{ '<leader>dr', '<cmd>RustDebuggables<cr>', desc = 'Run Debuggables (Rust)' },
78+
{ '<F4>', '<cmd>RustOpenExternalDocs<cr>', { desc = 'Open documentation', remap = true } },
79+
{ '<F5>', '<cmd>RustReloadWorkspace<CR>', { desc = 'Reload the rust workspace', remap = true } },
80+
{ '<F6>', '<cmd>RustCodeAction<CR>', { desc = 'Show code action menu.', remap = true } },
7881
},
7982
settings = {
80-
["rust-analyzer"] = {
83+
['rust-analyzer'] = {
8184
cargo = {
8285
allFeatures = true,
8386
loadOutDirsFromCheck = true,
@@ -86,21 +89,21 @@ local servers = {
8689
-- Add clippy lints for Rust.
8790
checkOnSave = {
8891
allFeatures = true,
89-
command = "clippy",
90-
extraArgs = { "--no-deps" },
92+
command = 'clippy',
93+
extraArgs = { '--no-deps' },
9194
},
9295
procMacro = {
9396
enable = true,
9497
ignored = {
95-
["async-trait"] = { "async_trait" },
96-
["napi-derive"] = { "napi" },
97-
["async-recursion"] = { "async_recursion" },
98+
['async-trait'] = { 'async_trait' },
99+
['napi-derive'] = { 'napi' },
100+
['async-recursion'] = { 'async_recursion' },
98101
},
99102
},
100103
},
101104
},
102105
},
103-
tsserver = {},
106+
tsserver = {},
104107
-- html = { filetypes = { 'html', 'twig', 'hbs'} },
105108

106109
lua_ls = {
@@ -112,22 +115,18 @@ local servers = {
112115
}
113116

114117
-- make lsp windows bordered
115-
local _border = "single"
118+
local _border = 'single'
116119

117-
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
118-
vim.lsp.handlers.hover, {
119-
border = _border
120-
}
121-
)
120+
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, {
121+
border = _border,
122+
})
122123

123-
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
124-
vim.lsp.handlers.signature_help, {
125-
border = _border
126-
}
127-
)
124+
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, {
125+
border = _border,
126+
})
128127

129128
vim.diagnostic.config {
130-
float = { border = _border }
129+
float = { border = _border },
131130
}
132131

133132
-- Setup neovim lua configuration

lua/config/options.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ vim.opt.shiftwidth = 2
4343
vim.opt.winminwidth = 5
4444

4545
-- rust debugging support
46-
vim.api.nvim_command("packadd termdebug")
47-
vim.g.termdebugger = "rust-gdb"
46+
vim.api.nvim_command 'packadd termdebug'
47+
vim.g.termdebugger = 'rust-gdb'
4848

49-
vim.cmd.colorscheme 'tokyonight'
49+
vim.cmd.colorscheme 'tokyonight-night'

lua/config/rust.lua

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
-- rust keybindings... this is only valid for rust files
2-
vim.api.nvim_create_autocmd("FileType", {
3-
pattern = { "rust" },
4-
callback = function()
5-
--local rt = require('rust-tools')
6-
--rt.inlay_hints.enable()
7-
8-
vim.keymap.set("n", "<F4>", "<cmd>RustOpenExternalDocs<cr>", { desc = "Open documentation", remap = true })
9-
vim.keymap.set("n", "<F5>", "<cmd>RustReloadWorkspace<CR>", { desc = "Reload the rust workspace", remap = true })
10-
vim.keymap.set("n", "<F6>", "<cmd>RustCodeAction<CR>", { desc = "Show code action menu.", remap = true })
11-
end,
12-
})
1+
local rt = require("rust-tools")
132

3+
rt.setup({})

lua/config/treesitter.lua

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,29 @@
44
vim.defer_fn(function()
55
require('nvim-treesitter.configs').setup {
66
-- Add languages to be installed here that you want installed for treesitter
7-
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim', 'bash', 'jq', 'make', 'toml', 'markdown', 'markdown_inline', 'regex', 'yaml', 'json' },
7+
ensure_installed = {
8+
'bash',
9+
'c',
10+
'cpp',
11+
'go',
12+
'javascript',
13+
'jq',
14+
'json',
15+
'lua',
16+
'make',
17+
'markdown',
18+
'markdown_inline',
19+
'python',
20+
'regex',
21+
'ron',
22+
'rust',
23+
'toml',
24+
'tsx',
25+
'typescript',
26+
'vim',
27+
'vimdoc',
28+
'yaml',
29+
},
830

931
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
1032
auto_install = true,
@@ -20,6 +42,9 @@ vim.defer_fn(function()
2042
node_decremental = '<M-space>',
2143
},
2244
},
45+
endwise = {
46+
enable = true,
47+
},
2348
textobjects = {
2449
select = {
2550
enable = true,
@@ -66,4 +91,3 @@ vim.defer_fn(function()
6691
},
6792
}
6893
end, 0)
69-

lua/plugins/colorscheme.lua

Lines changed: 0 additions & 11 deletions
This file was deleted.

lua/plugins/endwise.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
return {
2-
"RRethy/nvim-treesitter-endwise"
2+
"RRethy/nvim-treesitter-endwise",
3+
dependencies = {
4+
"nvim-treesitter/nvim-treesitter"
5+
}
36
}

lua/plugins/illuminate.lua

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,30 @@ return {
1212
{ "]]", desc = "Next Reference" },
1313
{ "[[", desc = "Prev Reference" },
1414
},
15+
16+
-- I think this is just for LazyVim and not a normal lazy.nvim feature
17+
config = function(_, opts)
18+
require("illuminate").configure(opts)
19+
20+
local function map(key, dir, buffer)
21+
vim.keymap.set("n", key, function()
22+
require("illuminate")["goto_" .. dir .. "_reference"](false)
23+
end, { desc = dir:sub(1, 1):upper() .. dir:sub(2) .. " Reference", buffer = buffer })
24+
end
25+
26+
map("]]", "next")
27+
map("[[", "prev")
28+
29+
-- also set it after loading ftplugins, since a lot overwrite [[ and ]]
30+
vim.api.nvim_create_autocmd("FileType", {
31+
callback = function()
32+
local buffer = vim.api.nvim_get_current_buf()
33+
map("]]", "next", buffer)
34+
map("[[", "prev", buffer)
35+
end,
36+
})
37+
end,
38+
dependencies = {
39+
"nvim-treesitter/nvim-treesitter"
40+
}
1541
}

lua/plugins/nvim-cmp.lua

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)