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
155 changes: 150 additions & 5 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ Kickstart Guide:
- :
- Tutor
- <enter key>

(If you already know the Neovim basics, you can skip this step.)

Once you've completed that, you can continue working through **AND READING** the rest
Expand Down Expand Up @@ -102,7 +101,7 @@ vim.g.have_nerd_font = false
vim.o.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.o.relativenumber = true
vim.opt.relativenumber = true

-- Enable mouse mode, can be useful for resizing splits for example!
vim.o.mouse = 'a'
Expand Down Expand Up @@ -161,6 +160,53 @@ vim.o.cursorline = true
-- Minimal number of screen lines to keep above and below the cursor.
vim.o.scrolloff = 10

local mode_disabled = false
local filetype_disabled = false

local function check_eof_scrolloff()
if mode_disabled or filetype_disabled then
return
end

local win_height = vim.api.nvim_win_get_height(0)
local win_view = vim.fn.winsaveview()
local scrolloff = math.min(vim.o.scrolloff, math.floor(win_height / 2))
local scrolloff_line_count = win_height - (vim.fn.line 'w$' - win_view.topline + 1)
local distance_to_last_line = vim.fn.line '$' - win_view.lnum

if distance_to_last_line < scrolloff and scrolloff_line_count + distance_to_last_line < scrolloff then
win_view.topline = win_view.topline + scrolloff - (scrolloff_line_count + distance_to_last_line)
vim.fn.winrestview(win_view)
end
end

vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
pattern = '*',
callback = check_eof_scrolloff,
})

-- Grayson - Set the width of a tab
vim.opt.tabstop = 4
vim.opt.shiftwidth = 4
vim.opt.softtabstop = 4

-- Grayson - Auto indent settings
vim.opt.expandtab = false
vim.opt.smarttab = true
vim.opt.autoindent = true
vim.opt.smartindent = true
vim.opt.cindent = true

-- Escape insert mode *and* dismiss Copilot suggestions
vim.keymap.set('i', '<Esc>', function()
local ok, suggestion = pcall(require, 'copilot.suggestion')
if ok and suggestion and suggestion.is_visible() then
suggestion.dismiss()
end
return '<Esc>'
end, { expr = true, silent = true })


