:Mason
: To install, view and update all LSP, Formatter, Linter etc. to find and to update. to update all.:LspSettings pylsp
: To configure python-language-server.:LvimCahcheReset
: Reset the cache. Needed in case you change LSP and don't want to restart nvim.:PylspInstall <package>
: To install additional package likerope
in the same environment where pylsp is installed.
Last active
December 12, 2024 09:45
-
-
Save debakarr/9a8e69363e1bbba250c3785ba27eaa65 to your computer and use it in GitHub Desktop.
My dev setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
alias ls='eza' | |
alias vi='nvim' | |
export PIP_REQUIRE_VIRTUALENV=true | |
# Function to get Linodes with matching labels | |
function get_matching_linodes() { | |
local regex="$1" | |
local show_label="$2" | |
if [[ "$show_label" == "true" ]]; then | |
linode-cli linodes ls --json | jq -r ".[] | select(.label | test(\"$regex\")) | [.id, .label] | @tsv" | |
else | |
linode-cli linodes ls --json | jq -r ".[] | select(.label | test(\"$regex\")) | .id" | |
fi | |
} | |
# Function to get Linodes with non-matching labels | |
function get_non_matching_linodes() { | |
local regex="$1" | |
local show_label="$2" | |
if [[ "$show_label" == "true" ]]; then | |
linode-cli linodes ls --json | jq -r ".[] | select(.label | test(\"$regex\") | not) | [.id, .label] | @tsv" | |
else | |
linode-cli linodes ls --json | jq -r ".[] | select(.label | test(\"$regex\") | not) | .id" | |
fi | |
} | |
# Function to remove Linodes with matching labels | |
function remove_matching_linodes() { | |
local regex="$1" | |
get_matching_linodes "$regex" | xargs -t -n1 linode-cli linodes rm | |
} | |
# Function to remove Linodes without matching labels | |
function remove_non_matching_linodes() { | |
local regex="$1" | |
get_non_matching_linodes "$regex" | xargs -t -n1 linode-cli linodes rm | |
} | |
docker-delete-all-containers() { | |
if [ -z "$(docker ps -aq)" ]; then | |
echo "No containers to delete." | |
return 0 | |
fi | |
echo "Will delete the following containers:" | |
docker ps -aq | sort -u | |
echo "" | |
docker rm -vf $(docker ps -aq) | |
echo "Containers deleted." | |
} | |
docker-delete-all-images() { | |
if [ -z "$(docker images -aq)" ]; then | |
echo "No images to delete." | |
return 0 | |
fi | |
echo "Will delete the following images:" | |
docker images -aq | sort -u | |
echo "" | |
docker rmi -f $(docker images -aq) | |
echo "Images deleted." | |
} | |
docker-delete-all-network() { | |
if [ -z "$(docker network ls --filter "type=custom" -q)" ]; then | |
echo "No custom networks to delete." | |
return 0 | |
fi | |
echo "Will delete the following networks:" | |
docker network ls --filter "type=custom" -q | sort -u | |
echo "" | |
docker network rm $(docker network ls --filter "type=custom" -q) | |
echo "Networks deleted." | |
} | |
docker-delete-all-resources() { | |
docker-delete-all-containers | |
docker-delete-all-images | |
docker-delete-all-network | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Read the docs: https://www.lunarvim.org/docs/configuration | |
-- Example configs: https://github.com/LunarVim/starter.lvim | |
-- Video Tutorials: https://www.youtube.com/watch?v=sFA9kX-Ud_c&list=PLhoH5vyxr6QqGu0i7tt_XoVK9v-KvZ3m6 | |
-- Forum: https://www.reddit.com/r/lunarvim/ | |
-- Discord: https://discord.com/invite/Xb9B4Ny | |
-- save in normal mode | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
-- save in visual mode | |
lvim.keys.visual_mode["<C-s>"] = "<C-C>:update<CR>" | |
-- save in normal mode | |
lvim.keys.insert_mode["<C-s>"] = "<Esc>:update<CR>" | |
-- Removing default mappings | |
lvim.keys.normal_mode["<C-BS>"] = false | |
-- set relative numbered lines | |
vim.opt.relativenumber = true | |
-- Plugins | |
lvim.plugins = { | |
"stevearc/dressing.nvim", | |
{ | |
'linux-cultist/venv-selector.nvim', | |
dependencies = { 'neovim/nvim-lspconfig', 'nvim-telescope/telescope.nvim', 'mfussenegger/nvim-dap-python' }, | |
branch = "regexp", | |
config = function() | |
require('venv-selector').setup() | |
end, | |
event = 'VeryLazy', | |
}, | |
} | |
-- automatically install python syntax highlighting | |
lvim.builtin.treesitter.ensure_installed = { | |
"python", | |
} | |
-- don't automatically select LSP | |
lvim.lsp.automatic_servers_installation = false | |
-- add `pyright` to `skipped_servers` list | |
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) | |
-- remove `python-lsp-server` from `skipped_servers` list | |
lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) | |
return server ~= "pylsp" | |
end, lvim.lsp.automatic_configuration.skipped_servers) | |
-- setup formatting | |
local formatters = require "lvim.lsp.null-ls.formatters" | |
formatters.setup { { name = "black" }, } | |
lvim.format_on_save.enabled = true | |
lvim.format_on_save.pattern = { "*.py" } | |
-- setup linting | |
local linters = require "lvim.lsp.null-ls.linters" | |
linters.setup { { command = "flake8", filetypes = { "python" } } } | |
-- binding for switching virtual env | |
lvim.builtin.which_key.mappings["C"] = { | |
name = "Python", | |
c = { "<cmd>VenvSelect<cr>", "Choose Env" }, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Aliases | |
Set-Alias ll ls | |
Set-Alias vi lvim | |
# Prompt | |
oh-my-posh init pwsh | Invoke-Expression | |
# Terminal Icons | |
Import-Module -Name Terminal-Icons | |
# PSReadLine | |
Import-Module PSReadLine | |
Set-PSReadLineOption -PredictionSource History | |
Set-PSReadLineOption -PredictionViewStyle ListView | |
# Functions | |
function whereis ($command) { | |
Get-Command -Name $command -ErrorAction SilentlyContinue | | |
Select-Object -ExpandProperty Path -ErrorAction SilentlyContinue | |
} |
TODO: Probably make a PowerShell/Bash script for this.
- Download and Install Git. Can use winget.
- Download and Install Neovim. Can use winget.
- Download and Install PowerShell. Can use winget.
- Download and Install oh-my-posh. Can use winget.
- Download and Install Nerd Font (JetBrainsMono).
- Download and Install make. Can use chocolatey.
- Download Python 3.12, 3.11, 3.10, 3.9, 3.8. Use chocolatey version history page to know the latest version for each which have setup file: https://community.chocolatey.org/packages/python#versionhistory
- Download Visual Studio build tools.
- Download and Install GCC and MinGW-w64.
- Install
LunarVimLazyVim - Download and Install Docker in both Windows and Linux (WSL1): Follow this guide. To fix access issue in Windows follow this guide.
- Download and Install OBS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"pylsp.plugins.rope_autoimport.enabled": true | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$help": "https://aka.ms/terminal-documentation", | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"actions": | |
[ | |
{ | |
"command": | |
{ | |
"action": "copy", | |
"singleLine": false | |
}, | |
"keys": "ctrl+c" | |
}, | |
{ | |
"command": "paste", | |
"keys": "ctrl+v" | |
}, | |
{ | |
"command": | |
{ | |
"action": "splitPane", | |
"split": "auto", | |
"splitMode": "duplicate" | |
}, | |
"keys": "alt+shift+d" | |
}, | |
{ | |
"command": "find", | |
"keys": "ctrl+shift+f" | |
} | |
], | |
"copyFormatting": "none", | |
"copyOnSelect": false, | |
"defaultProfile": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
"newTabMenu": | |
[ | |
{ | |
"type": "remainingProfiles" | |
} | |
], | |
"profiles": | |
{ | |
"defaults": | |
{ | |
"font": | |
{ | |
"face": "JetBrainsMono Nerd Font Mono" | |
}, | |
"startingDirectory": "C:\\Source" | |
}, | |
"list": | |
[ | |
{ | |
"commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", | |
"guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"hidden": false, | |
"name": "Windows PowerShell" | |
}, | |
{ | |
"commandline": "%SystemRoot%\\System32\\cmd.exe", | |
"guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", | |
"hidden": false, | |
"name": "Command Prompt" | |
}, | |
{ | |
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", | |
"hidden": false, | |
"name": "PowerShell", | |
"source": "Windows.Terminal.PowershellCore" | |
}, | |
{ | |
"guid": "{b453ae62-4e3d-5e58-b989-0a998ec441b8}", | |
"hidden": false, | |
"name": "Azure Cloud Shell", | |
"source": "Windows.Terminal.Azure" | |
} | |
] | |
}, | |
"schemes": | |
[ | |
{ | |
"background": "#0C0C0C", | |
"black": "#0C0C0C", | |
"blue": "#0037DA", | |
"brightBlack": "#767676", | |
"brightBlue": "#3B78FF", | |
"brightCyan": "#61D6D6", | |
"brightGreen": "#16C60C", | |
"brightPurple": "#B4009E", | |
"brightRed": "#E74856", | |
"brightWhite": "#F2F2F2", | |
"brightYellow": "#F9F1A5", | |
"cursorColor": "#FFFFFF", | |
"cyan": "#3A96DD", | |
"foreground": "#CCCCCC", | |
"green": "#13A10E", | |
"name": "Campbell", | |
"purple": "#881798", | |
"red": "#C50F1F", | |
"selectionBackground": "#FFFFFF", | |
"white": "#CCCCCC", | |
"yellow": "#C19C00" | |
}, | |
{ | |
"background": "#012456", | |
"black": "#0C0C0C", | |
"blue": "#0037DA", | |
"brightBlack": "#767676", | |
"brightBlue": "#3B78FF", | |
"brightCyan": "#61D6D6", | |
"brightGreen": "#16C60C", | |
"brightPurple": "#B4009E", | |
"brightRed": "#E74856", | |
"brightWhite": "#F2F2F2", | |
"brightYellow": "#F9F1A5", | |
"cursorColor": "#FFFFFF", | |
"cyan": "#3A96DD", | |
"foreground": "#CCCCCC", | |
"green": "#13A10E", | |
"name": "Campbell Powershell", | |
"purple": "#881798", | |
"red": "#C50F1F", | |
"selectionBackground": "#FFFFFF", | |
"white": "#CCCCCC", | |
"yellow": "#C19C00" | |
}, | |
{ | |
"background": "#282C34", | |
"black": "#282C34", | |
"blue": "#61AFEF", | |
"brightBlack": "#5A6374", | |
"brightBlue": "#61AFEF", | |
"brightCyan": "#56B6C2", | |
"brightGreen": "#98C379", | |
"brightPurple": "#C678DD", | |
"brightRed": "#E06C75", | |
"brightWhite": "#DCDFE4", | |
"brightYellow": "#E5C07B", | |
"cursorColor": "#FFFFFF", | |
"cyan": "#56B6C2", | |
"foreground": "#DCDFE4", | |
"green": "#98C379", | |
"name": "One Half Dark", | |
"purple": "#C678DD", | |
"red": "#E06C75", | |
"selectionBackground": "#FFFFFF", | |
"white": "#DCDFE4", | |
"yellow": "#E5C07B" | |
}, | |
{ | |
"background": "#FAFAFA", | |
"black": "#383A42", | |
"blue": "#0184BC", | |
"brightBlack": "#4F525D", | |
"brightBlue": "#61AFEF", | |
"brightCyan": "#56B5C1", | |
"brightGreen": "#98C379", | |
"brightPurple": "#C577DD", | |
"brightRed": "#DF6C75", | |
"brightWhite": "#FFFFFF", | |
"brightYellow": "#E4C07A", | |
"cursorColor": "#4F525D", | |
"cyan": "#0997B3", | |
"foreground": "#383A42", | |
"green": "#50A14F", | |
"name": "One Half Light", | |
"purple": "#A626A4", | |
"red": "#E45649", | |
"selectionBackground": "#4F525D", | |
"white": "#FAFAFA", | |
"yellow": "#C18301" | |
}, | |
{ | |
"background": "#002B36", | |
"black": "#002B36", | |
"blue": "#268BD2", | |
"brightBlack": "#073642", | |
"brightBlue": "#839496", | |
"brightCyan": "#93A1A1", | |
"brightGreen": "#586E75", | |
"brightPurple": "#6C71C4", | |
"brightRed": "#CB4B16", | |
"brightWhite": "#FDF6E3", | |
"brightYellow": "#657B83", | |
"cursorColor": "#FFFFFF", | |
"cyan": "#2AA198", | |
"foreground": "#839496", | |
"green": "#859900", | |
"name": "Solarized Dark", | |
"purple": "#D33682", | |
"red": "#DC322F", | |
"selectionBackground": "#FFFFFF", | |
"white": "#EEE8D5", | |
"yellow": "#B58900" | |
}, | |
{ | |
"background": "#FDF6E3", | |
"black": "#002B36", | |
"blue": "#268BD2", | |
"brightBlack": "#073642", | |
"brightBlue": "#839496", | |
"brightCyan": "#93A1A1", | |
"brightGreen": "#586E75", | |
"brightPurple": "#6C71C4", | |
"brightRed": "#CB4B16", | |
"brightWhite": "#FDF6E3", | |
"brightYellow": "#657B83", | |
"cursorColor": "#002B36", | |
"cyan": "#2AA198", | |
"foreground": "#657B83", | |
"green": "#859900", | |
"name": "Solarized Light", | |
"purple": "#D33682", | |
"red": "#DC322F", | |
"selectionBackground": "#073642", | |
"white": "#EEE8D5", | |
"yellow": "#B58900" | |
}, | |
{ | |
"background": "#000000", | |
"black": "#000000", | |
"blue": "#3465A4", | |
"brightBlack": "#555753", | |
"brightBlue": "#729FCF", | |
"brightCyan": "#34E2E2", | |
"brightGreen": "#8AE234", | |
"brightPurple": "#AD7FA8", | |
"brightRed": "#EF2929", | |
"brightWhite": "#EEEEEC", | |
"brightYellow": "#FCE94F", | |
"cursorColor": "#FFFFFF", | |
"cyan": "#06989A", | |
"foreground": "#D3D7CF", | |
"green": "#4E9A06", | |
"name": "Tango Dark", | |
"purple": "#75507B", | |
"red": "#CC0000", | |
"selectionBackground": "#FFFFFF", | |
"white": "#D3D7CF", | |
"yellow": "#C4A000" | |
}, | |
{ | |
"background": "#FFFFFF", | |
"black": "#000000", | |
"blue": "#3465A4", | |
"brightBlack": "#555753", | |
"brightBlue": "#729FCF", | |
"brightCyan": "#34E2E2", | |
"brightGreen": "#8AE234", | |
"brightPurple": "#AD7FA8", | |
"brightRed": "#EF2929", | |
"brightWhite": "#EEEEEC", | |
"brightYellow": "#FCE94F", | |
"cursorColor": "#000000", | |
"cyan": "#06989A", | |
"foreground": "#555753", | |
"green": "#4E9A06", | |
"name": "Tango Light", | |
"purple": "#75507B", | |
"red": "#CC0000", | |
"selectionBackground": "#555753", | |
"white": "#D3D7CF", | |
"yellow": "#C4A000" | |
}, | |
{ | |
"background": "#000000", | |
"black": "#000000", | |
"blue": "#000080", | |
"brightBlack": "#808080", | |
"brightBlue": "#0000FF", | |
"brightCyan": "#00FFFF", | |
"brightGreen": "#00FF00", | |
"brightPurple": "#FF00FF", | |
"brightRed": "#FF0000", | |
"brightWhite": "#FFFFFF", | |
"brightYellow": "#FFFF00", | |
"cursorColor": "#FFFFFF", | |
"cyan": "#008080", | |
"foreground": "#C0C0C0", | |
"green": "#008000", | |
"name": "Vintage", | |
"purple": "#800080", | |
"red": "#800000", | |
"selectionBackground": "#FFFFFF", | |
"white": "#C0C0C0", | |
"yellow": "#808000" | |
} | |
], | |
"themes": [] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- "C:\Users\<username>\AppData\Local\lvim\config.lua" | |
-- Enable powershell as your default shell | |
vim.opt.shell = "pwsh.exe" | |
vim.opt.shellcmdflag = | |
"-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;" | |
vim.cmd [[ | |
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' | |
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' | |
set shellquote= shellxquote= | |
]] | |
-- Set a compatible clipboard manager | |
vim.g.clipboard = { | |
copy = { | |
["+"] = "win32yank.exe -i --crlf", | |
["*"] = "win32yank.exe -i --crlf", | |
}, | |
paste = { | |
["+"] = "win32yank.exe -o --lf", | |
["*"] = "win32yank.exe -o --lf", | |
}, | |
} | |
-- save in normal mode | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
-- save in visual mode | |
lvim.keys.visual_mode["<C-s>"] = "<C-C>:update<CR>" | |
-- save in normal mode | |
lvim.keys.insert_mode["<C-s>"] = "<Esc>:update<CR>" | |
-- Removing default mappings | |
lvim.keys.normal_mode["<C-BS>"] = false | |
-- set relative numbered lines | |
vim.opt.relativenumber = true | |
-- Plugins | |
lvim.plugins = { | |
"stevearc/dressing.nvim", | |
{ | |
'linux-cultist/venv-selector.nvim', | |
dependencies = { 'neovim/nvim-lspconfig', 'nvim-telescope/telescope.nvim', 'mfussenegger/nvim-dap-python' }, | |
branch = "regexp", | |
config = function() | |
require('venv-selector').setup() | |
end, | |
event = 'VeryLazy', | |
}, | |
} | |
-- automatically install python syntax highlighting | |
lvim.builtin.treesitter.ensure_installed = { | |
"python", | |
} | |
-- don't automatically select LSP | |
lvim.lsp.automatic_servers_installation = false | |
-- add `pyright` to `skipped_servers` list | |
vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) | |
-- remove `python-lsp-server` from `skipped_servers` list | |
lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) | |
return server ~= "pylsp" | |
end, lvim.lsp.automatic_configuration.skipped_servers) | |
-- setup formatting | |
local formatters = require "lvim.lsp.null-ls.formatters" | |
formatters.setup { { name = "black" }, } | |
lvim.format_on_save.enabled = true | |
lvim.format_on_save.pattern = { "*.py" } | |
-- setup linting | |
local linters = require "lvim.lsp.null-ls.linters" | |
linters.setup { { command = "flake8", filetypes = { "python" } } } | |
-- binding for switching virtual env | |
lvim.builtin.which_key.mappings["C"] = { | |
name = "Python", | |
c = { "<cmd>lua require('swenv.api').pick_venv()<cr>", "Choose Env" }, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment