diff --git a/bin/install.ps1 b/bin/install.ps1 index ab80d3a..3311c6d 100644 --- a/bin/install.ps1 +++ b/bin/install.ps1 @@ -52,9 +52,8 @@ scoop import .\bin\windows\scoop_apps\scoop_minimal_apps.json # make symbolic links # neovim New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\init.lua -Target (Resolve-Path .\dotfiles\neovim\init.lua) -Force -New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\plugins.lua -Target (Resolve-Path .\dotfiles\neovim\lua\plugins.lua) -Force New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lualine_setup.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lualine_setup.lua) -Force -New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lsp_client_config.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lsp_client_config.lua) -Force +New-Item -ItemType SymbolicLink -Path ~\AppData\Local\nvim\lua\lspconfig\server_configurations\satysfi_ls.lua -Target (Resolve-Path .\dotfiles\neovim\lua\lspconfig\server_configurations\satysfi_ls.lua) -Force # pwsh New-Item -ItemType SymbolicLink -Path $PROFILE -Target (Resolve-Path .\dotfiles\pwsh\powershell_profile.ps1) -Force New-Item -ItemType SymbolicLink -Path ~\.config\powershell\chezmoi_completion.ps1 -Target (Resolve-Path .\dotfiles\pwsh\chezmoi_completion.ps1) -Force diff --git a/bin/install.sh b/bin/install.sh index 792fc31..3b2c009 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -22,6 +22,15 @@ ln -sf $(pwd)/dotfiles/tmux.conf ~/.tmux.conf mkdir -p ~/.config/nvim ln -sf $(pwd)/dotfiles/neovim/init.lua ~/.config/nvim/init.lua mkdir -p ~/.config/nvim/lua -ln -sf $(pwd)/dotfiles/neovim/lua/plugins.lua ~/.config/nvim/lua/plugins.lua ln -sf $(pwd)/dotfiles/neovim/lua/lualine_setup.lua ~/.config/nvim/lua/lualine_setup.lua +mkdir -p ~/.config/nvim/lua/lspconfig/server_configurations +ln -sf $(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua ~/.config/nvim/lua/lspconfig/server_configurations/satysfi_ls.lua +ln -sf $(pwd)/dotfiles/neovim/lua/lspconfig/server_configurations/jetls.lua ~/.config/nvim/lua/lspconfig/server_configurations/jetls.lua +mkdir -p ~/.config/nvim/after/ftplugin +ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/satysfi.lua ~/.config/nvim/after/ftplugin/satysfi.lua +ln -sf $(pwd)/dotfiles/neovim/after/ftplugin/tex.lua ~/.config/nvim/after/ftplugin/tex.lua +mkdir -p ~/.config/nvim/after/queries/satysfi +curl -o ~/.config/nvim/after/queries/satysfi/highlights.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/highlights.scm +curl -o ~/.config/nvim/after/queries/satysfi/indents.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/indents.scm +curl -o ~/.config/nvim/after/queries/satysfi/matchup.scm https://raw.githubusercontent.com/monaqa/tree-sitter-satysfi/master/queries/matchup.scm diff --git a/dotfiles/neovim/after/ftplugin/satysfi.lua b/dotfiles/neovim/after/ftplugin/satysfi.lua new file mode 100644 index 0000000..0a35a06 --- /dev/null +++ b/dotfiles/neovim/after/ftplugin/satysfi.lua @@ -0,0 +1,7 @@ +-- filetype plugin for satysfi +-- loaded after + +-- tab +vim.o.tabstop = 2 +vim.o.shiftwidth = 2 + diff --git a/dotfiles/neovim/after/ftplugin/tex.lua b/dotfiles/neovim/after/ftplugin/tex.lua new file mode 100644 index 0000000..5f56977 --- /dev/null +++ b/dotfiles/neovim/after/ftplugin/tex.lua @@ -0,0 +1,23 @@ +-- restore completion order of nvim-cmp +-- source from `:help vimtex-complete-nvim-cmp` +local cmp = require'cmp' +cmp.setup.buffer { + formatting = { + format = function(entry, vim_item) + vim_item.menu = ({ + omni = (vim.inspect(vim_item.menu):gsub('%"', "")), + buffer = "[Buffer]", + -- formatting for other sources + })[entry.source.name] + return vim_item + end, + }, + sources = cmp.config.sources{ + { name = 'omni' }, + { name = 'buffer' }, + -- { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { name = 'path' }, + }, +} diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 29f6a90..7d140a3 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -1,4 +1,133 @@ ---print("init.lua loaded") +----------------------------------------------------------- +-- Installing plugin manager 'lazy.nvim' +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) +end +vim.opt.rtp:prepend(lazypath) + +-- Installing plugins +require('lazy').setup({ + { "catppuccin/nvim", name = "catppuccin" }, -- Color scheme + { + 'folke/which-key.nvim', + config = function() + vim.o.timeout = true + vim.o.timeoutlen = 300 + require('which-key').setup { + + } + end, + }, + { 'RRethy/vim-illuminate', }, -- highlight keywords under cursor + { -- comment + 'numToStr/Comment.nvim', + config = function () + require('Comment').setup() + end, + }, + { -- auto pair + 'windwp/nvim-autopairs', + config = function() + require('nvim-autopairs').setup { + check_ts = true, -- use treesitter + } + end, + event = "InsertEnter", + }, + { -- lualine(statusline) + 'nvim-lualine/lualine.nvim', + dependencies = { 'kyazdani42/nvim-web-devicons', lazy = true } + }, + { + 'lervag/vimtex', + ft = { 'tex', 'latex' }, + }, + { + -- 'kdheepak/JET.nvim', + 'qwjyh/JET.nvim', + dir = '~/work/julia/JET.nvim', + dev = false, -- set true to use dir + lazy = true, + dependencies = { + 'jose-elias-alvarez/null-ls.nvim', + }, + config = function() + require("jet").setup { + timeout = 15000, + -- disable setup since null-ls doesn't support lspconfig + -- https://github.com/jose-elias-alvarez/null-ls.nvim/commit/656e5cb554fed1eb2f398f325511601fab988ce0 + setup_lspconfig = false, + debug = true, + } + end, + -- build process(make environments and add JET.jl) + build = [[mkdir -p ~/.julia/environments/nvim-null-ls && julia --startup-file=no --project=~/.julia/environments/nvim-null-ls -e 'using Pkg; Pkg.add("JET")']], + -- ft = { 'julia', }, + }, + { + 'hkupty/iron.nvim', + ft = { 'julia', 'python', 'ruby', }, + }, + { 'lewis6991/gitsigns.nvim', }, + 'neovim/nvim-lspconfig', + { + 'hrsh7th/nvim-cmp', + event = "InsertEnter", + dependencies = { + 'hrsh7th/cmp-nvim-lsp', -- LSP + 'L3MON4D3/LuaSnip', -- snippets + 'saadparwaiz1/cmp_luasnip', -- nvim-cmp source for LuaSnip + 'hrsh7th/cmp-buffer', -- nvim-cmp source for buffer words + 'hrsh7th/cmp-path', -- nvim-cmp source for filesystem paths + 'hrsh7th/cmp-cmdline', -- command line + 'hrsh7th/cmp-omni', -- source for omnifunc + 'hrsh7th/cmp-nvim-lua', -- nvim lua + }, + }, + { + 'kdheepak/cmp-latex-symbols', -- latex math + ft = { 'julia', }, + }, + { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + dependencies = { + "nvim-treesitter/nvim-treesitter-textobjects", + }, + }, + { + 'nvim-telescope/telescope.nvim', + dependencies = { + 'nvim-lua/plenary.nvim' + }, + }, + { + 'folke/trouble.nvim', + -- config = function + }, +}) + +----------------------------------------------------------- +-- Adding filetype 'satysfi' +vim.filetype.add { + extension = { + saty = 'satysfi', + satyh = 'satysfi', + satyg = 'satysfi', + }, + pattern = { + ['.*%.satyh%-%a+'] = 'satysfi', + }, +} + ----------------------------------------------------------- -- basic configurations vim.o.number = true @@ -19,8 +148,26 @@ highlight cursorcolumn ctermbg=235 ]]) vim.o.mouse = 'a' vim.o.signcolumn = 'yes' -vim.o.ignorecase = true +vim.o.ignorecase = true -- keep signcolumn on vim.o.smartcase = true +vim.o.errorbells = true +-- vim.o.visualbell = false -- this is default +vim.opt.undofile = true -- Save undo history +vim.o.completeopt = 'menuone,noselect' -- for better completion experience +vim.o.termguicolors = true + +-- color scheme +require('catppuccin').setup({ + transparent_background = true, +}) +vim.cmd.colorscheme "catppuccin" + +----------------------------------------------------------- +-- some terminalmode settings +vim.keymap.set('t', 'h', 'h', { noremap = true, desc = "Exit terminal-mode and move to left window."}) +vim.keymap.set('t', 'j', 'j', { noremap = true, desc = "Exit terminal-mode and move to down window."}) +vim.keymap.set('t', 'k', 'k', { noremap = true, desc = "Exit terminal-mode and move to up window."}) +vim.keymap.set('t', 'l', 'l', { noremap = true, desc = "Exit terminal-mode and move to right window."}) ----------------------------------------------------------- -- to use PowerShell on Windows @@ -28,130 +175,354 @@ vim.o.smartcase = true -- vim script func returns 1/0, while lua evals false only if gets false or nil -- so be sure to compare with 1/0 if vim.fn.has('win32') == 1 then - if vim.fn.executable('pwsh') == 1 then - vim.opt.shell = 'pwsh' - else - vim.opt.shell = 'powershell' - end - vim.opt.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;' - vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait' - vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' - vim.opt.shellquote = '' - vim.opt.shellxquote = '' + if vim.fn.executable('pwsh') == 1 then + vim.opt.shell = 'pwsh' + else + vim.opt.shell = 'powershell' + end + vim.opt.shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;' + vim.opt.shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait' + vim.opt.shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode' + vim.opt.shellquote = '' + vim.opt.shellxquote = '' end +----------------------------------------------------------- +-- comment setting for satysfi +local ft = require('Comment.ft') +ft.set('satysfi', '%%s') ----------------------------------------------------------- --- Plugins -require 'plugins' -vim.cmd [[autocmd BufWritePost plugins.lua PackerCompile]] - - --- LSP --- https://zenn.dev/botamotch/articles/21073d78bc68bf --- 1. LSP Sever management ---require('mason').setup() ---require('mason-lspconfig').setup_handlers({ function(server) --- local opt = { --- -- -- Function executed when the LSP server startup --- -- on_attach = function(client, bufnr) --- -- local opts = { noremap=true, silent=true } --- -- vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) --- -- vim.cmd 'autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 1000)' --- -- end, --- capabilities = require('cmp_nvim_lsp').update_capabilities( --- vim.lsp.protocol.make_client_capabilities() --- ) --- } --- require('lspconfig')[server].setup(opt) ---end }) --- ----- 2. build-in LSP function ----- keyboard shortcut ---vim.keymap.set('n', 'K', 'lua vim.lsp.buf.hover()') ---vim.keymap.set('n', 'gf', 'lua vim.lsp.buf.formatting()') ---vim.keymap.set('n', 'gr', 'lua vim.lsp.buf.references()') ---vim.keymap.set('n', 'gd', 'lua vim.lsp.buf.definition()') ---vim.keymap.set('n', 'gD', 'lua vim.lsp.buf.declaration()') ---vim.keymap.set('n', 'gi', 'lua vim.lsp.buf.implementation()') ---vim.keymap.set('n', 'gt', 'lua vim.lsp.buf.type_definition()') ---vim.keymap.set('n', 'gn', 'lua vim.lsp.buf.rename()') ---vim.keymap.set('n', 'ga', 'lua vim.lsp.buf.code_action()') ---vim.keymap.set('n', 'ge', 'lua vim.diagnostic.open_float()') ---vim.keymap.set('n', 'g]', 'lua vim.diagnostic.goto_next()') ---vim.keymap.set('n', 'g[', 'lua vim.diagnostic.goto_prev()') ----- LSP handlers ---vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( --- vim.lsp.diagnostic.on_publish_diagnostics, { virtual_text = false } ---) ----- Reference highlight ---vim.cmd [[ ---set updatetime=500 ---highlight LspReferenceText cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040 ---highlight LspReferenceRead cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040 ---highlight LspReferenceWrite cterm=underline ctermfg=1 ctermbg=8 gui=underline guifg=#A00000 guibg=#104040 ---augroup lsp_document_highlight --- autocmd! --- autocmd CursorHold,CursorHoldI * lua vim.lsp.buf.document_highlight() --- autocmd CursorMoved,CursorMovedI * lua vim.lsp.buf.clear_references() ---augroup END ---]] --- ----- 3. completion (hrsh7th/nvim-cmp) ---local cmp = require("cmp") ---cmp.setup({ --- snippet = { --- expand = function(args) --- vim.fn["vsnip#anonymous"](args.body) --- end, --- }, --- sources = { --- { name = "nvim_lsp" }, --- -- { name = "buffer" }, --- -- { name = "path" }, --- }, --- mapping = cmp.mapping.preset.insert({ --- [""] = cmp.mapping.select_prev_item(), --- [""] = cmp.mapping.select_next_item(), --- [''] = cmp.mapping.complete(), --- [''] = cmp.mapping.abort(), --- [""] = cmp.mapping.confirm { select = true }, --- }), --- experimental = { --- ghost_text = true, --- }, ---}) ----- cmp.setup.cmdline('/', { ----- mapping = cmp.mapping.preset.cmdline(), ----- sources = { ----- { name = 'buffer' } ----- } ----- }) ----- cmp.setup.cmdline(":", { ----- mapping = cmp.mapping.preset.cmdline(), ----- sources = { ----- { name = "path" }, ----- { name = "cmdline" }, ----- }, ----- }) - --- satysfi language server ---require('lspconfig')['satysfi-ls'].setup{ --- autostart = true ---} +-- vimtex +vim.g.vimtex_view_method = 'general' -- which is installed on both win and linux ----------------------------------------------------------- --- Ctrl + P to invoke fzf file search -vim.api.nvim_set_keymap('n', '', - "lua require('fzf-lua').files()", - { noremap = true, silent = true }) +-- iron (repl) +local iron = require('iron.core') +iron.setup { + config = { + scratch_repl = true, -- repl should be discarded + repl_definition = { + fish = { + command = { 'fish' }, + }, + julia = { + command = { 'julia', }, + }, + shell = { + command = { 'sh', }, + }, + }, + repl_open_cmd = require('iron.view').split.botright('30%'), -- repl view config + }, + keymaps = { + send_motion = "sc", + visual_send = "sc", + send_file = "sf", + send_line = "sl", + send_mark = "sm", + mark_motion = "mc", + mark_visual = "mc", + remove_mark = "md", + cr = "s", + interrupt = "s", + exit = "sq", + clear = "cl", + }, +} +-- keymap for iron repl +vim.keymap.set('n', '', 'IronRepl') +----------------------------------------------------------- +-- gitsigns +require('gitsigns').setup { + on_attach = function(bufnr) + local gs = package.loaded.gitsigns + + ---custom mapping func + ---@param mode string|string[] + ---@param l string + ---@param r any + ---@param opts table? + local function map(mode, l, r, opts) + opts = opts or {} + opts.buffer = bufnr + vim.keymap.set(mode, l, r, opts) + end + + -- Navigation + map('n', ']c', function() + if vim.wo.diff then return ']c' end + vim.schedule(function() gs.next_hunk() end) + return '' + end, {expr=true}) + map('n', '[c', function() + if vim.wo.diff then return '[c' end + vim.schedule(function() gs.prev_hunk() end) + return '' + end, {expr=true}) + end +} ----------------------------------------------------------- -- lualine require('lualine_setup') -lualine = require('lualine') -lualine.setup({ - options = { theme = 'iceberg_dark' } + +----------------------------------------------------------- +-- telescope +vim.keymap.set('n', '', function() require('telescope.builtin').find_files { sort_lastused = true } end) -- fd? + +----------------------------------------------------------- +-- Treesitter +-- manually install parsers with `:TSInstall ` + +-- satysfi (https://github.com/monaqa/tree-sitter-satysfi) +local parser_config = require "nvim-treesitter.parsers".get_parser_configs() +parser_config.satysfi = { + install_info = { + url = "https://github.com/monaqa/tree-sitter-satysfi", + files = { "src/parser.c", "src/scanner.c" } + }, + filetype = 'satysfi', +} + +-- setup +require'nvim-treesitter.configs'.setup { + ensure_installed = { + 'satysfi', + }, + 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, + keymaps = { + ['aa'] = '@parameter.outer', + ['ia'] = '@parameter.inner', + ['af'] = '@function.outer', + ['if'] = '@function.inner', + ['ac'] = '@class.outer', + ['ic'] = '@class.inner', + }, + }, + move = { + enable = true, + set_jumps = true, + 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', + }, + }, + swap = { + enable = true, + swap_next = { + ['a'] = '@parameter.inner', + }, + swap_previous = { + ['A'] = '@parameter.inner', + }, + }, + }, +} + + +----------------------------------------------------------- +-- LSP config + +local lspconfig = require 'lspconfig' + +-- Mapping for language server +-- See `:help vim.diagnostic.* for documentation on any of the below functions +local opts = { noremap = true, silent = true } +vim.keymap.set('n', 'e', vim.diagnostic.open_float, opts) +vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts) +vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts) +vim.keymap.set('n', 'q', vim.diagnostic.setloclist, opts) + +-- Use an on_attach function to only map the following keys +-- after the language server attaches to the current buffer +local on_attach = function(client, bufnr) + -- Enable completion triggered by + --vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings + -- See `:help vim.lsp.*` for documentation on any of the below function + local bufopts = { noremap = true, silent = true, buffer = bufnr } + vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts) + vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts) + vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts) + vim.keymap.set('n', 'g1', vim.lsp.buf.implementation, bufopts) + vim.keymap.set('n', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'grf', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'f', function() vim.lsp.buf.format { async = true } end, bufopts) +end + +-- cmp_nvim_lsp supports additional LSP completion capabilities +local capabilities = require("cmp_nvim_lsp").default_capabilities() + + + +-- Lua +lspconfig.lua_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + Lua = { + runtime = { + version = 'LuaJIT', + }, + diagnostics = { + globals = {'vim'}, + }, + workspace = { + library = vim.api.nvim_get_runtime_file("", true), + }, + telemetry = { + enable = false, + }, + }, + }, +} +-- Julia +lspconfig.julials.setup { + on_attach = on_attach, + capabilities = capabilities, +} +-- SATySFi +lspconfig.satysfi_ls.setup { + on_attach = on_attach, + capabilities = capabilities, + autostart = true, +} +-- bash +lspconfig.bashls.setup { + on_attach = on_attach, + capabilities = capabilities, +} +-- python +lspconfig.pyright.setup { + on_attach = on_attach, + capabilities = capabilities, +} +-- rust +lspconfig.rust_analyzer.setup { + on_attach = on_attach, + capabilities = capabilities, +} +-- tex +lspconfig.texlab.setup { + on_attach = on_attach, + capabilities = capabilities, +} +-- -- jetls +-- lspconfig.jetls.setup {} + +-- nvim-cmp setup +local cmp = require 'cmp' +local luasnip = require 'luasnip' +luasnip.config.setup {} + +cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), -- Up + [''] = cmp.mapping.scroll_docs(4), -- Down + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end, { 'i', 's' }), + }), + sources = { + { name = 'nvim_lsp' }, + { name = 'luasnip' }, + { name = 'buffer' }, + { + name = 'latex_symbols', + option = { + strategy = 0, -- mixed (show the comand and insert the symbol) + }, + }, + { name = 'path' }, + { name = 'nvim_lua' }, + }, +} +-- cmdline completions +-- `/` cmdline setup. +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } }) -lualine.setup() +-- ':' +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { + name = 'cmdline', + option = { + ignore_cmds = { 'Man', '!' } + } + } + }) +}) + diff --git a/dotfiles/neovim/lua/lspconfig/server_configurations/jetls.lua b/dotfiles/neovim/lua/lspconfig/server_configurations/jetls.lua new file mode 100644 index 0000000..6f6f599 --- /dev/null +++ b/dotfiles/neovim/lua/lspconfig/server_configurations/jetls.lua @@ -0,0 +1,68 @@ +-- local cmd = { +-- 'julia', +-- '--startup-file=no', +-- '--history-file=no', +-- '-e', +-- [[ +-- # Load JETLS.jl: attempt to load from ~/.julia/environments/nvim-lspconfig +-- # with the regular load path as a fallback +-- jet_install_path = joinpath( +-- get(DEPOT_PATH, 1, joinpath(homedir(), ".julia")), +-- "environments", "nvim-lspconfig" +-- ) +-- pushfirst!(LOAD_PATH, jet_install_path) +-- using JETLS +-- popfirst!(LOAD_PATH) +-- depot_path = get(ENV, "JULIA_DEPOT_PATH", "") +-- project_path = let +-- dirname(something( +-- ## 1. Finds an explicitly set project (JULIA_PROJECT) +-- Base.load_path_expand(( +-- p = get(ENV, "JULIA_PROJECT", nothing); +-- p === nothing ? nothing : isempty(p) ? nothing : p +-- )), +-- ## 2. Look for a Project.toml file in the current working directory, +-- ## or parent directories, with $HOME as an upper boundary +-- Base.current_project(), +-- ## 3. First entry in the load path +-- get(Base.load_path(), 1, nothing), +-- ## 4. Fallback to default global environment, +-- ## this is more or less unreachable +-- Base.load_path_expand("@v#.#"), +-- )) +-- end +-- @info "Running JETLS language server" VERSION pwd() project_path +-- @info "not running yet" +-- JETLS.runserver(stdin, stdout) +-- ]], +-- } +local cmd = { + 'julia', + '--startup-file=no', + '--history-file=no', + '-e', + [[ + println("===STARTING JETLS===") + using JETLS + JETLS.runserver(stdin, stdout) + @info "Running JETLS" VERSION pwd() project_path + @info "============================" + ]], +} + +return { + default_config = { + cmd = cmd, + filetypes = { 'julia' }, + root_dir = function(fname) + local util = require 'lspconfig.util' + return util.root_pattern 'Project.toml' (fname) or util.find_git_ancestor(fname) or + util.path.dirname(fname) + end, + }, + docs = { + description = [[ +TBW + ]], + }, +} diff --git a/dotfiles/neovim/lua/lspconfig/server_configuration/satysfi-ls.lua b/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua similarity index 85% rename from dotfiles/neovim/lua/lspconfig/server_configuration/satysfi-ls.lua rename to dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua index 78e30f7..1301c06 100644 --- a/dotfiles/neovim/lua/lspconfig/server_configuration/satysfi-ls.lua +++ b/dotfiles/neovim/lua/lspconfig/server_configurations/satysfi_ls.lua @@ -1,4 +1,4 @@ -# https://zenn.dev/monaqa/articles/2021-12-10-satysfi-language-server +-- https://zenn.dev/monaqa/articles/2021-12-10-satysfi-language-server local util = require 'lspconfig.util' return { @@ -18,3 +18,4 @@ return { }, }, } + diff --git a/dotfiles/neovim/lua/plugins.lua b/dotfiles/neovim/lua/plugins.lua deleted file mode 100644 index 4ec117b..0000000 --- a/dotfiles/neovim/lua/plugins.lua +++ /dev/null @@ -1,29 +0,0 @@ -vim.cmd [[packadd packer.nvim]] - -return require('packer').startup(function(use) - use 'wbthomason/packer.nvim' - - -- fzf - use { 'ibhagwan/fzf-lua', - -- optional icon - --requires = { 'kyazdan142/nvim-web/devicons' } -- not found - } - - -- lualine(statusline) - use { - 'nvim-lualine/lualine.nvim', - requires = { 'kyazdani42/nvim-web-devicons', opt = true } - } - - -- LSP - use 'neovim/nvim-lspconfig' - use "williamboman/mason.nvim" - use "williamboman/mason-lspconfig.nvim" - use "hrsh7th/nvim-cmp" - use "hrsh7th/cmp-nvim-lsp" - use "hrsh7th/vim-vsnip" - - -- Julia - use "JuliaEditorSupport/julia-vim" - -end) diff --git a/dotfiles/tmux.conf b/dotfiles/tmux.conf index 5f57a60..106c2a4 100644 --- a/dotfiles/tmux.conf +++ b/dotfiles/tmux.conf @@ -31,11 +31,27 @@ set -g base-index 1 # start pane index at 1 setw -g pane-base-index 1 +set-option -g pane-border-indicators both +set-option -g pane-border-lines heavy + # ----------------------------------------------- # status line configs +set-option -g monitor-bell on +set-option -g status-interval 1 +set-option -g status-left '#[bg=colour156 bold]#{?client_prefix,#[reverse] P #[noreverse],#{?copy_cursor_x,#[bg=colour216] C , P }}#[bg=default nobold][#S] ' # indicates prefix and copy status +set-option -g status-left-length 15 set-option -g status-right "#[bg=colour156] #T | %y/%m/%d %H:%M:%S" +set-option -g status-right-length 90 #set-window-option -g window-status-format "#[bg=green]#I:#W-" # default set-window-option -g window-status-current-format "#[bg=colour156]#I:#W*" +# ----------------------------------------------- +# true colour +# alacritty: alacritty +# wezterm xfce-terminal konsole gnome-terminal: xterm-256color +set -ga terminal-overrides ",alacritty:RGB,xterm-256color:RGB" + +set-option -g focus-events on set -s escape-time 100 +