diff --git a/nvim/after/ftplugin/lua.lua b/nvim/after/ftplugin/lua.lua index 0b3214b..5b4f9c0 100644 --- a/nvim/after/ftplugin/lua.lua +++ b/nvim/after/ftplugin/lua.lua @@ -1 +1,4 @@ -print("You are in lua") +vim.opt_local.tabstop = 2 +vim.opt_local.softtabstop = 2 +vim.opt_local.shiftwidth = 2 +vim.opt_local.expandtab = true diff --git a/nvim/after/ftplugin/python.lua b/nvim/after/ftplugin/python.lua index 2b10adc..12bc83d 100644 --- a/nvim/after/ftplugin/python.lua +++ b/nvim/after/ftplugin/python.lua @@ -1 +1,37 @@ -print("You are in Python") +local has_pyright = nil + +-- These are files that are typically located in the root directory of a Python +-- project +local root_files = { + 'pyproject.toml', + 'setup.py', + 'setup.cfg', + 'requirements.txt', + 'Pipfile', + 'pyrightconfig.json', + '.git', +} + +local buf = vim.api.nvim_get_current_buf() + +local root_dir = vim.fs.root(buf, root_files) +local git_dir = vim.fs.root(buf, {'.git'}) + +local lsp_server = vim.lsp.start({ + name = 'pyright', + cmd = {'pyright-langserver', '--stdio'}, + filetypes = { 'python' }, + root_dir = root_dir, + single_file_support = false, + settings = { + python = { + analysis = { + autoSearchPaths = true, + useLibraryCodeForTypes = true, + diagnosticMode = 'openFilesOnly', + }, + }, + }, +}) + +vim.lsp.buf_attach_client(buf, lsp_server) diff --git a/nvim/after/plugin/colors.lua b/nvim/after/plugin/colors.lua index 3317a0c..cfb21c3 100644 --- a/nvim/after/plugin/colors.lua +++ b/nvim/after/plugin/colors.lua @@ -1,5 +1,3 @@ -print("Setting up colors") - vim.g.jellybeans_use_term_italics = 1 local background = {} diff --git a/nvim/after/plugin/gitsigns.lua b/nvim/after/plugin/gitsigns.lua index 30e62b6..a78f1f6 100644 --- a/nvim/after/plugin/gitsigns.lua +++ b/nvim/after/plugin/gitsigns.lua @@ -1,5 +1,3 @@ -print("Configuring gitsigns") - local gitsigns = require('gitsigns') gitsigns.setup { @@ -29,9 +27,9 @@ gitsigns.setup { virt_text_priority = 100, }, current_line_blame_formatter = ', - ', - current_line_blame_formatter_opts = { - relative_time = false, - }, + -- current_line_blame_formatter_opts = { + -- relative_time = false, + -- }, sign_priority = 6, update_debounce = 100, status_formatter = nil, -- Use default diff --git a/nvim/after/plugin/lsp.lua b/nvim/after/plugin/lsp.lua index 343a080..e69de29 100644 --- a/nvim/after/plugin/lsp.lua +++ b/nvim/after/plugin/lsp.lua @@ -1 +0,0 @@ -print("LSP setting up") diff --git a/nvim/after/plugin/telescope.lua b/nvim/after/plugin/telescope.lua index 8a93426..4c62337 100644 --- a/nvim/after/plugin/telescope.lua +++ b/nvim/after/plugin/telescope.lua @@ -1,5 +1,3 @@ -print("After Telescope") - local telescope = require('telescope') local builtin = require('telescope.builtin') diff --git a/nvim/after/plugin/treesitter.lua b/nvim/after/plugin/treesitter.lua index 347a717..51b9626 100644 --- a/nvim/after/plugin/treesitter.lua +++ b/nvim/after/plugin/treesitter.lua @@ -1,6 +1,3 @@ -print("Configuring Treesitter") - - require'nvim-treesitter.configs'.setup { -- A list of parser names, or "all" ensure_installed = { diff --git a/nvim/init.lua b/nvim/init.lua index bf01b16..48720e1 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,11 +1,13 @@ -print("Init start") - -- set leader to space vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' --- Set to true if you have a Nerd Font installed and selected in the terminal -vim.g.have_nerd_font = false +-- Set to true if you have a Nerd Font installed and selected in the terminal. +-- I configure my terminal to set this environment variable. +if vim.env.NERD_FONTS then + vim.g.have_nerd_font = true +else + vim.g.have_nerd_font = false +end -- for some reason vim-tree needs this to happen very early on and no I do not -- know why @@ -15,3 +17,4 @@ vim.g.loaded_netrwPlugin = 1 require("plugins") require("prefs") require("keys") +require("lsp") diff --git a/nvim/lua/etc.lua b/nvim/lua/etc.lua index 9ae61d5..7834406 100644 --- a/nvim/lua/etc.lua +++ b/nvim/lua/etc.lua @@ -1,4 +1,3 @@ -print("Loading up etc definitions") local M = {} local telescope = require("telescope.builtin") diff --git a/nvim/lua/keys.lua b/nvim/lua/keys.lua index d0283fe..e15d17c 100644 --- a/nvim/lua/keys.lua +++ b/nvim/lua/keys.lua @@ -1,8 +1,8 @@ -print("Loading key mappings") - local telescope = require('telescope.builtin') local etc = require("etc") vim.keymap.set('n', '', etc.project_files, {}) +vim.keymap.set('n', '', telescope.diagnostics, {}) +vim.keymap.set('n', 'o', telescope.buffers, {}) -- vim.keymap.set("v", "J", ":m '>+1gv=gv") -- vim.keymap.set("v", "K", ":m '>-2gv=gv") diff --git a/nvim/lua/lsp.lua b/nvim/lua/lsp.lua new file mode 100644 index 0000000..54cc59b --- /dev/null +++ b/nvim/lua/lsp.lua @@ -0,0 +1,14 @@ +vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + -- this code is run every time we attach an LSP + print("LSP Attached") + end, +}) + +vim.api.nvim_create_autocmd("LspDetach", { + callback = function(args) + -- this code runs every time a buffer detaches from an LSP + end, +}) + +-- vim.lsp.set_log_level(“DEBUG”) diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 50554fd..3ad4ebc 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -1,8 +1,8 @@ -print("Loading plugins") - vim.cmd [[packadd packer.nvim]] -return require('packer').startup(function(use) +local packer = require('packer') + +function load_plugins(use) -- the plugin that manages the plugins use 'wbthomason/packer.nvim' @@ -43,13 +43,14 @@ return require('packer').startup(function(use) } -- a file browser - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 use { "nvim-tree/nvim-tree.lua" } -- helps you configure lsp servers use { "neovim/nvim-lspconfig" } -end) +end + +local plugins = packer.startup(load_plugins) +return plugins diff --git a/nvim/lua/prefs.lua b/nvim/lua/prefs.lua index 41ef3b9..4fab5f3 100644 --- a/nvim/lua/prefs.lua +++ b/nvim/lua/prefs.lua @@ -1,5 +1,3 @@ -print("Applying Preferences") - -- The character coding used within vim. I don't remember why I set this, to be -- honest. vim.opt.encoding = "utf-8" diff --git a/wezterm/config.lua b/wezterm/config.lua index d298056..578bfad 100644 --- a/wezterm/config.lua +++ b/wezterm/config.lua @@ -19,6 +19,8 @@ config.enable_tab_bar = true -- hide the tab bar in windows that have only one tab config.hide_tab_bar_if_only_one_tab = true +config.font = wezterm.font('JetBrains Mono', { weight = 'Bold' }) + config.font_size = 14 config.launch_menu = { @@ -52,4 +54,8 @@ config.window_padding = { bottom = -8, } +config.set_environment_variables = { + NERD_FONTS = "1", +} + return config