-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
Expand Down Expand Up @@ -255,6 +301,61 @@ require('lazy').setup({
--
-- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
--
-- Colorizer
{
'norcalli/nvim-colorizer.lua',
config = function()
require('colorizer').setup({
'*', -- Highlight all filetypes
css = { rgb_fn = true },
html = { names = true },
}, {
mode = 'background',
})
end,
},

-- GitHub Copilot
{
'zbirenbaum/copilot.lua',
cmd = 'Copilot',
event = 'InsertEnter',
config = function()
require('copilot').setup {
suggestion = {
enabled = true,
auto_trigger = true,
debounce = 75,
keymap = {
accept = '<Tab>',
next = '<C-j>',
prev = '<C-k>',
dismiss = '<C-c>',
},
},
panel = {
enabled = true,
auto_refresh = false,
keymap = {
jump_prev = '[[',
jump_next = ']]',
accept = '<CR>',
refresh = 'gr',
open = '<M-CR>',
},
},
filetypes = {
markdown = true,
help = false,
gitcommit = true,
gitrebase = true,
['*'] = true, -- enable for all filetypes
},
copilot_node_command = 'node', -- Ensure correct Node.js path
server_opts_overrides = {},
}
end,
},

-- Alternatively, use `config = function() ... end` for full control over the configuration.
-- If you prefer to call `setup` explicitly, use:
Expand Down Expand Up @@ -437,6 +538,9 @@ require('lazy').setup({
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' })

-- Open file explorer
vim.keymap.set('n', '<leader>e', ':Ex<CR>', { desc = '[E]xplorer' })

-- 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 @@ -475,6 +579,7 @@ require('lazy').setup({
},
},
},

{
-- Main LSP Configuration
'neovim/nvim-lspconfig',
Expand Down Expand Up @@ -670,10 +775,50 @@ require('lazy').setup({
-- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
-- - 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 function on_attach(client, bufnr)
if client.name == 'sqls' then
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end
end

local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
gopls = {},
pyright = {},
jsonls = {
settings = {
json = {
validate = { enable = true },
},
},
},
sqls = {
on_attach = on_attach,
settings = {
sqls = {
connections = {
{
driver = 'postgres',
dataSourceName = 'postgres:postgres@localhost:5432/gator',
schemaSearchPath = { 'public' },
},
},
},
},
},
clangd = {},
html = {},
cssls = {},
ts_ls = {
filetypes = { 'javascript', 'typescript', 'javascriptreact', 'typescriptreact' },
},
jdtls = {},
eslint = {
settings = {
format = { enable = true },
},
},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
Expand Down Expand Up @@ -944,7 +1089,7 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc', 'java' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
Expand Down
35 changes: 35 additions & 0 deletions lua/autopairs-config.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
-- autopairs-config.lua

-- Setup autopairs with nvim-cmp.
local status_ok, npairs = pcall(require, 'nvim-autopairs')
if not status_ok then
return
end

npairs.setup {
check_ts = true,
ts_config = {
lua = { 'string', 'source' },
javascript = { 'string', 'template_string' },
java = false,
},
disable_filetype = { 'TelescopePrompt', 'spectre_panel' },
fast_wrap = {
map = '<M-e>',
chars = { '{', '[', '(', '"', "'" },
pattern = string.gsub([[ [%'%"%)%>%]%)%}%,] ]], '%s+', ''),
offset = 0, -- Offset from pattern match
end_key = '$',
keys = 'qwertyuiopzxcvbnmasdfghjkl',
check_comma = true,
highlight = 'PmenuSel',
highlight_grey = 'LineNr',
},
}

local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
local cmp_status_ok, cmp = pcall(require, 'cmp')
if not cmp_status_ok then
return
end
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done { map_char = { tex = '' } })
19 changes: 18 additions & 1 deletion lua/custom/plugins/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,21 @@
-- I promise not to create any merge conflicts in this directory :)
--
-- See the kickstart.nvim README for more information
return {}
print 'plugins.lua is being loaded'

return {

-- Colorizer
{
'norcalli/nvim-colorizer.lua',
config = function()
require('colorizer').setup({
'*', -- Highlight all filetypes
css = { rgb_fn = true },
html = { names = false },
}, {
mode = 'foreground',
})
end,
},
}
5 changes: 5 additions & 0 deletions lua/kickstart/plugins/copilot.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- lua/kickstart/plugins/copilot-vim.lua
return {
'github/copilot.vim',
event = 'InsertEnter', -- Lazy-load on insert
}
106 changes: 106 additions & 0 deletions lua/plugins.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
return {

-- Alpha (Dashboard)
{
'goolord/alpha-nvim',
lazy = true,
},

-- Auto Pairs
-- Added This Plugin
{
'windwp/nvim-autopairs',
},

-- Bufferline
{
'akinsho/bufferline.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},

-- Colorscheme
{
'folke/tokyonight.nvim',
},

-- Hop (Better Navigation)
{
'phaazon/hop.nvim',
lazy = true,
},

-- Lualine
{
'nvim-lualine/lualine.nvim',
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},

-- Language Support
{
'VonHeikemen/lsp-zero.nvim',
lazy = true,
branch = 'v1.x',
dependencies = {
-- LSP Support
{ 'neovim/nvim-lspconfig' }, -- Required
{ 'williamboman/mason.nvim' }, -- Optional
{ 'williamboman/mason-lspconfig.nvim' }, -- Optional

-- Autocompletion
{ 'hrsh7th/nvim-cmp' }, -- Required
{ 'hrsh7th/cmp-nvim-lsp' }, -- Required
{ 'hrsh7th/cmp-buffer' }, -- Optional
{ 'hrsh7th/cmp-path' }, -- Optional
{ 'saadparwaiz1/cmp_luasnip' }, -- Optional
{ 'hrsh7th/cmp-nvim-lua' }, -- Optional

-- Snippets
{ 'L3MON4D3/LuaSnip' }, -- Required
{ 'rafamadriz/friendly-snippets' }, -- Optional
},
},

-- Nvimtree (File Explorer)
{
'nvim-tree/nvim-tree.lua',
lazy = true,
dependencies = {
'nvim-tree/nvim-web-devicons',
},
},

-- Telescope (Fuzzy Finder)
{
'nvim-telescope/telescope.nvim',
lazy = true,
dependencies = {
{ 'nvim-lua/plenary.nvim' },
},
},

-- Treesitter
{
'nvim-treesitter/nvim-treesitter',
},

-- Toggle Term
{
'akinsho/toggleterm.nvim',
config = true,
},

-- Which-key
{
'folke/which-key.nvim',
lazy = true,
},
-- Github Copilot
{
'github/copilot.vim',
event = 'InsertEnter',
},
}
1 change: 1 addition & 0 deletions pack/github/start/copilot.vim
Submodule copilot.vim added at 51f80c
Loading