NVIM: Added Code formatting for python

This commit is contained in:
stitchy 2024-11-27 10:46:06 +00:00
parent 4d66a5e231
commit 3ec1ba5f9b
Signed by: stitchy
SSH key fingerprint: SHA256:yz2SoxdnY67tfY5Jzb0f2v8f5W3o/IF359kbcquWip8
4 changed files with 29 additions and 10 deletions

View file

@ -3,6 +3,7 @@ local map = vim.keymap.set
-- jk exit from insert mode
map("i", "jk", "<cmd>noh<cr><Esc>", { silent = true })
map({"n", "x"}, "<Esc>", "<cmd>noh<cr><Esc>", { silent = true })
----
-- Movements
@ -33,6 +34,8 @@ map("n", "<leader>>", "<cmd>BufferLineMoveNext<CR>", { desc = "Move buffer right
-- ToggleTerm Bindings
map("n", "<leader>a", "<cmd>ToggleTerm name=main<CR>", { desc = "Floating Terminal", silent = true })
-- Undotree
map('n', '<leader>fu', vim.cmd.UndotreeToggle)
----
-- Cool Macros
----

View file

@ -6,18 +6,18 @@ require'lspconfig'.texlab.setup{}
require'lspconfig'.svls.setup{}
require'lspconfig'.pylsp.setup{
settings = {
formatCommand = {"black"},
pylsp = {
plugins = {
pycodestyle = {
ignore = {'W391'},
maxLineLength = 100
jedai_completion = {
fuzzy = true
},
pylint = {
enabled = false
},
pyflakes = {
enabled = true
}
pyflakes = {
enabled = true
},
pylsp_mypy = {
enabled = true
}
}
}
}
@ -105,6 +105,15 @@ cmp.setup {
package.path = package.path .. ";/etc/nixos/config/nvim"
-- Funky plugins
require("conform").setup({
formatters_by_ft = {
python = { "isort", "black" },
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
})
require("bufferline").setup({ options = {
always_show_bufferline = true,
show_buffer_close_icons = false,

View file

@ -64,13 +64,17 @@ in
config = {
environment.systemPackages = (lib.attrVals [
"black"
"btop"
"ccls"
"eza"
"fd"
"fzf"
"git"
"glib"
"gnumake"
"gnupg"
"mypy"
"neofetch"
"p7zip"
"pinentry"
@ -97,6 +101,7 @@ in
customRC = builtins.readFile ../config/nvim/init.vim;
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
conform-nvim
bufferline-nvim
cmp-nvim-lsp
cmp_luasnip
@ -113,6 +118,7 @@ in
toggleterm-nvim
tokyonight-nvim
typst-vim
undotree
vim-lsp-cxx-highlight
which-key-nvim
];

View file

@ -60,9 +60,10 @@ in
kicad
#steamvr?
procps
ripgrep
usbutils
yt-dlp
(python311.withPackages (lib.attrVals [ "matplotlib" "python-lsp-server" "sympy"]))
(python3.withPackages (lib.attrVals [ "matplotlib" "pyflakes" "python-lsp-server" "sympy"]))
]
++ (lib.optionals (nixosConfig.stitchyconf.form == "handheld") handheldPkgs)
++ (lib.optionals (nixosConfig.stitchyconf.form == "pc") pcPkgs);