Skip to content

Commit 2d62fef

Browse files
committed
Initial custom configurations
1 parent 2ba39c6 commit 2d62fef

16 files changed

Lines changed: 343 additions & 30 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ nvim
55

66
spell/
77
lazy-lock.json
8+
.undo

init.lua

Lines changed: 115 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ vim.g.mapleader = ' '
9191
vim.g.maplocalleader = ' '
9292

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

9696
-- [[ Setting options ]]
9797
-- See `:help vim.opt`
@@ -114,15 +114,16 @@ vim.opt.showmode = false
114114
-- Schedule the setting after `UiEnter` because it can increase startup-time.
115115
-- Remove this option if you want your OS clipboard to remain independent.
116116
-- See `:help 'clipboard'`
117-
vim.schedule(function()
118-
vim.opt.clipboard = 'unnamedplus'
119-
end)
117+
-- vim.schedule(function()
118+
-- vim.opt.clipboard = 'unnamedplus'
119+
-- end)
120120

121121
-- Enable break indent
122122
vim.opt.breakindent = true
123123

124124
-- Save undo history
125125
vim.opt.undofile = true
126+
vim.opt.undodir = vim.fn.stdpath 'config' .. '/.undo'
126127

127128
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
128129
vim.opt.ignorecase = true
@@ -253,6 +254,7 @@ require('lazy').setup({
253254
topdelete = { text = '' },
254255
changedelete = { text = '~' },
255256
},
257+
current_line_blame = true,
256258
},
257259
},
258260

