diff options
| author | Mike Vink <mike1994vink@gmail.com> | 2022-11-15 00:06:26 +0100 |
|---|---|---|
| committer | Mike Vink <mike1994vink@gmail.com> | 2022-11-15 00:06:26 +0100 |
| commit | e4feed89e6f15bcaaa6cefc8ca79d482accbb300 (patch) | |
| tree | 51ee177cd34619e9cf84676582a3e15c99ff0eb3 | |
| parent | 70f3bc54f2ba254645b0f7d4676443e034456d7a (diff) | |
fixmeuplater
| -rw-r--r-- | flake.nix | 39 | ||||
| -rw-r--r-- | home.nix | 39 | ||||
| -rw-r--r-- | neovim/init.lua | 5 | ||||
| -rw-r--r-- | neovim/lua/vimrc/dap.lua | 60 | ||||
| -rw-r--r-- | neovim/lua/vimrc/lsp.lua | 3 |
5 files changed, 58 insertions, 88 deletions
@@ -43,29 +43,32 @@ }; }) - # fetchPluginFromGit = name: rev: pkgs.vimUtils.buildVimPluginFrom2Nix { - # name = name; - # src = builtins.fetchGit { - # url = "https://github.com/${name}"; - # submodules = true; - # inherit rev; - # }; - # }; - - # (fetchPluginFromGit "klen/nvim-test" "32f162c27045fc712664b9ddbd33d3c550cb2bfc") - + # overlay some vim plugins (final: prev: { - vimPlugins = - prev.vimPlugins - // { - firvish-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { - name = "firvish-nvim"; + vimPlugins = let + getVimPlugin = { + name, + git, + rev, + ref ? "master", + }: + pkgs.vimUtils.buildVimPluginFrom2Nix { + inherit name; src = builtins.fetchGit { - url = "https://github.com/Furkanzmc/firvish.nvim"; + url = "https://github.com/${git}"; submodules = true; - rev = "127f9146175d6bbaff6a8b761081cfd2279f8351"; + inherit rev; + inherit ref; }; }; + in + prev.vimPlugins + // { + firvish-nvim = getVimPlugin { + name = "firvish-nvim"; + git = "Furkanzmc/firvish.nvim"; + rev = "127f9146175d6bbaff6a8b761081cfd2279f8351"; + }; }; }) ]; @@ -35,7 +35,7 @@ userName = "Mike Vink"; userEmail = "mike1994vink@gmail.com"; }; - + programs.alacritty = { enable = true; settings = { @@ -49,22 +49,27 @@ }; }; - wayland.windowManager.sway = { + xsession = { enable = true; - wrapperFeatures.gtk = true; - config = rec { - terminal = "alacritty"; - menu = "wofi --show run"; - modifier = "Mod4"; - bars = [ - { - fonts.size = 15.0; - position = "bottom"; - } - ]; - startup = [ - {command = "firefox";} - ]; + windowManager.spectrwm = { + enable = true; + programs = { + term = "alacritty"; + search = "dmenu -ip -p 'Window name/id:'"; + browser = "firefox"; + }; + bindings = { + browser = "Mod+w"; + term = "Mod+Return"; + restart = "Mod+Shift+r"; + quit = "Mod+Shift+q"; + }; + settings = { + modkey = "Mod4"; + workspace_limit = 5; + focus_mode = "manual"; + focus_close = "next"; + }; }; }; @@ -85,6 +90,7 @@ lua <<LUA Flake = { lua_language_server = [[${pkgs.sumneko-lua-language-server}]], + bash = [[${pkgs.bashInteractive}/bin/bash]] } vim.opt.runtimepath:append({ [[${flake}/neovim]], [[${flake}/neovim/lua]] }) vim.cmd [[luafile ${flake}/neovim/init.lua]] @@ -115,6 +121,7 @@ LUA plenary-nvim nlua-nvim lsp_signature-nvim + vim-test # cmp nvim-cmp diff --git a/neovim/init.lua b/neovim/init.lua index c3294ed..b51f723 100644 --- a/neovim/init.lua +++ b/neovim/init.lua @@ -97,8 +97,12 @@ vim.opt.shortmess:append("c") -- load global and utility functions +vim.api.nvim_set_keymap("n", "g<space>", ":TestNearest<cr>", {}) +-- TODO: debug test +-- vim.api.nvim_set_keymap("n", "g<cr>", ":TestNearest<cr>", {}) vim.g.mapleader = " " vim.g.maplocalleader = " " +vim.o.shell = Flake.bash local vimrc = require('vimrc') -- save session file in cwd vimrc.cwd_save_session() @@ -233,6 +237,7 @@ vim.cmd [[augroup END]] -- }}} -- dap {{{ +require('vimrc.dap').setup_dap() vim.cmd [[augroup vimrc_nvim_dap_setup]] vim.cmd [[au!]] vim.cmd [[au VimEnter * lua require('vimrc.dap').setup_dap()]] diff --git a/neovim/lua/vimrc/dap.lua b/neovim/lua/vimrc/dap.lua index 313e043..c55b3cb 100644 --- a/neovim/lua/vimrc/dap.lua +++ b/neovim/lua/vimrc/dap.lua @@ -5,21 +5,10 @@ local M = {} local function register_debug_adapters(cwd) local dap = require 'dap' - local python_args = { - "run", - "--rm", - "--volume=/var/run/docker.sock:/var/run/docker.sock", - "--interactive", - "--env-file=" .. cwd .. "/.env", - "--volume", cwd .. ":" .. cwd, - "--network=host", - "mvinkio/python", - "python", "-m", "debugpy.adapter" - } dap.adapters.python = { type = 'executable', - command = "docker", - args = python_args, + command = "python", + args = { "-m", "debugpy.adapter" } } dap.adapters.go = function(callback, _) @@ -30,20 +19,6 @@ local function register_debug_adapters(cwd) local pid_or_err local port = 38697 - -- "docker", - -- "run", - -- "--rm", - -- "--interactive", - -- "-e=GOPROXY=https://proxy.golang.org", - -- "-e=GOOS=linux", - -- "-e=GOARCH=amd64", - -- "-e=GOPATH=" .. new_root_dir .. "/go", - -- "-e=GOCACHE=" .. new_root_dir .. "/.cache/go-build", - -- "--workdir=" .. new_root_dir, - -- "--volume=" .. new_root_dir .. ":" .. new_root_dir, - -- "--network=bridge", - -- "mvinkio/go", - -- "gopls" local opts = { stdio = { nil, stdout }, args = { "run", @@ -104,33 +79,13 @@ local function set_configurations() local dap = require 'dap' dap.configurations.python = { { - -- The first three options are required by nvim-dap - type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python` + type = 'python'; request = 'launch'; name = "Launch file"; - - -- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options - - program = "${file}"; -- This configuration will launch the current file if used. - -- TODO: use container for python interpreter - -- pythonPath = function() - -- -- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself. - -- -- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within. - -- -- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable. - -- local cwd = vim.fn.getcwd() - -- if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then - -- return cwd .. '/venv/bin/python' - -- elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then - -- return cwd .. '/.venv/bin/python' - -- else - -- return '/usr/bin/python' - -- end - -- end; + program = "${file}"; }, } - -- docker run --rm -i -v /home/mike:/home/mike --network=host -w /home/mike/projects/example/hello mvinkio/godap dap -l 127.0.0.1:38697 --log --log-output="dap" --only-same-user=false - dap.configurations.go = { { type = "go", @@ -143,9 +98,8 @@ local function set_configurations() name = "Debug test", -- configuration for debugging test files request = "launch", mode = "test", - program = vim.fn.fnamemodify(vim.fn.expand('%'),':p:h') + program = vim.fn.fnamemodify(vim.fn.expand('%'), ':p:h') }, - -- works with go.mod packages and sub packages { type = "go", name = "Debug test (go.mod)", @@ -154,6 +108,7 @@ local function set_configurations() program = "./${relativeFileDirname}" } } + local set_go_keymaps = function() vim.keymap.set( "n", @@ -245,9 +200,6 @@ function M.setup_dap() return end - cmd([[packadd nvim-dap]]) - cmd([[packadd nvim-dap-ui]]) - local vim_startup_dir = vim.fn.getcwd() register_debug_adapters(vim_startup_dir) set_configurations() diff --git a/neovim/lua/vimrc/lsp.lua b/neovim/lua/vimrc/lsp.lua index 8b23fc6..b930bfa 100644 --- a/neovim/lua/vimrc/lsp.lua +++ b/neovim/lua/vimrc/lsp.lua @@ -201,7 +201,10 @@ function M.setup() -- nix linter: statix null_ls.builtins.code_actions.statix, null_ls.builtins.diagnostics.statix, + -- nix formatter: alejandra null_ls.builtins.formatting.alejandra, + -- python formatter: black + null_ls.builtins.formatting.black, } }) end |
