diff --git a/flake.lock b/flake.lock index 71a545e..40ca3e4 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1668784520, - "narHash": "sha256-gGgVAMwYPPmrfnvnoRi6OkEB5KRsNTb9uYzEceLdO/g=", + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "6349b99bc2b96ded34d068a88c7c5ced406b7f7f", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", "type": "github" }, "original": { @@ -29,11 +29,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1670513770, - "narHash": "sha256-muL74fsbGA8K8WlZSPNWddOiuBnC54kAajncX6nXrh4=", + "lastModified": 1675935446, + "narHash": "sha256-WajulTn7QdwC7QuXRBavrANuIXE5z+08EdxdRw1qsNs=", "owner": "nix-community", "repo": "home-manager", - "rev": "054d9e3187ca00479e8036dc0e92900a384f30fd", + "rev": "2dce7f1a55e785a22d61668516df62899278c9e4", "type": "github" }, "original": { @@ -44,11 +44,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1670597555, - "narHash": "sha256-/k939P2S2246G6K5fyvC0U2IWvULhb4ZJg9K7ZxsX+k=", + "lastModified": 1675942811, + "narHash": "sha256-/v4Z9mJmADTpXrdIlAjFa1e+gkpIIROR670UVDQFwIw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2dea0f4c2d6e4603f54b2c56c22367e77869490c", + "rev": "724bfc0892363087709bd3a5a1666296759154b1", "type": "github" }, "original": { @@ -60,11 +60,11 @@ }, "nur": { "locked": { - "lastModified": 1670690902, - "narHash": "sha256-AxAy3pmT1gHAIkPrpdZLrjD32kRZYz1BTbS+RzNynbU=", + "lastModified": 1676087160, + "narHash": "sha256-el2tNbWUhpz0IBoORS144xjMTi9WIqbQWRBmrsF4M64=", "owner": "nix-community", "repo": "nur", - "rev": "9900aa788ffbb86d13e281f9df6b19d98aea5aab", + "rev": "1ddd5cf5cc7215ea63f1dee09016b53cc79034e5", "type": "github" }, "original": { diff --git a/home.nix b/home.nix index cb4f6dc..2cb8e1b 100644 --- a/home.nix +++ b/home.nix @@ -6,12 +6,12 @@ imports = (import ./programs); - nixpkgs.overlays = [ - (import ./overlays/sumneko-lua-language-server) + # nixpkgs.overlays = [ + # (import ./overlays/sumneko-lua-language-server) # (import (builtins.fetchTarball { # url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz; # })) - ]; + # ]; nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "vscode" @@ -25,7 +25,6 @@ }; packages = with pkgs; [ ( python310.withPackages (ps: with ps; [ pip flake8 black ]) ) -# adoptopenjdk-hotspot-bin-17 jdk any-nix-shell aspell @@ -55,13 +54,14 @@ maven multimarkdown mypy - ncdu + # ncdu neofetch neovim niv nix-index nixfmt nix-prefetch-git + nodejs nodePackages.pyright nodePackages.typescript-language-server nodePackages.vscode-html-languageserver-bin @@ -85,7 +85,6 @@ sqlite stylua stack - sumneko-lua-language-server tealdeer tectonic texlab @@ -121,6 +120,10 @@ }; }; + programs.gitui = { + enable = true; + }; + programs.htop = { enable = true; }; @@ -154,6 +157,19 @@ }; }; + programs.wezterm = { + enable = true; + extraConfig = '' + local wezterm = require 'wezterm' + return { + color_scheme = "tokyonight", + font = wezterm.font("JetBrains Mono"), + font_size = 16, + dpi = 144, + } + ''; + }; + programs.vscode = { enable = true; extensions = [ @@ -290,7 +306,7 @@ rmxcodederived="rm -fr ~/Library/Developer/Xcode/DerivedData"; v="nvim"; sshfre1="ssh salar@fre1.softinio.net"; - sshfre2="ssh -p 22 salar@fre2.softinio.net"; + sshfre2="ssh -p 2022 salar@fre2.softinio.net"; }; }; @@ -309,6 +325,9 @@ ''; # Neovim Configuration - xdg.configFile."nvim/lua/salargalaxyline.lua".source = programs/neovim/settings/salargalaxyline.lua; - xdg.configFile."nvim/init.lua".source = programs/neovim/init.lua; + xdg.configFile."nvim".source = builtins.fetchGit { + url = "https://git.softinio.com/softinio/nvim-config.git"; + rev = "9431d011d164289f0f16b851dd8605a0bf334c46"; + }; } + diff --git a/programs/neovim/init.lua b/programs/neovim/init.lua deleted file mode 100644 index a49de4d..0000000 --- a/programs/neovim/init.lua +++ /dev/null @@ -1,667 +0,0 @@ -local fn = vim.fn - -local install_path = fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' - -local function load_plugins() - local use = require('packer').use - require('packer').startup(function() - use 'wbthomason/packer.nvim' -- Package manager - use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client - use { 'nvim-treesitter/nvim-treesitter', run = ':TSUpdate' } - use 'nvim-treesitter/nvim-treesitter-textobjects' - use 'nvim-treesitter/playground' - use 'folke/which-key.nvim' - use 'folke/neodev.nvim' - use 'folke/tokyonight.nvim' -- Theme - use { 'folke/trouble.nvim' } - use { 'justinhj/battery.nvim', requires = 'nvim-lua/plenary.nvim'} - use { 'nvim-telescope/telescope.nvim', requires = { { 'nvim-lua/popup.nvim' }, { 'nvim-lua/plenary.nvim' } } } - use 'nvim-telescope/telescope-dap.nvim' - use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' } - use { 'softinio/scaladex.nvim' } - use 'windwp/nvim-autopairs' -- Autopairs - use 'nvim-tree/nvim-web-devicons' - use { - 'nvim-tree/nvim-tree.lua', - tag = 'nightly' -- optional, updated every week. (see issue #1193) - } - use { - 'glepnir/galaxyline.nvim', - config = function() - require 'salargalaxyline' - end, - } - use 'lukas-reineke/indent-blankline.nvim' - use { 'lewis6991/gitsigns.nvim', requires = 'nvim-lua/plenary.nvim' } - use { 'TimUntersberger/neogit', requires = { { 'nvim-lua/plenary.nvim' }, { 'sindrets/diffview.nvim' } } } - use { - 'hrsh7th/nvim-cmp', - requires = { - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-nvim-lua', - 'hrsh7th/cmp-nvim-lsp-signature-help', - 'L3MON4D3/LuaSnip', - 'saadparwaiz1/cmp_luasnip', - } - } - use {'tzachar/cmp-tabnine', run='./install.sh', requires = 'hrsh7th/nvim-cmp'} - use 'kevinhwang91/nvim-bqf' - use 'mfussenegger/nvim-dap' - use 'mfussenegger/nvim-dap-python' - use 'jbyuki/one-small-step-for-vimkind' - use {'theHamsta/nvim-dap-virtual-text'} - use 'sheerun/vim-polyglot' - use 'scalameta/nvim-metals' - use 'b3nj5m1n/kommentary' - use 'ckipp01/stylua-nvim' - use 'gennaro-tedesco/nvim-jqx' - use 'p00f/nvim-ts-rainbow' - use 'christoomey/vim-tmux-navigator' - use 'lervag/vimtex' - use { - 'f3fora/nvim-texlabconfig', - run = 'go build' - } - use { - 'phaazon/mind.nvim', - branch = 'v2.2', - requires = { 'nvim-lua/plenary.nvim' }, - config = function() - require'mind'.setup() - end - } - end) -end - -_G.load_config = function() - require('gitsigns').setup() - require('kommentary.config').use_extended_mappings() - require 'salargalaxyline' - require('trouble').setup() - require('which-key').setup() - require('indent_blankline').setup({ - indent_blankline_use_treesitter = true - }) - - -- nvim-autopairs - require('nvim-autopairs').setup() - - -- battery.nvim - local battery = require("battery") - battery.setup({ - update_rate_seconds = 30, -- Number of seconds between checking battery status - show_status_when_no_battery = true, -- Don't show any icon or text when no battery found (desktop for example) - show_plugged_icon = true, -- If true show a cable icon alongside the battery icon when plugged in - show_unplugged_icon = true, -- When true show a diconnected cable icon when not plugged in - show_percent = true, -- Whether or not to show the percent charge remaining in digits - vertical_icons = true, -- When true icons are vertical, otherwise shows horizontal battery icon - }) - - -- nvim-dap - local dap = require('dap') - dap.configurations.lua = { - { - type = 'nlua', - request = 'attach', - name = "Attach to running Neovim instance", - host = function() - local value = vim.fn.input('Host [127.0.0.1]: ') - if value ~= "" then - return value - end - return '127.0.0.1' - end, - port = function() - local val = tonumber(vim.fn.input('Port: ')) - assert(val, "Please provide a port number") - return val - end, - } - } - - dap.adapters.nlua = function(callback, config) - callback({ type = 'server', host = config.host, port = config.port or 8088 }) - end - - dap.configurations.scala = { - { - type = "scala", - request = "launch", - name = "Run", - metals = { - runType = "run", - args = { "firstArg", "secondArg", "thirdArg" }, - }, - }, - { - type = "scala", - request = "launch", - name = "Test File", - metals = { - runType = "testFile", - }, - }, - { - type = "scala", - request = "launch", - name = "Test Target", - metals = { - runType = "testTarget", - }, - }, - } - - - vim.fn.sign_define('DapBreakpoint', {text='🛑', texthl='', linehl='', numhl=''}) - vim.fn.sign_define('DapStopped', {text='⭐️', texthl='', linehl='', numhl=''}) - - require('dap-python').test_runner = 'pytest' - - -- vimtex - vim.g.vimtex_view_method = 'skim' - vim.g.vimtex_compiler_method = 'tectonic' - - -- nvim-texlabconfig - local tex_preview_executable = '/Applications/Skim.app/Contents/SharedSupport/displayline' - local tex_preview_args = {"%l", "%p", "%f"} - local texlab_build_executable = 'tectonic' - local texlab_build_args = { - '-X', - 'compile', - '%f', - '--synctex', - '--keep-logs', - '--keep-intermediates' - } - require('texlabconfig').setup { - cache_activate = true, - cache_filetypes = { 'tex', 'bib' }, - reverse_search_edit_cmd = vim.cmd.edit, - settings = { - texlab = { - build = { - executable = texlab_build_executable, - args = texlab_build_args - }, - forwardSearch = { - executable = tex_preview_executable, - args = tex_preview_args - } - } - } - } - - -- nvim-tree - vim.g.loaded_netrw = 1 - vim.g.loaded_netrwPlugin = 1 - require("nvim-tree").setup({ - sort_by = "case_sensitive", - disable_netrw = true, - view = { - adaptive_size = true, - mappings = { - list = { - { key = "u", action = "dir_up" }, - }, - }, - }, - renderer = { - highlight_git = true, - group_empty = true, - }, - filters = { - dotfiles = false, - }, - }) - - -- Treesitter - require('nvim-treesitter.configs').setup { - query_linter = { - enable = true, - use_virtual_text = true, - lint_events = { 'BufWrite', 'CursorHold' }, - }, - -- ensure_installed = 'maintained', - highlight = { enable = true }, - incremental_selection = { - enable = true, - keymaps = { - init_selection = 'gnn', - node_incremental = 'grn', - scope_incremental = 'grc', - node_decremental = 'grm', - }, - }, - indent = { - enable = true, - }, - textobjects = { - select = { - enable = true, - lookahead = true, -- Automatically jump forward to textobj, similar to targets.vim - keymaps = { - -- You can use the capture groups defined in textobjects.scm - ['af'] = '@function.outer', - ['if'] = '@function.inner', - ['ac'] = '@class.outer', - ['ic'] = '@class.inner', - }, - }, - move = { - enable = true, - set_jumps = true, -- whether to set jumps in the jumplist - goto_next_start = { - [']m'] = '@function.outer', - [']]'] = '@class.outer', - }, - goto_next_end = { - [']M'] = '@function.outer', - [']['] = '@class.outer', - }, - goto_previous_start = { - ['[m'] = '@function.outer', - ['[['] = '@class.outer', - }, - goto_previous_end = { - ['[M'] = '@function.outer', - ['[]'] = '@class.outer', - }, - }, - }, - playground = { - enable = true, - disable = {}, - updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code - persist_queries = false, -- Whether the query persists across vim sessions - keybindings = { - toggle_query_editor = 'o', - toggle_hl_groups = 'i', - toggle_injected_languages = 't', - toggle_anonymous_nodes = 'a', - toggle_language_display = 'I', - focus_language = 'f', - unfocus_language = 'F', - update = 'R', - goto_node = '', - show_help = '?', - }, - }, - rainbow = { - enable = true, - extended_mode = true, - max_file_lines = 1000, - }, - } - -- vim.opt.foldmethod = 'expr' - -- vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' - ---WORKAROUND - vim.api.nvim_create_autocmd({'BufEnter','BufAdd','BufNew','BufNewFile','BufWinEnter'}, { - group = vim.api.nvim_create_augroup('TS_FOLD_WORKAROUND', {}), - callback = function() - vim.opt.foldmethod = 'expr' - vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' - end - }) - ---ENDWORKAROUND - - -- neogit - require('neogit').setup { - integrations = { - diffview = true, - }, - } - - --Incremental live completion - vim.o.inccommand = 'nosplit' - - --Set highlight on search - vim.o.hlsearch = false - vim.o.incsearch = true - - --Make line numbers default - vim.wo.number = true - - --Do not save when switching buffers - vim.o.hidden = true - - --Enable mouse mode - vim.o.mouse = 'a' - - -- clipboard - vim.o.clipboard = 'unnamedplus' - - --Enable break indent - vim.o.breakindent = true - - --Save undo history - vim.cmd [[set undofile]] - - --Case insensitive searching UNLESS /C or capital in search - vim.o.ignorecase = true - vim.o.smartcase = true - - --Decrease update time - vim.o.updatetime = 250 - vim.wo.signcolumn = 'yes' - - --Set colorscheme (order is important here) - vim.g.tokyonight_style = 'night' - vim.g.tokyonight_italic_functions = true - vim.o.termguicolors = true - vim.cmd [[colorscheme tokyonight]] - - --Remap space as leader key - vim.api.nvim_set_keymap('', '', '', { noremap = true, silent = true }) - vim.g.mapleader = ' ' - vim.g.maplocalleader = ' ' - - --Remap for dealing with word wrap - vim.api.nvim_set_keymap('n', 'k', "v:count == 0 ? 'gk' : 'k'", { noremap = true, expr = true, silent = true }) - vim.api.nvim_set_keymap('n', 'j', "v:count == 0 ? 'gj' : 'j'", { noremap = true, expr = true, silent = true }) - - --Remap escape to leave terminal mode - vim.api.nvim_set_keymap('t', '', [[]], { noremap = true }) - - --Add map to enter paste mode - vim.o.pastetoggle = '' - - --Map blankline - vim.g.indent_blankline_char = '┊' - vim.g.indent_blankline_filetype_exclude = { 'help', 'packer' } - vim.g.indent_blankline_buftype_exclude = { 'terminal', 'nofile' } - vim.g.indent_blankline_char_highlight = 'LineNr' - - -- Toggle to disable mouse mode and indentlines for easier paste - ToggleMouse = function() - if vim.o.mouse == 'a' then - vim.cmd [[IndentBlanklineDisable]] - vim.wo.signcolumn = 'no' - vim.o.mouse = 'v' - vim.wo.number = false - print 'Mouse disabled' - else - vim.cmd [[IndentBlanklineEnable]] - vim.wo.signcolumn = 'yes' - vim.o.mouse = 'a' - vim.wo.number = true - print 'Mouse enabled' - end - end - - vim.api.nvim_set_keymap('n', '', 'lua ToggleMouse()', { noremap = true }) - - -- Telescope - require('telescope').setup { - defaults = { - mappings = { - i = { - [''] = false, - [''] = false, - }, - }, - file_ignore_patterns = { "node_modules", "target"}, - extensions = { - fzf = { - fuzzy = true, - override_generic_sorter = true, - override_file_sorter = true, - case_mode = "smart_case" - } - } - }, - } - require('telescope').load_extension('dap') - require('telescope').load_extension('fzf') - require('telescope').load_extension('scaladex') - - --Add leader shortcuts - vim.api.nvim_set_keymap('n', 'f', [[lua require('telescope.builtin').find_files()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', '', [[lua require('telescope.builtin').buffers()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'l', [[lua require('telescope.builtin').current_buffer_fuzzy_find()]], { noremap = true, silent = true }) - -- vim.api.nvim_set_keymap('n', 't', [[lua require('telescope.builtin').tags()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', '?', [[lua require('telescope.builtin').oldfiles()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'sd', [[lua require('telescope.builtin').grep_string()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'sp', [[lua require('telescope.builtin').live_grep()]], { noremap = true, silent = true }) - -- vim.api.nvim_set_keymap('n', 'o', [[lua require('telescope.builtin').tags{ only_current_buffer = true }]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'gco', [[lua require('telescope.builtin').git_commits()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'gb', [[lua require('telescope.builtin').git_branches()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'gs', [[lua require('telescope.builtin').git_status()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'gp', [[lua require('telescope.builtin').git_bcommits()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'm', [[lua require('nvim-tree').toggle()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'ng', [[lua require('neogit').open({ kind = "split" })]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'nm', [[lua require("telescope").extensions.metals.commands()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'tt', [[lua require("metals.tvp").toggle_tree_view()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'tr', [[lua require("metals.tvp").reveal_in_tree()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'ws', [[lua require"metals".worksheet_hover()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'a', [[lua RELOAD("metals").open_all_diagnostics()]], { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'nu', ':PackerUpdate', { noremap = true, silent = true }) - vim.api.nvim_set_keymap('n', 'si', [[lua require('telescope').extensions.scaladex.scaladex.search()]], { noremap = true, silent = true }) - - -- Change preview window location - vim.g.splitbelow = true - - -- Highlight on yank - vim.api.nvim_exec( - [[ - augroup YankHighlight - autocmd! - autocmd TextYankPost * silent! lua vim.highlight.on_yank() - augroup end - ]], - false - ) - - -- Y yank until the end of line - vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true }) - - -- - -- LSP settings - local nvim_lsp = require 'lspconfig' - local on_attach = function(_client, bufnr) - vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') - - local opts = { noremap = true, silent = true } - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gm', 'lua vim.lsp.buf.implementation()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'dr', [[lua require('dap').repl.toggle()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ds', [[lua require('dap').ui.variables.scopes()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'dk', [[lua require('dap').ui.widgets.hover()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'dl', [[lua require('dap').run_last()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'dz', [[lua require('dap').toggle_breakpoint()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'dc', [[lua require('dap').continue()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', [[lua require('dap').step_over()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', [[lua require('dap').step_out()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', '', [[lua require('dap').step_into()]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'B', [[lua require('dap').set_breakpoint(vim.fn.input('Breakpoint condition: '))]], { noremap = true, silent = true }) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'lp', [[lua require('dap').set_breakpoint(nil, nil, vim.fn.input('Log point message: '))]], { noremap = true, silent = true }) - end - - -- Enable the following language servers - local servers = { 'hls', 'html', 'jdtls', 'jsonls', 'pyright', 'rnix', 'rust_analyzer','sourcekit', 'tsserver', 'yamlls' } - for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { on_attach = on_attach } - end - - -- lua language server - local sumneko_binary = vim.fn.getenv 'HOME' .. '/.nix-profile/bin/lua-language-server' - local runtime_path = vim.split(package.path, ';') - table.insert(runtime_path, 'lua/?.lua') - table.insert(runtime_path, 'lua/?/init.lua') - - require("neodev").setup({ - override = function(root_dir, library) - if require("neodev.util").has_file(root_dir, "/etc/nixos") then - library.enabled = true - library.plugins = true - end - end, - }) - - nvim_lsp.sumneko_lua.setup({ - settings = { - Lua = { - completion = { - callSnippet = "Replace" - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = {'vim'} - }, - } - } - }) - - -- metals - vim.g.metals_server_version = '0.11.9' - local metals_config = require('metals').bare_config() - metals_config.settings = { - showImplicitArguments = true, - showInferredType = true, - bloopSbtAlreadyInstalled = false, - excludedPackages = { - "akka.actor.typed.javadsl", - "com.github.swagger.akka.javadsl", - "akka.stream.javadsl", - }, - fallbackScalaVersion = "2.13.8", - superMethodLensesEnabled = true, - javaHome = "/Users/salar/.nix-profile" - } - metals_config.init_options.statusBarProvider = 'on' - metals_config.on_attach = function(client, bufnr) - vim.cmd([[autocmd CursorHold lua vim.lsp.buf.document_highlight()]]) - vim.cmd([[autocmd CursorMoved lua vim.lsp.buf.clear_references()]]) - vim.cmd([[autocmd BufEnter,CursorHold,InsertLeave lua vim.lsp.codelens.refresh()]]) - - require("metals").setup_dap() - end - metals_config.init_options.statusBarProvider = "on" - local capabilities = vim.lsp.protocol.make_client_capabilities() - metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities(capabilities) - local nvim_metals_group = vim.api.nvim_create_augroup("nvim-metals", { clear = true }) - vim.api.nvim_create_autocmd("FileType", { - pattern = { "scala", "sbt" }, - callback = function() - require("metals").initialize_or_attach(metals_config) - end, - group = nvim_metals_group, - }) - - -- Map :Format to vim.lsp.buf.formatting() - vim.cmd [[ command! Format execute 'lua vim.lsp.buf.formatting()' ]] - - -- Set completeopt to have a better completion experience - vim.o.completeopt = 'menuone,noinsert' - - -- nvim-cmp - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local cmp = require("cmp") - cmp.setup { - snippet = { - expand = function(args) - require('luasnip').lsp_expand(args.body) - end, - }, - sources = { - { name = "nvim_lsp", priority = 10 }, - { name = "buffer" }, - { name = "luasnip" }, - { name = "cmp_tabnine" }, - { name = "path" }, - { name = 'nvim_lua' }, - { name = 'nvim_lsp_signature_help' } - }, - mapping = cmp.mapping.preset.insert({ - -- None of this made sense to me when first looking into this since there - -- is no vim docs, but you can't have select = true here _unless_ you are - -- also using the snippet stuff. So keep in mind that if you remove - -- snippets you need to remove this select - [""] = cmp.mapping.confirm({ select = true }), - -- I use tabs... some say you should stick to ins-completion but this is just here as an example - [""] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - [""] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, - }), - } - cmp.event:on( - 'confirm_done', - cmp_autopairs.on_confirm_done() - ) --- - - local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) - end - - local check_back_space = function() - local col = vim.fn.col '.' - 1 - if col == 0 or vim.fn.getline('.'):sub(col, col):match '%s' then - return true - else - return false - end - end - - -- Use (s-)tab to: - --- move to prev/next item in completion menuone - --- jump to prev/next snippet's placeholder - _G.tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t '' - elseif check_back_space() then - return t '' - else - return vim.fn['cmp#complete']() - end - end - _G.s_tab_complete = function() - if vim.fn.pumvisible() == 1 then - return t '' - else - return t '' - end - end - - vim.api.nvim_set_keymap('i', '', 'v:lua.tab_complete()', { expr = true }) - vim.api.nvim_set_keymap('s', '', 'v:lua.tab_complete()', { expr = true }) - vim.api.nvim_set_keymap('i', '', 'v:lua.s_tab_complete()', { expr = true }) - vim.api.nvim_set_keymap('s', '', 'v:lua.s_tab_complete()', { expr = true }) -end - -if fn.isdirectory(install_path) == 0 then - fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path } - load_plugins() - require('packer').sync() - vim.cmd 'autocmd User PackerComplete ++once lua load_config()' -else - load_plugins() - _G.load_config() -end diff --git a/programs/neovim/settings/salargalaxyline.lua b/programs/neovim/settings/salargalaxyline.lua deleted file mode 100644 index 8e678d7..0000000 --- a/programs/neovim/settings/salargalaxyline.lua +++ /dev/null @@ -1,198 +0,0 @@ -local gl = require 'galaxyline' -local gls = gl.section -gl.short_line_list = { 'LuaTree', 'vista', 'dbui' } - -local colors = { - bg = '#282c34', - yellow = '#fabd2f', - cyan = '#008080', - darkblue = '#081633', - green = '#afd700', - orange = '#FF8800', - purple = '#5d4d7a', - magenta = '#d16d9e', - grey = '#c0c0c0', - blue = '#0087d7', - red = '#ec5f67', -} - -local buffer_not_empty = function() - if vim.fn.empty(vim.fn.expand '%:t') ~= 1 then - return true - end - return false -end - -gls.left[1] = { - FirstElement = { - provider = function() - return '▋' - end, - highlight = { colors.blue, colors.yellow }, - }, -} -gls.left[2] = { - ViMode = { - provider = function() - local alias = { n = 'NORMAL', i = 'INSERT', c = 'COMMAND', v = 'VISUAL', V = 'VISUAL LINE', [''] = 'VISUAL BLOCK' } - return alias[vim.fn.mode()] - end, - separator = '', - separator_highlight = { - colors.purple, - function() - if not buffer_not_empty() then - return colors.purple - end - return colors.darkblue - end, - }, - highlight = { colors.darkblue, colors.purple, 'bold' }, - }, -} -gls.left[3] = { - FileIcon = { - provider = 'FileIcon', - condition = buffer_not_empty, - highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.darkblue }, - }, -} -gls.left[4] = { - FileName = { - provider = { 'FileName', 'FileSize' }, - condition = buffer_not_empty, - separator = '', - separator_highlight = { colors.purple, colors.darkblue }, - highlight = { colors.magenta, colors.darkblue }, - }, -} - -gls.left[5] = { - GitIcon = { - provider = function() - return '  ' - end, - condition = buffer_not_empty, - highlight = { colors.orange, colors.purple }, - }, -} -gls.left[6] = { - GitBranch = { - provider = 'GitBranch', - condition = buffer_not_empty, - highlight = { colors.grey, colors.purple }, - }, -} - -local checkwidth = function() - local squeeze_width = vim.fn.winwidth(0) / 2 - if squeeze_width > 40 then - return true - end - return false -end - -gls.left[7] = { - DiffAdd = { - provider = 'DiffAdd', - condition = checkwidth, - icon = ' ', - highlight = { colors.green, colors.purple }, - }, -} -gls.left[8] = { - DiffModified = { - provider = 'DiffModified', - condition = checkwidth, - icon = ' ', - highlight = { colors.orange, colors.purple }, - }, -} -gls.left[9] = { - DiffRemove = { - provider = 'DiffRemove', - condition = checkwidth, - icon = ' ', - highlight = { colors.red, colors.purple }, - }, -} -gls.left[10] = { - LeftEnd = { - provider = function() - return '' - end, - separator = '', - separator_highlight = { colors.purple, colors.bg }, - highlight = { colors.purple, colors.purple }, - }, -} -gls.left[11] = { - DiagnosticError = { - provider = 'DiagnosticError', - icon = '  ', - highlight = { colors.red, colors.bg }, - }, -} -gls.left[12] = { - Space = { - provider = function() - return ' ' - end, - }, -} -gls.left[13] = { - DiagnosticWarn = { - provider = 'DiagnosticWarn', - icon = '  ', - highlight = { colors.blue, colors.bg }, - }, -} -gls.right[1] = { - FileFormat = { - provider = 'FileFormat', - separator = '', - separator_highlight = { colors.bg, colors.purple }, - highlight = { colors.grey, colors.purple }, - }, -} -gls.right[2] = { - LineInfo = { - provider = 'LineColumn', - separator = ' | ', - separator_highlight = { colors.darkblue, colors.purple }, - highlight = { colors.grey, colors.purple }, - }, -} -gls.right[3] = { - PerCent = { - provider = 'LinePercent', - separator = '', - separator_highlight = { colors.darkblue, colors.purple }, - highlight = { colors.grey, colors.darkblue }, - }, -} -gls.right[4] = { - ScrollBar = { - provider = 'ScrollBar', - separator_highlight = { colors.purple, colors.bg }, - highlight = { colors.yellow, colors.purple }, - }, -} - -gls.short_line_left[1] = { - BufferType = { - provider = 'FileTypeName', - separator = '', - separator_highlight = { colors.purple, colors.bg }, - highlight = { colors.grey, colors.purple }, - }, -} - -gls.short_line_right[1] = { - BufferIcon = { - provider = 'BufferIcon', - separator = '', - separator_highlight = { colors.purple, colors.bg }, - highlight = { colors.grey, colors.purple }, - }, -}