Skip to content

Commit

Permalink
fix nvim errors by removing dap code
Browse files Browse the repository at this point in the history
  • Loading branch information
ALescoulie committed Aug 3, 2024
1 parent 8d604ac commit 7388894
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 167 deletions.
86 changes: 0 additions & 86 deletions hm/hm_modules/nvim/ide.nvim
Original file line number Diff line number Diff line change
Expand Up @@ -47,89 +47,3 @@ nmap <silent> <leader>tg :TestVisit<CR>

let maplocalleader = "\\"

" Dap settings

nnoremap <leader>ff <cmd>Telescope find_files<cr>
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
nnoremap <leader>fb <cmd>Telescope buffers<cr>
nnoremap <leader>fh <cmd>Telescope help_tags<cr>

lua << EOF
local dap_ok, dap = pcall(require, "dap")
if not (dap_ok) then
print("nvim-dap not installed!")
return
end

dap.adapters.haskell = {
type = 'executable';
command = 'haskell-debug-adapter';
args = {'--hackage-version=0.0.33.0'};
}

local workspaceFolder = vim.fn.getcwd()
dap.configurations = {
haskell = {
{
type = 'haskell';
request = 'launch';
name = "haskell-debug-adapter";
program = "${file}";
workspace = "${workspaceFolder}";
startup = "${workspaceFolder}/test/Spec.hs";
startupFunc = "";
startupArgs = "";
stopOnEntry = false;
mainArgs = "";
ghciPrompt = "H>>= ";
ghciInitialPrompt = "> ";
ghciCmd = "cabal repl --test --no-load --no-build --main-is TARGET --ghci-options -fprint-evld-with-show";
ghciEnv = {dummy=""},
logFile = "${workspaceFolder}/hda.log";
logLevel = "DEBUG";
forceInspect = false;
}
}
}


local ht = require('haskell-tools')
local def_opts = { noremap = true, silent = true, }
ht.start_or_attach {
hls = {
on_attach = function(client, bufnr)
local opts = vim.tbl_extend('keep', def_opts, { buffer = bufnr, })
-- haskell-language-server relies heavily on codeLenses,
-- so auto-refresh (see advanced configuration) is enabled by default
vim.keymap.set('n', '<space>ca', vim.lsp.codelens.run, opts)
vim.keymap.set('n', '<space>hs', ht.hoogle.hoogle_signature, opts)
vim.keymap.set('n', '<space>ea', ht.lsp.buf_eval_all, opts)
end,
},
}

-- Suggested keymaps that do not depend on haskell-language-server:
local bufnr = vim.api.nvim_get_current_buf()
-- set buffer = bufnr in ftplugin/haskell.lua
local opts = { noremap = true, silent = true, buffer = bufnr }

-- Toggle a GHCi repl for the current package
vim.keymap.set('n', '<leader>rr', ht.repl.toggle, opts)
-- Toggle a GHCi repl for the current buffer
vim.keymap.set('n', '<leader>rf', function()
ht.repl.toggle(vim.api.nvim_buf_get_name(0))
end, def_opts)
vim.keymap.set('n', '<leader>rq', ht.repl.quit, opts)

-- Detect nvim-dap launch configurations
-- (requires nvim-dap and haskell-debug-adapter)
ht.dap.discover_configurations(bufnr)

-- Adding hoogle to telescope
local telescope = require('telescope')

telescope.load_extension('hoogle')


EOF

12 changes: 0 additions & 12 deletions hm/hm_modules/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
local dap_ui_ok, ui = pcall(require, "dapui")
if not (dap_ok and dap_ui_ok) then
require("notify")("dap-ui not installed!", "warning")
return
end

dap.configurations = {
haskell = {
{
type = "haskell",
name = "Debug",
requestgt
9 changes: 7 additions & 2 deletions hm/hm_modules/nvim/init.nvim
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ autocmd BufNewFile,BufRead flake.lock set syntax=json
autocmd BufNewFile,BufRead coc-settings.json set syntax=jsonc

" Set colorscheme and transparency
colorscheme purify
let g:adwaita_dark = v:true
let g:adwaita_disable_cursorline = v:true
let g:adwaita_transparent = v:true
colorscheme adwaita

hi Normal guibg=NONE ctermbg=NONE
highlight LineNr term=bold cterm=NONE ctermfg=white ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE
highlight LineNr term=bold gui=NONE guifg=DarkViolet guibg=NONE
highlight Comment guifg=LightBlue guibg=NONE

" Indentation settings and other stuff
set autoindent smartindent ignorecase smartcase number splitbelow
Expand Down
122 changes: 55 additions & 67 deletions hm/hm_modules/nvim/nvim.nix
Original file line number Diff line number Diff line change
@@ -1,73 +1,61 @@
{ config, lib, pkgs, ... }:

let


haskellDapPlugins = with pkgs.haskellPackages; [
haskell-dap
ghci-dap
haskell-debug-adapter

];

pythonDapPlugins = [];

languageDebugPlugins =
haskellDapPlugins ++
pythonDapPlugins;
in
with lib;
{
programs.neovim = {
{
programs.neovim = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
fzf-vim
nerdtree
nerdtree-git-plugin
rainbow
vim-airline
vim-easymotion
vim-floaterm
vim-nix
vim-plug
vim-sleuth
adwaita-nvim
coc-nvim
coc-rust-analyzer
coc-tsserver
coq_nvim
editorconfig-nvim
goyo-vim
limelight-vim
nerdcommenter
taglist-vim
vim-fugitive
vim-gitgutter
vim-terraform
vim-test
vimtex
awesome-vim-colorschemes
telescope-nvim
nvim-dap
nvim-dap-ui
];

coc = {
enable = true;
defaultEditor = true;
viAlias = true;
vimAlias = true;
plugins = with pkgs.vimPlugins; [
fzf-vim
nerdtree
nerdtree-git-plugin
rainbow
vim-airline
vim-easymotion
vim-floaterm
vim-nix
vim-plug
vim-sleuth
tokyonight-nvim
coc-nvim
coc-rust-analyzer
coc-tsserver
coq_nvim
editorconfig-nvim
goyo-vim
limelight-vim
nerdcommenter
taglist-vim
vim-fugitive
vim-gitgutter
vim-terraform
vim-test
vimtex
awesome-vim-colorschemes
telescope-nvim
nvim-dap
nvim-dap-ui
] ++ languageDebugPlugins;

coc = {
enable = true;
settings = builtins.fromJSON (builtins.readFile ./coc-settings.json);
};

extraConfig = ''
source ${pkgs.vimPlugins.vim-plug}/plug.vim
${builtins.readFile ./init.nvim}
${builtins.readFile ./ide.nvim}
'';
settings = builtins.fromJSON (builtins.readFile ./coc-settings.json);
};

home.packages = with pkgs; [ nodejs nodePackages.npm fortran-language-server haskellPackages.hoogle];
}
extraConfig = ''
source ${pkgs.vimPlugins.vim-plug}/plug.vim
${builtins.readFile ./init.nvim}
${builtins.readFile ./ide.nvim}
'';
};

home.packages = with pkgs; [
nodejs
nodePackages.npm
fortran-language-server
haskellPackages.hoogle
];
}

0 comments on commit 7388894

Please sign in to comment.