NVIM: Added Code formatting for python
This commit is contained in:
		
							parent
							
								
									4d66a5e231
								
							
						
					
					
						commit
						3ec1ba5f9b
					
				
					 4 changed files with 29 additions and 10 deletions
				
			
		| 
						 | 
					@ -3,6 +3,7 @@ local map = vim.keymap.set
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- jk exit from insert mode
 | 
					-- jk exit from insert mode
 | 
				
			||||||
map("i", "jk", "<cmd>noh<cr><Esc>", { silent = true })
 | 
					map("i", "jk", "<cmd>noh<cr><Esc>", { silent = true })
 | 
				
			||||||
 | 
					map({"n", "x"}, "<Esc>", "<cmd>noh<cr><Esc>", { silent = true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
-- Movements
 | 
					-- Movements
 | 
				
			||||||
| 
						 | 
					@ -33,6 +34,8 @@ map("n", "<leader>>", "<cmd>BufferLineMoveNext<CR>", { desc = "Move buffer right
 | 
				
			||||||
-- ToggleTerm Bindings
 | 
					-- ToggleTerm Bindings
 | 
				
			||||||
map("n", "<leader>a", "<cmd>ToggleTerm name=main<CR>", { desc = "Floating Terminal", silent = true })
 | 
					map("n", "<leader>a", "<cmd>ToggleTerm name=main<CR>", { desc = "Floating Terminal", silent = true })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- Undotree
 | 
				
			||||||
 | 
					map('n', '<leader>fu', vim.cmd.UndotreeToggle)
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
-- Cool Macros
 | 
					-- Cool Macros
 | 
				
			||||||
----
 | 
					----
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,17 +6,17 @@ require'lspconfig'.texlab.setup{}
 | 
				
			||||||
require'lspconfig'.svls.setup{}
 | 
					require'lspconfig'.svls.setup{}
 | 
				
			||||||
require'lspconfig'.pylsp.setup{
 | 
					require'lspconfig'.pylsp.setup{
 | 
				
			||||||
  settings = {
 | 
					  settings = {
 | 
				
			||||||
 | 
					    formatCommand = {"black"},
 | 
				
			||||||
    pylsp = {
 | 
					    pylsp = {
 | 
				
			||||||
      plugins = {
 | 
					      plugins = {
 | 
				
			||||||
        pycodestyle = {
 | 
					        jedai_completion = {
 | 
				
			||||||
          ignore = {'W391'},
 | 
					          fuzzy = true
 | 
				
			||||||
          maxLineLength = 100
 | 
					 | 
				
			||||||
        },
 | 
					 | 
				
			||||||
  pylint = {
 | 
					 | 
				
			||||||
    enabled = false
 | 
					 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
        pyflakes = {
 | 
					        pyflakes = {
 | 
				
			||||||
          enabled = true
 | 
					          enabled = true
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        pylsp_mypy = {
 | 
				
			||||||
 | 
					          enabled = true
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -105,6 +105,15 @@ cmp.setup {
 | 
				
			||||||
package.path = package.path .. ";/etc/nixos/config/nvim"
 | 
					package.path = package.path .. ";/etc/nixos/config/nvim"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- Funky plugins
 | 
					-- Funky plugins
 | 
				
			||||||
 | 
					require("conform").setup({
 | 
				
			||||||
 | 
					  formatters_by_ft = {
 | 
				
			||||||
 | 
					    python = { "isort", "black" },
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					  format_on_save = {
 | 
				
			||||||
 | 
					    timeout_ms = 500,
 | 
				
			||||||
 | 
					    lsp_format = "fallback",
 | 
				
			||||||
 | 
					  },
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
require("bufferline").setup({ options = {
 | 
					require("bufferline").setup({ options = {
 | 
				
			||||||
  always_show_bufferline = true,
 | 
					  always_show_bufferline = true,
 | 
				
			||||||
  show_buffer_close_icons = false,
 | 
					  show_buffer_close_icons = false,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -64,13 +64,17 @@ in
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  config = {
 | 
					  config = {
 | 
				
			||||||
    environment.systemPackages = (lib.attrVals [
 | 
					    environment.systemPackages = (lib.attrVals [
 | 
				
			||||||
 | 
					      "black"
 | 
				
			||||||
      "btop"
 | 
					      "btop"
 | 
				
			||||||
 | 
					      "ccls"
 | 
				
			||||||
      "eza"
 | 
					      "eza"
 | 
				
			||||||
      "fd"
 | 
					      "fd"
 | 
				
			||||||
 | 
					      "fzf"
 | 
				
			||||||
      "git"
 | 
					      "git"
 | 
				
			||||||
      "glib"
 | 
					      "glib"
 | 
				
			||||||
      "gnumake"
 | 
					      "gnumake"
 | 
				
			||||||
      "gnupg"
 | 
					      "gnupg"
 | 
				
			||||||
 | 
					      "mypy"
 | 
				
			||||||
      "neofetch"
 | 
					      "neofetch"
 | 
				
			||||||
      "p7zip"
 | 
					      "p7zip"
 | 
				
			||||||
      "pinentry"
 | 
					      "pinentry"
 | 
				
			||||||
| 
						 | 
					@ -97,6 +101,7 @@ in
 | 
				
			||||||
          customRC = builtins.readFile ../config/nvim/init.vim;
 | 
					          customRC = builtins.readFile ../config/nvim/init.vim;
 | 
				
			||||||
          packages.myVimPackage = with pkgs.vimPlugins; {
 | 
					          packages.myVimPackage = with pkgs.vimPlugins; {
 | 
				
			||||||
            start = [
 | 
					            start = [
 | 
				
			||||||
 | 
					              conform-nvim
 | 
				
			||||||
              bufferline-nvim
 | 
					              bufferline-nvim
 | 
				
			||||||
              cmp-nvim-lsp
 | 
					              cmp-nvim-lsp
 | 
				
			||||||
              cmp_luasnip
 | 
					              cmp_luasnip
 | 
				
			||||||
| 
						 | 
					@ -113,6 +118,7 @@ in
 | 
				
			||||||
              toggleterm-nvim
 | 
					              toggleterm-nvim
 | 
				
			||||||
              tokyonight-nvim
 | 
					              tokyonight-nvim
 | 
				
			||||||
              typst-vim
 | 
					              typst-vim
 | 
				
			||||||
 | 
					              undotree
 | 
				
			||||||
              vim-lsp-cxx-highlight
 | 
					              vim-lsp-cxx-highlight
 | 
				
			||||||
              which-key-nvim
 | 
					              which-key-nvim
 | 
				
			||||||
            ];
 | 
					            ];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -60,9 +60,10 @@ in
 | 
				
			||||||
      kicad
 | 
					      kicad
 | 
				
			||||||
      #steamvr?
 | 
					      #steamvr?
 | 
				
			||||||
      procps
 | 
					      procps
 | 
				
			||||||
 | 
					      ripgrep
 | 
				
			||||||
      usbutils
 | 
					      usbutils
 | 
				
			||||||
      yt-dlp
 | 
					      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 == "handheld") handheldPkgs)
 | 
				
			||||||
    ++ (lib.optionals (nixosConfig.stitchyconf.form == "pc") pcPkgs);
 | 
					    ++ (lib.optionals (nixosConfig.stitchyconf.form == "pc") pcPkgs);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue