@@ -50,7 +50,6 @@ Kickstart Guide:
5050 - :
5151 - Tutor
5252 - <enter key>
53-
5453 (If you already know the Neovim basics, you can skip this step.)
5554
5655 Once you've completed that, you can continue working through **AND READING** the rest
@@ -102,7 +101,7 @@ vim.g.have_nerd_font = false
102101vim .opt .number = true
103102-- You can also add relative line numbers, to help with jumping.
104103-- Experiment for yourself to see if you like it!
105- -- vim.opt.relativenumber = true
104+ vim .opt .relativenumber = true
106105
107106-- Enable mouse mode, can be useful for resizing splits for example!
108107vim .opt .mouse = ' a'
@@ -156,6 +155,52 @@ vim.opt.cursorline = true
156155-- Minimal number of screen lines to keep above and below the cursor.
157156vim .opt .scrolloff = 10
158157
158+ local mode_disabled = false
159+ local filetype_disabled = false
160+
161+ local function check_eof_scrolloff ()
162+ if mode_disabled or filetype_disabled then
163+ return
164+ end
165+
166+ local win_height = vim .api .nvim_win_get_height (0 )
167+ local win_view = vim .fn .winsaveview ()
168+ local scrolloff = math.min (vim .o .scrolloff , math.floor (win_height / 2 ))
169+ local scrolloff_line_count = win_height - (vim .fn .line ' w$' - win_view .topline + 1 )
170+ local distance_to_last_line = vim .fn .line ' $' - win_view .lnum
171+
172+ if distance_to_last_line < scrolloff and scrolloff_line_count + distance_to_last_line < scrolloff then
173+ win_view .topline = win_view .topline + scrolloff - (scrolloff_line_count + distance_to_last_line )
174+ vim .fn .winrestview (win_view )
175+ end
176+ end
177+
178+ vim .api .nvim_create_autocmd ({ ' CursorMoved' , ' CursorMovedI' }, {
179+ pattern = ' *' ,
180+ callback = check_eof_scrolloff ,
181+ })
182+
183+ -- Grayson - Set the width of a tab
184+ vim .opt .tabstop = 4
185+ vim .opt .shiftwidth = 4
186+ vim .opt .softtabstop = 4
187+
188+ -- Grayson - Auto indent settings
189+ vim .opt .expandtab = false
190+ vim .opt .smarttab = true
191+ vim .opt .autoindent = true
192+ vim .opt .smartindent = true
193+ vim .opt .cindent = true
194+
195+ -- Escape insert mode *and* dismiss Copilot suggestions
196+ vim .keymap .set (' i' , ' <Esc>' , function ()
197+ local ok , suggestion = pcall (require , ' copilot.suggestion' )
198+ if ok and suggestion and suggestion .is_visible () then
199+ suggestion .dismiss ()
200+ end
201+ return ' <Esc>'
202+ end , { expr = true , silent = true })
203+
159204-- if performing an operation that would fail due to unsaved changes in the buffer (like `:q`),
160205-- instead raise a dialog asking if you wish to save the current file(s)
161206-- See `:help 'confirm'`
@@ -247,6 +292,61 @@ require('lazy').setup({
247292 --
248293 -- Use `opts = {}` to automatically pass options to a plugin's `setup()` function, forcing the plugin to be loaded.
249294 --
295+ -- Colorizer
296+ {
297+ ' norcalli/nvim-colorizer.lua' ,
298+ config = function ()
299+ require (' colorizer' ).setup ({
300+ ' *' , -- Highlight all filetypes
301+ css = { rgb_fn = true },
302+ html = { names = true },
303+ }, {
304+ mode = ' background' ,
305+ })
306+ end ,
307+ },
308+
309+ -- GitHub Copilot
310+ {
311+ ' zbirenbaum/copilot.lua' ,
312+ cmd = ' Copilot' ,
313+ event = ' InsertEnter' ,
314+ config = function ()
315+ require (' copilot' ).setup {
316+ suggestion = {
317+ enabled = true ,
318+ auto_trigger = true ,
319+ debounce = 75 ,
320+ keymap = {
321+ accept = ' <Tab>' ,
322+ next = ' <C-j>' ,
323+ prev = ' <C-k>' ,
324+ dismiss = ' <C-c>' ,
325+ },
326+ },
327+ panel = {
328+ enabled = true ,
329+ auto_refresh = false ,
330+ keymap = {
331+ jump_prev = ' [[' ,
332+ jump_next = ' ]]' ,
333+ accept = ' <CR>' ,
334+ refresh = ' gr' ,
335+ open = ' <M-CR>' ,
336+ },
337+ },
338+ filetypes = {
339+ markdown = true ,
340+ help = false ,
341+ gitcommit = true ,
342+ gitrebase = true ,
343+ [' *' ] = true , -- enable for all filetypes
344+ },
345+ copilot_node_command = ' node' , -- Ensure correct Node.js path
346+ server_opts_overrides = {},
347+ }
348+ end ,
349+ },
250350
251351 -- Alternatively, use `config = function() ... end` for full control over the configuration.
252352 -- If you prefer to call `setup` explicitly, use:
@@ -434,6 +534,9 @@ require('lazy').setup({
434534 vim .keymap .set (' n' , ' <leader>s.' , builtin .oldfiles , { desc = ' [S]earch Recent Files ("." for repeat)' })
435535 vim .keymap .set (' n' , ' <leader><leader>' , builtin .buffers , { desc = ' [ ] Find existing buffers' })
436536
537+ -- Open file explorer
538+ vim .keymap .set (' n' , ' <leader>e' , ' :Ex<CR>' , { desc = ' [E]xplorer' })
539+
437540 -- Slightly advanced example of overriding default behavior and theme
438541 vim .keymap .set (' n' , ' <leader>/' , function ()
439542 -- You can pass additional configuration to Telescope to change the theme, layout, etc.
@@ -472,6 +575,7 @@ require('lazy').setup({
472575 },
473576 },
474577 },
578+
475579 {
476580 -- Main LSP Configuration
477581 ' neovim/nvim-lspconfig' ,
@@ -668,10 +772,50 @@ require('lazy').setup({
668772 -- - capabilities (table): Override fields in capabilities. Can be used to disable certain LSP features.
669773 -- - settings (table): Override the default settings passed when initializing the server.
670774 -- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
775+ local function on_attach (client , bufnr )
776+ if client .name == ' sqls' then
777+ client .server_capabilities .documentFormattingProvider = false
778+ client .server_capabilities .documentRangeFormattingProvider = false
779+ end
780+ end
781+
671782 local servers = {
672783 -- clangd = {},
673- -- gopls = {},
674- -- pyright = {},
784+ gopls = {},
785+ pyright = {},
786+ jsonls = {
787+ settings = {
788+ json = {
789+ validate = { enable = true },
790+ },
791+ },
792+ },
793+ sqls = {
794+ on_attach = on_attach ,
795+ settings = {
796+ sqls = {
797+ connections = {
798+ {
799+ driver = ' postgres' ,
800+ dataSourceName = ' postgres:postgres@localhost:5432/gator' ,
801+ schemaSearchPath = { ' public' },
802+ },
803+ },
804+ },
805+ },
806+ },
807+ clangd = {},
808+ html = {},
809+ cssls = {},
810+ ts_ls = {
811+ filetypes = { ' javascript' , ' typescript' , ' javascriptreact' , ' typescriptreact' },
812+ },
813+ jdtls = {},
814+ eslint = {
815+ settings = {
816+ format = { enable = true },
817+ },
818+ },
675819 -- rust_analyzer = {},
676820 -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
677821 --
@@ -961,7 +1105,7 @@ require('lazy').setup({
9611105 main = ' nvim-treesitter.configs' , -- Sets main module to use for opts
9621106 -- [[ Configure Treesitter ]] See `:help nvim-treesitter`
9631107 opts = {
964- ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' },
1108+ ensure_installed = { ' bash' , ' c' , ' diff' , ' html' , ' lua' , ' luadoc' , ' markdown' , ' markdown_inline' , ' query' , ' vim' , ' vimdoc' , ' java ' },
9651109 -- Autoinstall languages that are not installed
9661110 auto_install = true ,
9671111 highlight = {
0 commit comments