workin on lsp for nvim

master
Jordan Orelli 5 months ago
parent 3f55f449b5
commit 551db07d8a

@ -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

@ -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)

@ -1,5 +1,3 @@
print("Setting up colors")
vim.g.jellybeans_use_term_italics = 1
local background = {}

@ -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 = '<author>, <author_time:%Y-%m-%d> - <summary>',
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

@ -1 +0,0 @@
print("LSP setting up")

@ -1,5 +1,3 @@
print("After Telescope")
local telescope = require('telescope')
local builtin = require('telescope.builtin')

@ -1,6 +1,3 @@
print("Configuring Treesitter")
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = {

@ -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")

@ -1,4 +1,3 @@
print("Loading up etc definitions")
local M = {}
local telescope = require("telescope.builtin")

@ -1,8 +1,8 @@
print("Loading key mappings")
local telescope = require('telescope.builtin')
local etc = require("etc")
vim.keymap.set('n', '<C-p>', etc.project_files, {})
vim.keymap.set('n', '<F2>', telescope.diagnostics, {})
vim.keymap.set('n', '<leader>o', telescope.buffers, {})
-- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
-- vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")

@ -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”)

@ -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

@ -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"

@ -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

Loading…
Cancel
Save