@@ -615,18 +617,49 @@ require('lazy').setup({
615617
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
616618
local servers = {
617619
-- clangd = {},
618-
-- gopls = {},
619-
-- pyright = {},
620-
-- rust_analyzer = {},
620+
gopls = {},
621+
pyright = {},
622+
rust_analyzer = {},
621623
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
622624
--
623625
-- Some languages (like typescript) have entire language plugins that can be useful:
624626
-- https://github.com/pmizio/typescript-tools.nvim
625627
--
626628
-- But for many setups, the LSP (`ts_ls`) will work just fine
627-
-- ts_ls = {},
629+
ts_ls = {},
628630
--
629631

632+
html = {},
633+
tailwindcss = {},
634+
graphql = {
635+
filetypes = { 'graphql', 'gql', 'typescriptreact', 'javascriptreact' },
636+
},
637+
638+
ruby_lsp = {},
639+
rubocop = {
640+
-- See: https://docs.rubocop.org/rubocop/usage/lsp.html
641+
root_dir = require('lspconfig').util.root_pattern('Gemfile', '.git', '.'),
642+
},
643+
-- solargraph = {
644+
-- -- cmd = { os.getenv 'HOME' .. '/.asdf/shims/solargraph', 'stdio' },
645+
-- root_dir = require('lspconfig').util.root_pattern('Gemfile', '.git', '.'),
646+
-- settings = {
647+
-- solargraph = {
648+
-- autoformat = true,
649+
-- completion = true,
650+
-- diagnostics = true,
651+
-- folding = true,
652+
-- references = true,
653+
-- rename = true,
654+
-- symbols = true,
655+
-- },
656+
-- },
657+
-- flags = {
658+
-- debounce_text_changes = 300,
659+
-- },
660+
-- },
661+
-- stimulus_ls = {},
662+
630663
lua_ls = {
631664
-- cmd = {...},
632665
-- filetypes = { ...},
@@ -656,6 +689,14 @@ require('lazy').setup({
656689
local ensure_installed = vim.tbl_keys(servers or {})
657690
vim.list_extend(ensure_installed, {
658691
'stylua', -- Used to format Lua code
692+
'isort',
693+
'black',
694+
'prettier',
695+
'erb-formatter',
696+
'markdownlint',
697+
'eslint',
698+
'goimports',
699+
-- 'sqlfmt',
659700
})
660701
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
661702

@@ -702,17 +743,30 @@ require('lazy').setup({
702743
lsp_format_opt = 'fallback'
703744
end
704745
return {
705-
timeout_ms = 500,
746+
timeout_ms = 1500,
706747
lsp_format = lsp_format_opt,
707748
}
708749
end,
709750
formatters_by_ft = {
710751
lua = { 'stylua' },
711752
-- Conform can also run multiple formatters sequentially
712-
-- python = { "isort", "black" },
753+
python = { 'isort', 'black' },
713754
--
714755
-- You can use 'stop_after_first' to run the first available formatter from the list
715-
-- javascript = { "prettierd", "prettier", stop_after_first = true },
756+
javascript = { 'prettierd', 'prettier', stop_after_first = true },
757+
javascriptreact = { 'prettier' },
758+
typescript = { 'prettier' },
759+
typescriptreact = { 'prettier' },
760+
css = { 'prettier' },
761+
html = { 'prettier' },
762+
json = { 'prettier' },
763+
yaml = { 'prettier' },
764+
markdown = { 'prettier' },
765+
graphql = { 'prettier' },
766+
ruby = { 'rubocop' },
767+
eruby = { 'erb_format' },
768+
go = { 'goimports', 'gofmt' },
769+
-- sql = { 'sqlfmt' },
716770
},
717771
},
718772
},
@@ -825,9 +879,11 @@ require('lazy').setup({
825879
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
826880
group_index = 0,
827881
},
828-
{ name = 'nvim_lsp' },
829-
{ name = 'luasnip' },
830-
{ name = 'path' },
882+
{ name = 'copilot', group_index = 2 },
883+
{ name = 'nvim_lsp', group_index = 2 },
884+
{ name = 'luasnip', group_index = 2 },
885+
{ name = 'path', group_index = 2 },
886+
{ name = 'buffer', group_index = 2 },
831887
},
832888
}
833889
end,
@@ -897,17 +953,46 @@ require('lazy').setup({
897953
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
898954
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
899955
opts = {
900-
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
956+
ensure_installed = {
957+
'bash',
958+
'c',
959+
'diff',
960+
'go',
961+
'html',
962+
'javascript',
963+
'jsdoc',
964+
'json',
965+
'jsonc',
966+
'lua',
967+
'luadoc',
968+
'luap',
969+
'markdown',
970+
'markdown_inline',
971+
'python',
972+
'query',
973+
'regex',
974+
'ruby',
975+
'rust',
976+
'toml',
977+
'tsx',
978+
'typescript',
979+
'vim',
980+
'vimdoc',
981+
'xml',
982+
'yaml',
983+
},
901984
-- Autoinstall languages that are not installed
902985
auto_install = true,
903-
highlight = {
904-
enable = true,
905-
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
906-
-- If you are experiencing weird indenting issues, add the language to
907-
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
908-
additional_vim_regex_highlighting = { 'ruby' },
909-
},
910-
indent = { enable = true, disable = { 'ruby' } },
986+
highlight = { enable = true },
987+
indent = { enable = true },
988+
-- highlight = {
989+
-- enable = true,
990+
-- -- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
991+
-- -- If you are experiencing weird indenting issues, add the language to
992+
-- -- the list of additional_vim_regex_highlighting and disabled languages for indent.
993+
-- additional_vim_regex_highlighting = { 'ruby' },
994+
-- },
995+
-- indent = { enable = true, disable = { 'ruby' } },
911996
},
912997
-- There are additional nvim-treesitter modules that you can use to interact
913998
-- with nvim-treesitter. You should go explore a few and see what interests you:
@@ -927,17 +1012,18 @@ require('lazy').setup({
9271012
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
9281013
--
9291014
-- require 'kickstart.plugins.debug',
930-
-- require 'kickstart.plugins.indent_line',
931-
-- require 'kickstart.plugins.lint',
932-
-- require 'kickstart.plugins.autopairs',
933-
-- require 'kickstart.plugins.neo-tree',
934-
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
1015+
require 'kickstart.plugins.indent_line',
1016+
require 'kickstart.plugins.lint',
1017+
require 'kickstart.plugins.autopairs',
1018+
require 'kickstart.plugins.neo-tree',
1019+
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
9351020

9361021
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
9371022
-- This is the easiest way to modularize your config.
9381023
--
9391024
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
940-
-- { import = 'custom.plugins' },
1025+
{ import = 'custom.plugins' },
1026+
{ import = 'custom' },
9411027
--
9421028
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
9431029
-- Or use telescope!

lua/custom/completion.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
local cmp = require 'cmp'
2+
3+
return {
4+
-- Setup up vim-dadbod
5+
cmp.setup.filetype({ 'sql' }, {
6+
sources = {
7+
{ name = 'vim-dadbod-completion' },
8+
{ name = 'buffer' },
9+
},
10+
}),
11+
}

lua/custom/keymaps.lua

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
return {
2+
vim.keymap.set('v', '>', '>gv', { desc = 'Reselect visual block after indent' }),
3+
vim.keymap.set('v', '<', '<gv', { desc = 'Reselect visual block after outdent' }),
4+
5+
vim.keymap.set('n', '<left>', '<cmd>bp<CR>', { desc = 'Go to previous buffer' }),
6+
vim.keymap.set('n', '<right>', '<cmd>bn<CR>', { desc = 'Go to next buffer' }),
7+
8+
vim.keymap.set('n', '<leader>db', '<cmd>DBUI<CR>', { desc = 'Dadbod UI' }),
9+
}

lua/custom/options.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-- Disable line wrapping
2+
vim.opt.wrap = false
3+
4+
-- Visual wrap column
5+
vim.opt.colorcolumn = '120'
6+
7+
return {}

lua/custom/plugins/avente.lua

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
return {
2+
{
3+
'yetone/avante.nvim',
4+
event = 'VeryLazy',
5+
lazy = false,
6+
version = false, -- set this if you want to always pull the latest change
7+
opts = {
8+
provider = 'copilot',
9+
},
10+
build = 'make',
11+
dependencies = {
12+
'nvim-treesitter/nvim-treesitter',
13+
'stevearc/dressing.nvim',
14+
'nvim-lua/plenary.nvim',
15+
'MunifTanjim/nui.nvim',
16+
--- The below dependencies are optional,
17+
'nvim-tree/nvim-web-devicons', -- or echasnovski/mini.icons
18+
'zbirenbaum/copilot.lua', -- for providers='copilot'
19+
{
20+
-- support for image pasting
21+
'HakonHarnes/img-clip.nvim',
22+
event = 'VeryLazy',
23+
opts = {
24+
-- recommended settings
25+
default = {
26+
embed_image_as_base64 = false,
27+
prompt_for_file_name = false,
28+
drag_and_drop = {
29+
insert_mode = true,
30+
},
31+
-- required for Windows users
32+
use_absolute_path = true,
33+
},
34+
},
35+
},
36+
{
37+
-- Make sure to set this up properly if you have lazy=true
38+
'MeanderingProgrammer/render-markdown.nvim',
39+
opts = {
40+
file_types = { 'markdown', 'Avante' },
41+
},
42+
ft = { 'markdown', 'Avante' },
43+
},
44+
},
45+
},
46+
}

lua/custom/plugins/catppuccin.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
return {
2+
'catppuccin/nvim',
3+
name = 'catppuccin',
4+
priority = 1001,
5+
6+
init = function()
7+
vim.cmd.colorscheme 'catppuccin-frappe'
8+
9+
-- You can configure highlights by doing something like:
10+
vim.cmd.hi 'Comment gui=none'
11+
end,
12+
}

lua/custom/plugins/copilot.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
return {
2+
-- copilot
3+
{
4+
'zbirenbaum/copilot.lua',
5+
cmd = 'Copilot',
6+
build = ':Copilot auth',
7+
opts = {
8+
suggestion = { enabled = false },
9+
panel = { enabled = false },
10+
},
11+
},
12+
13+
-- copilot cmp source
14+
{
15+
'nvim-cmp',
16+
dependencies = {
17+
{
18+
'zbirenbaum/copilot-cmp',
19+
dependencies = 'copilot.lua',
20+
opts = {},
21+
config = function()
22+
require('copilot_cmp').setup()
23+
end,
24+
},
25+
},
26+
},
27+
28+
-- copilot chat
29+
{
30+
'CopilotC-Nvim/CopilotChat.nvim',
31+
branch = 'canary',
32+
dependencies = {
33+
{ 'zbirenbaum/copilot.lua' }, -- or github/copilot.vim
34+
{ 'nvim-lua/plenary.nvim' }, -- for curl, log wrapper
35+
},
36+
opts = {
37+
-- debug = true, -- Enable debugging
38+
-- See Configuration section for rest
39+
},
40+
-- See Commands section for default commands if you want to lazy load on them
41+
keys = {
42+
{ '<leader>gcc', '<cmd>CopilotChatToggle<cr>', desc = 'Toggle CopilotChat' },
43+
{ '<leader>gc?', '<cmd>CopilotChatExplain<cr>', desc = 'Explain selected code with CopilotChat' },
44+
{ '<leader>gcr', '<cmd>CopilotChatReview<cr>', desc = 'Review selected code with CopilotChat' },
45+
},
46+
},
47+
}

lua/custom/plugins/dadbod.lua

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
return {
2+
'tpope/vim-dadbod',
3+
'kristijanhusak/vim-dadbod-completion',
4+
'kristijanhusak/vim-dadbod-ui',
5+
keys = {
6+
{ '<leader>zz', '<cmd>DBUIToggle<cr>', desc = 'Dadbod UI' },
7+
},
8+
-- config = function()
9+
-- vim.keymap.set('n', '<leader>db', '<CMD>DBUIToggle<CR>', { desc = 'Dadbod UI' })
10+
-- end,
11+
}

0 commit comments

Comments
 (0)