From 8d1523d5aeb4d09d6f43439e83a1127fd4925c3d Mon Sep 17 00:00:00 2001 From: dpearre Date: Sat, 5 Oct 2024 15:54:50 -0700 Subject: [PATCH] attempt to enable python and php LSP; instant terminal; vimlike pane navigation --- init.lua | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index 3398838d..928f8083 100644 --- a/init.lua +++ b/init.lua @@ -158,6 +158,8 @@ vim.opt.cursorline = true -- vim.opt.scrolloff = 10 vim.opt.scrolloff = 4 +vim.opt.colorcolumn = '80,120' + -- [[ Basic Keymaps ]] -- See `:help vim.keymap.set()` @@ -181,6 +183,22 @@ vim.keymap.set('t', '', '', { desc = 'Exit terminal mode' } -- vim.keymap.set('n', '', 'echo "Use l to move!!"') -- vim.keymap.set('n', '', 'echo "Use k to move!!"') -- vim.keymap.set('n', '', 'echo "Use j to move!!"') +-- +-- +-- tab navigation from my old vimrc (thanks ChatGPT) +vim.keymap.set('n', 'th', ':tabprev', { noremap = true, silent = true }) +vim.keymap.set('n', 'tl', ':tabnext', { noremap = true, silent = true }) +vim.keymap.set('n', 'tn', ':tabnew', { noremap = true, silent = true }) +vim.keymap.set('n', 'tc', ':tabclose', { noremap = true, silent = true }) + +-- Keymap to open terminal in the bottom third of the window without welcome message (thanks ChatGPT) +-- +vim.keymap.set('n', '', function() + vim.cmd 'split | terminal' + vim.cmd 'startinsert' -- Automatically enter terminal mode + vim.cmd 'resize 10' -- Adjust the size of the terminal as needed + vim.cmd 'setlocal nonumber norelativenumber' -- Hide line numbers +end, { desc = 'Open terminal in the bottom 1/3 and start in terminal mode' }) -- Keybinds to make split navigation easier. -- Use CTRL+ to switch between windows @@ -205,6 +223,22 @@ vim.api.nvim_create_autocmd('TextYankPost', { end, }) +-- 10/4/2024: give python a 80 character hard wrap +vim.api.nvim_create_autocmd('FileType', { + pattern = 'python', + callback = function() + vim.opt_local.textwidth = 80 + end, +}) + +-- 10/4/2024: give markdown a 120 character hard wrap +vim.api.nvim_create_autocmd('FileType', { + pattern = 'markdown', + callback = function() + vim.opt_local.textwidth = 120 + end, +}) + -- [[ Install `lazy.nvim` plugin manager ]] -- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' @@ -608,7 +642,8 @@ require('lazy').setup({ local servers = { -- clangd = {}, -- gopls = {}, - -- pyright = {}, + pyright = {}, + phpactor = {}, -- rust_analyzer = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- @@ -889,7 +924,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', 'python', 'php' }, -- Autoinstall languages that are not installed auto_install = true, highlight = {