python configs i think

master
Jordan Orelli 2 months ago
parent f5d1901de7
commit a9c4046bc2

@ -3,13 +3,13 @@ local has_pyright = nil
-- These are files that are typically located in the root directory of a Python -- These are files that are typically located in the root directory of a Python
-- project -- project
local root_files = { local root_files = {
'pyproject.toml', 'pyrightconfig.json',
'.git',
'setup.py', 'setup.py',
'setup.cfg', 'setup.cfg',
'requirements.txt', 'requirements.txt',
'Pipfile', 'Pipfile',
'pyrightconfig.json', 'pyproject.toml',
'.git',
} }
local buf = vim.api.nvim_get_current_buf() local buf = vim.api.nvim_get_current_buf()
@ -17,9 +17,11 @@ local buf = vim.api.nvim_get_current_buf()
local root_dir = vim.fs.root(buf, root_files) local root_dir = vim.fs.root(buf, root_files)
local git_dir = vim.fs.root(buf, {'.git'}) local git_dir = vim.fs.root(buf, {'.git'})
local pyright_cmd = {'pyright-langserver', '--stdio'}
local pyright = vim.lsp.start({ local pyright = vim.lsp.start({
name = 'pyright', name = 'pyright',
cmd = {'pyright-langserver', '--stdio'}, cmd = pyright_cmd,
filetypes = { 'python' }, filetypes = { 'python' },
root_dir = root_dir, root_dir = root_dir,
single_file_support = true, single_file_support = true,

@ -1,2 +1,15 @@
-- yay local etc = require("etc")
-- local rustup_home = os.getenv('RUSTUP_HOME') or util.path.join(user_home, '.rustup')
local buf = vim.api.nvim_get_current_buf()
local rustup_dir = os.getenv('RUSTUP_HOME') or vim.env.HOME .. '.rustup'
if etc.has_executable("rust-analyzer") then
local rust_analyzer = vim.lsp.start({
name = 'rust-analyzer',
cmd = { 'rust-analyzer' },
filetypes = { 'rust' },
single_file_support = true,
root_dir = vim.fs.root(buf, {'Cargo.toml', '.git'}),
})
vim.lsp.buf_attach_client(buf, rust_analyzer)
end

@ -1,5 +1,8 @@
local signature = require("lsp_signature") local signature, _ = pcall(function()
return require("lsp_signature")
end);
if signature then
signature.setup({ signature.setup({
-- set to true to enable debug logging -- set to true to enable debug logging
debug = false, debug = false,
@ -41,11 +44,11 @@ signature.setup({
-- adjust float windows x position. -- adjust float windows x position.
-- can be either a number or function -- can be either a number or function
floating_window_off_x = -8, floating_window_off_x = 0,
-- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines -- adjust float windows y position. e.g -2 move window up 2 lines; 2 move down 2 lines
-- can be either number or function, see examples -- can be either number or function, see examples
floating_window_off_y = 14, floating_window_off_y = 0,
-- close floating window after ms when laster parameter is entered -- close floating window after ms when laster parameter is entered
close_timeout = 4000, close_timeout = 4000,
@ -128,3 +131,4 @@ signature.setup({
-- <M-d> and <M-u> are default keymaps to move cursor up and down -- <M-d> and <M-u> are default keymaps to move cursor up and down
keymaps = {} keymaps = {}
}) })
end

@ -15,3 +15,5 @@ telescope.setup({
} }
}, },
}) })
-- builtin.lsp_references

@ -1,6 +1,7 @@
local M = {} local M = {}
local telescope = require("telescope.builtin") local telescope = require("telescope.builtin")
local path = require("etc.path")
-- cache directory checks for great speed -- cache directory checks for great speed
local work_tree_lookup_cache = {} local work_tree_lookup_cache = {}
@ -28,4 +29,8 @@ M.project_files = function()
end end
end end
M.has_executable = function(exe_name)
return vim.fn.executable(exe_name) == 1
end
return M return M

@ -5,6 +5,8 @@ vim.keymap.set('n', '<F2>', telescope.diagnostics, {})
vim.keymap.set('n', '<leader>o', telescope.buffers, {}) vim.keymap.set('n', '<leader>o', telescope.buffers, {})
vim.keymap.set('n', '<C-k>', vim.cmd.bnext, {}) vim.keymap.set('n', '<C-k>', vim.cmd.bnext, {})
vim.keymap.set('n', '<C-j>', vim.cmd.bprev, {}) vim.keymap.set('n', '<C-j>', vim.cmd.bprev, {})
-- vim.keymap.set('n', '<leader>r', vim.lsp.buf.references, {})
vim.keymap.set('n', '<leader>r', telescope.lsp_references, {})
-- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv") -- vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
-- vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv") -- vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")

@ -52,7 +52,7 @@ function load_plugins(use)
"lewis6991/gitsigns.nvim" "lewis6991/gitsigns.nvim"
} }
use { "ray-x/lsp_signature.nvim" } -- use { "ray-x/lsp_signature.nvim" }
use { "ervandew/supertab" } use { "ervandew/supertab" }
-- a file browser -- a file browser

Loading…
Cancel
Save