From d4f203700b59a9c1bd18e6ffb9a197562798a314 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 23 May 2022 21:04:16 -0500 Subject: [PATCH 1/7] Various fixes --- common/fish/key-bindings.fish | 6 +++++- common/fish/paths.fish | 1 + common/helix/languages.toml | 3 +++ common/neovim/lua/lsp.lua | 13 +++---------- common/neovim/lua/plugins.lua | 2 +- common/pgcli/.gitignore | 2 ++ os/macos/config.d.fish | 4 ++-- 7 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 common/helix/languages.toml create mode 100644 common/pgcli/.gitignore diff --git a/common/fish/key-bindings.fish b/common/fish/key-bindings.fish index c91988f..a913fa6 100644 --- a/common/fish/key-bindings.fish +++ b/common/fish/key-bindings.fish @@ -1,5 +1,9 @@ function fish_user_key_bindings - test -f $HOME/.fzf/shell/key-bindings.fish && source $HOME/.fzf/shell/key-bindings.fish + if command -v brew &>/dev/null && test -f (brew --prefix fzf)/shell/key-bindings.fish + source (brew --prefix fzf)/shell/key-bindings.fish + else if test -f $HOME/.fzf/shell/key-bindings.fish + source $HOME/.fzf/shell/key-bindings.fish + end type -q fzf_key_bindings && fzf_key_bindings fish_vi_key_bindings insert --no-erase diff --git a/common/fish/paths.fish b/common/fish/paths.fish index 0569819..41953d4 100644 --- a/common/fish/paths.fish +++ b/common/fish/paths.fish @@ -26,6 +26,7 @@ set --export --universal GOPATH $HOME/.go set --export --universal GOBIN $GOPATH/bin set paths_candidates \ + /Users/danielflanagan/.asdf/shims \ /opt/homebrew/bin \ /opt/homebrew/sbin \ $DOTFILES_PATH/common/bin \ diff --git a/common/helix/languages.toml b/common/helix/languages.toml new file mode 100644 index 0000000..0e19928 --- /dev/null +++ b/common/helix/languages.toml @@ -0,0 +1,3 @@ +[[language]] +name = "typescript" +language-server = { command = "deno", args = ["lsp"] } \ No newline at end of file diff --git a/common/neovim/lua/lsp.lua b/common/neovim/lua/lsp.lua index c37a9a7..085190c 100644 --- a/common/neovim/lua/lsp.lua +++ b/common/neovim/lua/lsp.lua @@ -86,13 +86,6 @@ for server, config in pairs(lsp_configs) do lsp[server].setup(config) end -local lsp_installer = require 'nvim-lsp-installer' -lsp_installer.on_server_ready(function(server) - local server_opts = {} - - -- if server.name == "elixirls" then - -- server_opts.cmd = { vim.fn.expand'~/.local/share/nvim/lsp_servers/elixir/elixir-ls/language_server.sh' } - -- end - - server:setup(server_opts) -end) +require'nvim-lsp-installer'.setup{ + automatic_installation = true, +} diff --git a/common/neovim/lua/plugins.lua b/common/neovim/lua/plugins.lua index 309ce3e..b7d5774 100644 --- a/common/neovim/lua/plugins.lua +++ b/common/neovim/lua/plugins.lua @@ -170,7 +170,7 @@ packer.startup(function() require 'nvim-treesitter.configs'.setup { ensure_installed = "all", sync_install = false, - ignore_install = {}, + ignore_install = { "phpdoc" }, indent = { enable = true, }, diff --git a/common/pgcli/.gitignore b/common/pgcli/.gitignore new file mode 100644 index 0000000..f7cc997 --- /dev/null +++ b/common/pgcli/.gitignore @@ -0,0 +1,2 @@ +history +log diff --git a/os/macos/config.d.fish b/os/macos/config.d.fish index c8d40de..af8a605 100644 --- a/os/macos/config.d.fish +++ b/os/macos/config.d.fish @@ -1,4 +1,4 @@ #!/usr/bin/env fish -fish_add_path /opt/homebrew/sbin -fish_add_path /opt/homebrew/bin +# fish_add_path /opt/homebrew/sbin +# fish_add_path /opt/homebrew/bin -- 2.44.1 From 3564af3a66f014c93437c9ebfbf9bec08f8ea153 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 23 May 2022 21:06:00 -0500 Subject: [PATCH 2/7] More generic asdf path --- common/fish/paths.fish | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/fish/paths.fish b/common/fish/paths.fish index 41953d4..48c104c 100644 --- a/common/fish/paths.fish +++ b/common/fish/paths.fish @@ -26,7 +26,7 @@ set --export --universal GOPATH $HOME/.go set --export --universal GOBIN $GOPATH/bin set paths_candidates \ - /Users/danielflanagan/.asdf/shims \ + $HOME/.asdf/shims \ /opt/homebrew/bin \ /opt/homebrew/sbin \ $DOTFILES_PATH/common/bin \ -- 2.44.1 From 50f40705a6465276db08d591c7b09b31d84734ba Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Fri, 3 Jun 2022 09:20:46 -0500 Subject: [PATCH 3/7] PRAISE HELIX --- common/helix/config.toml | 1 + common/helix/themes/donokai.toml | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/common/helix/config.toml b/common/helix/config.toml index 46ab088..c25fd41 100644 --- a/common/helix/config.toml +++ b/common/helix/config.toml @@ -3,6 +3,7 @@ theme = "donokai" [editor] auto-pairs = false scrolloff = 8 +rulers = [80, 120] [editor.cursor-shape] normal = "block" diff --git a/common/helix/themes/donokai.toml b/common/helix/themes/donokai.toml index 6b71a5a..d73909f 100644 --- a/common/helix/themes/donokai.toml +++ b/common/helix/themes/donokai.toml @@ -32,6 +32,7 @@ "attribute" = { fg = "fn_declaration" } "comment" = { fg = "#88846F" } +"ui.virtual" = "#888888" "string" = { fg = "#e6db74" } "constant.character" = { fg = "#e6db74" } @@ -39,16 +40,26 @@ "constant.numeric" = { fg = "#ae81ff" } "constant.character.escape" = { fg = "#ae81ff" } +"markup.heading" = "blue" +"markup.list" = "red" +"markup.bold" = { fg = "yellow", modifiers = ["bold"] } +"markup.italic" = { fg = "magenta", modifiers = ["italic"] } +"markup.link.url" = { fg = "yellow", modifiers = ["underlined"] } +"markup.link.text" = "red" +"markup.quote" = "cyan" +"markup.raw" = "green" + "diff.plus" = { fg = "#a6e22e" } "diff.delta" = { fg = "#fd971f" } "diff.minus" = { fg = "#f92672" } -# "ui.background" = { fg = "text", bg = "background" } +"ui.background" = { fg = "text", bg = "background" } "ui.window" = { bg = "widget" } "ui.popup" = { bg = "widget" } "ui.help" = { bg = "widget" } -"ui.menu.selected" = { bg = "widget" } +"ui.menu" = { bg = "widget" } +"ui.menu.selected" = { bg = "blue", fg = "background" } "ui.cursor" = { fg = "cursor", modifiers = ["reversed"] } "ui.cursor.primary" = { fg = "cursor", modifiers = ["reversed"] } -- 2.44.1 From aa160879032b9a21ce8407cf73aefef334bcf630 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 7 Jun 2022 09:33:15 -0500 Subject: [PATCH 4/7] I don't think Helix is gonna happen until I can really script it out --- common/helix/config.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/common/helix/config.toml b/common/helix/config.toml index ed2992a..da20ff6 100644 --- a/common/helix/config.toml +++ b/common/helix/config.toml @@ -21,6 +21,9 @@ K = { k = "normal_mode", j = "normal_mode", K = "normal_mode", J = "normal_mode" [keys.normal] g = { G = "goto_last_line" } +D = "kill_to_line_end" +C = ["kill_to_line_end", "insert_mode"] +"^" = "goto_line_start" [keys.select] g = { G = "goto_last_line" } -- 2.44.1 From 3c280675d8910bcc731a2521d9232274be8c9c0e Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 13 Jun 2022 23:44:08 -0500 Subject: [PATCH 5/7] Hopefully fix neovim config --- common/neovim/colors/base16-donokai.vim | 1 - common/neovim/ftplugin/nim.vim | 1 - common/neovim/init.lua | 564 +++++++++++++++++++++++- common/neovim/lua/fold.lua | 0 common/neovim/lua/keymap.lua | 79 ---- common/neovim/lua/lsp.lua | 92 ---- common/neovim/lua/options.lua | 105 ----- common/neovim/lua/plugins.lua | 192 -------- common/neovim/lua/statusline.lua | 86 ---- 9 files changed, 559 insertions(+), 561 deletions(-) delete mode 120000 common/neovim/colors/base16-donokai.vim delete mode 100644 common/neovim/ftplugin/nim.vim delete mode 100644 common/neovim/lua/fold.lua delete mode 100644 common/neovim/lua/keymap.lua delete mode 100644 common/neovim/lua/lsp.lua delete mode 100644 common/neovim/lua/options.lua delete mode 100644 common/neovim/lua/plugins.lua delete mode 100644 common/neovim/lua/statusline.lua diff --git a/common/neovim/colors/base16-donokai.vim b/common/neovim/colors/base16-donokai.vim deleted file mode 120000 index 3af3c64..0000000 --- a/common/neovim/colors/base16-donokai.vim +++ /dev/null @@ -1 +0,0 @@ -/home/daniel/.home/.config/lytedev-dotfiles/common/colors/vim \ No newline at end of file diff --git a/common/neovim/ftplugin/nim.vim b/common/neovim/ftplugin/nim.vim deleted file mode 100644 index d5a9f89..0000000 --- a/common/neovim/ftplugin/nim.vim +++ /dev/null @@ -1 +0,0 @@ -set expandtab diff --git a/common/neovim/init.lua b/common/neovim/init.lua index b57d79a..f5a9e07 100644 --- a/common/neovim/init.lua +++ b/common/neovim/init.lua @@ -1,7 +1,561 @@ vim.g.vimdir = os.getenv('XDG_CONFIG_HOME') .. '/nvim' -require'plugins' -require'options' -require'keymap' -require'statusline' -require'lsp' +local packer_install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' + +if #vim.fn.glob(packer_install_path) == 0 then + vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', packer_install_path } + vim.cmd 'packadd packer.nvim' +end + +local has_words_before = function() + local line, col = vim.api.nvim_win_get_cursor(0) + return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil +end + +local packer = require 'packer' + +packer.startup(function() + local plugins = { + 'wbthomason/packer.nvim', -- neovim plugin manager + + 'vim-scripts/LargeFile', -- degrade gracefully with large files + 'tpope/vim-repeat', -- enable repeat for plugin maps + 'tpope/vim-sleuth', -- use whatever whitespace is in the file + 'editorconfig/editorconfig-vim', -- handle .editorconfig files + 'christoomey/vim-tmux-navigator', -- navigate vim splits and tmux panes fluidly + 'machakann/vim-sandwich', -- edit surrounding characters + 'michaeljsmith/vim-indent-object', -- adds indent-level text objects + -- 'wellle/targets.vim', -- add many other text objects + 'bkad/CamelCaseMotion', -- invaluable motions for properly operating on various casings + + { + -- session management + 'olimorris/persisted.nvim', + config = function() + local should_autoload = #vim.v.argv >= 1 + require 'persisted'.setup { + autoload = should_autoload, + autosave = should_autoload, + } + end + }, + { + -- toggle comments + 'terrortylor/nvim-comment', + config = function() + require 'nvim_comment'.setup() + end + }, + { + -- fuzzy finder + 'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/popup.nvim', + 'nvim-lua/plenary.nvim', + } + }, + { + 'nvim-telescope/telescope-fzf-native.nvim', + run = 'make', + }, + { + 'tzachar/cmp-fuzzy-path', + requires = { 'hrsh7th/nvim-cmp', 'tzachar/fuzzy.nvim' }, + }, + + -- TODO: add keymap ig for toggling these + 'lukas-reineke/indent-blankline.nvim', -- indentation guide lines + 'L3MON4D3/LuaSnip', + + { + -- completion engine + 'hrsh7th/nvim-cmp', + config = function() + local cmp = require 'cmp' + local luasnip = require 'luasnip' + + --[[ + local prev_item = function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end + + local next_item = function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + elseif has_words_before() then + cmp.complete() + else + fallback() + end + end + ]] -- + + cmp.setup { + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + window = { + }, + mapping = { + [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), + [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- [''] = cmp.config.n + [''] = cmp.mapping { + i = cmp.mapping.close, + c = cmp.mapping.close, + }, + [''] = cmp.mapping.confirm { select = false }, + -- [""] = cmp.mapping(next_item, { "i", "s" }), + -- [""] = cmp.mapping(prev_item, { "i", "s" }), + -- [''] = cmp.mapping(next_item, { "i", "s" }), + -- [''] = cmp.mapping(prev_item, { "i", "s" }), + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'luasnip' }, + }, { + { name = 'buffer' }, + { name = 'path' }, + { name = 'fuzzy_path' }, + }), + formatting = { + format = require("lspkind").cmp_format { + with_text = true, + menu = { + nvim_lsp = "[LSP]", + }, + } + }, + } + + cmp.setup.cmdline('/', { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' }, + { name = 'fuzzy_path' }, + } + }) + + cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }) + }) + end, + }, + 'neovim/nvim-lspconfig', -- language server configuration helper + 'williamboman/nvim-lsp-installer', -- plugin containing installation commands for many language servers + 'hrsh7th/cmp-nvim-lsp-signature-help', + 'hrsh7th/cmp-nvim-lsp', -- add lsp to completion engine + 'hrsh7th/cmp-buffer', -- add buffer information to completion engine + 'hrsh7th/cmp-path', -- add filesystem information to complete enging + 'hrsh7th/cmp-cmdline', -- add completion for vim commands + 'onsails/lspkind-nvim', + 'saadparwaiz1/cmp_luasnip', + -- TODO: automate this installation process of :COQdeps:COQnow + -- {'ms-jpq/coq_nvim', branch = 'coq'}, + -- {'ms-jpq/coq.thirdparty', branch = '3p'}, + { + -- syntax highlighting and indentation + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + config = function() + require 'nvim-treesitter.configs'.setup { + ensure_installed = "all", + sync_install = false, + ignore_install = { "phpdoc" }, + indent = { + enable = true, + }, + highlight = { + enable = true, + disable = {}, + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + -- additional_vim_regex_highlighting = false, + }, + } + end + }, + 'lukas-reineke/lsp-format.nvim', + } + for _, plugin in pairs(plugins) do packer.use(plugin) end +end) + +local globals = { + mapleader = ' ', + maplocalleader = ' ', + -- skipview_files = { 'COMMIT_EDITMSG' }, + indent_blankline_char = '▏', + indent_blankline_filetype_exclude = { 'help', 'packer' }, + indent_blankline_buftype_exclude = { 'terminal', 'nofile' }, + indent_blankline_char_highlight = 'LineNr', +} +for k, v in pairs(globals) do vim.g[k] = v end + +local options = { + clipboard = 'unnamedplus', + inccommand = 'nosplit', + tabstop = 2, + softtabstop = 2, + shiftwidth = 2, + smartindent = true, + list = true, + listchars = 'trail:·,tab: ', + linebreak = true, + formatoptions = 'crql1jn', + synmaxcol = 200, + lazyredraw = true, + scrolloff = 8, + sidescrolloff = 15, + mouse = 'a', + splitright = true, + splitbelow = true, + errorbells = false, + visualbell = true, + backup = false, + writebackup = false, + swapfile = false, + timeout = true, + timeoutlen = 150, + hidden = true, + shortmess = 'filnxToOFIac', + history = 1000, + undofile = true, + undodir = vim.fn.stdpath 'data' .. '/undo', + undolevels = 1000, + undoreload = 1000, + spellfile = vim.fn.stdpath 'data' .. '/spell/en.utf-8.add', + ignorecase = true, + smartcase = true, + incsearch = true, + wrapscan = true, + hlsearch = true, + foldmethod = 'syntax', + foldlevel = 99, + foldnestmax = 10, + foldlevelstart = 99, + autowrite = false, + autochdir = false, + autoread = true, + modeline = false, + showmode = false, + showcmd = false, + laststatus = 2, + ruler = false, + number = true, + -- cmdheight = 0, +} +for k, v in pairs(options) do + vim.o[k] = v +end + +vim.api.nvim_command 'colorscheme donokai' + +function SynGroup() + local s = vim.fn.synID(vim.fn.line('.'), vim.fn.col('.'), 1) + -- TODO: instead of printing, put it in a popup? virtual text? + print(vim.fn.synIDattr(s, 'name') .. ' -> ' .. vim.fn.synIDattr(vim.fn.synIDtrans(s), 'name')) +end + +vim.api.nvim_create_autocmd("TextYankPost", { + pattern = "*", + callback = function() + vim.highlight.on_yank { higroup = 'Search', timeout = 200 } + end, +}) + +vim.api.nvim_create_autocmd("FileType", { + pattern = "gitcommit", + callback = function() + vim.cmd 'startinsert' + end, +}) + +vim.cmd 'command! W write' + +function NeatFoldText() + -- TODO: finish this! + -- local lines_count = vim.foldend - vim.foldstart + 1 + -- local foldchar = vim.fn.matchstr(vim.fillchars, 'fold:\\zs.') + -- local foldtextstart = vim.fn.strpart('^' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) + -- let foldtextend = printf("%s %".(winwidth(0)-20)."dL", foldtextstart, getline(v:foldstart), lines_count) + -- let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn + -- return printf("%s%d", substitute(getline(v:foldstart), "^.", ">"), lines_count) +end + +-- set foldtext=NeatFoldText() + +for _, keys in ipairs { 'jj', 'jJ', 'Jj', 'JJ', 'jk', 'jK', 'Jk', 'JK' } do + vim.api.nvim_set_keymap('i', keys, '', {}) +end + +local m = { + s = { silent = true }, + n = { noremap = true }, + sn = { silent = true, noremap = true }, +} +local keymap = { + n = { + ['/'] = { ':let @/ = "":', m.s }, + + ['r'] = { ':luafile ' .. vim.g.vimdir .. '/init.lua:echo \'Reloaded init.lua\'', m.s }, + ['gv'] = { ':e ' .. vim.g.vimdir .. '/init.lua', m.s }, + + ['w'] = { ':bd', m.s }, + ['h'] = { ':b#', m.s }, + ['k'] = { ':bnext', m.s }, + ['j'] = { ':bprevious', m.s }, + + [''] = ':qa', + + [''] = 'Telescope git_files', + [''] = 'Telescope live_grep', + [''] = 'Telescope buffers', + ['t'] = 'Telescope help_tags', + + [''] = ':TmuxNavigateLeft', + [''] = ':TmuxNavigateDown', + [''] = ':TmuxNavigateUp', + [''] = ':TmuxNavigateRight', + + [' n'] = "'Nn'[v:searchforward]", + [' N'] = "'nN'[v:searchforward]", + [''] = ':lua SynGroup()', + + ['s'] = "SessionToggleecho 'Persisting Session: ' .. g:persisting .. ' (' .. getcwd() .. ')'", + ['S'] = "SessionSaveecho 'Saved Session: ' .. getcwd()", + ['l'] = "SessionLoadecho 'Loaded Session: ' .. getcwd()", + ['L'] = "SessionLoadLastecho 'Loaded Last Session: ' .. getcwd()", + ['d'] = "SessionDeleteecho 'Deleted Session for cwd: ' .. getcwd()", + }, + + -- terminal bindings + t = {}, + + [''] = { + [''] = { '', m.sn }, + + -- remove trailing whitespace + [''] = 'mw:%s/\\s\\+$//:let @/ = ""\'w', + ['gs'] = ':setlocal spell!', + [',w'] = { 'CamelCaseMotion_w', m.s }, + [',b'] = { 'CamelCaseMotion_b', m.s }, + [',e'] = { 'CamelCaseMotion_e', m.s }, + [',ge'] = { 'CamelCaseMotion_ge', m.s }, + }, + o = { + ['ib'] = { 'CamelCaseMotion_ib', m.s }, + ['ie'] = { 'CamelCaseMotion_ie', m.s }, + }, + x = { + ['<'] = ''] = '>gv', + ['ib'] = { 'CamelCaseMotion_ib', m.s }, + ['ie'] = { 'CamelCaseMotion_ie', m.s }, + }, + i = { + [''] = '', + }, +} +for mode, mappings in pairs(keymap) do + for key, bind in pairs(mappings) do + if type(bind) == 'table' then + vim.api.nvim_set_keymap(mode, key, bind[1], bind[2]) + else + vim.api.nvim_set_keymap(mode, key, bind, {}) + end + end +end + +local status_line_max_length = 5 + +-- TODO: only update this portion when needed instead of every render? +local status_line_buffer_by_num = function(bufnum) + local is_active = false + local bufinfo = vim.fn.getbufinfo(bufnum)[1] + local prefix = ' %#InactiveBuffer#' + local suffix = '%* ' + + if bufinfo.changed == 1 then + prefix = '%#DirtyBuffer# ' + suffix = ' %*' + end + + local windex = vim.fn.index(bufinfo.windows, vim.g.statusline_winid) + if bufinfo.hidden and windex >= 0 then + is_active = true + prefix = '%#ActiveBuffer# ' + suffix = ' %*' + if bufinfo.changed == 1 then + prefix = '%#ActiveDirtyBuffer# *' + suffix = ' %*' + end + end + + return (prefix .. vim.fn.fnamemodify(vim.fn.bufname(bufnum), ':t') .. suffix), is_active +end + +local status_line_buffers = function() + local active_index = -1 + local acc = {} + for _, bufnum in ipairs(vim.api.nvim_list_bufs()) do + local bufinfo = vim.fn.getbufinfo(bufnum)[1] + if bufinfo.listed ~= 0 then + local entry, is_active = status_line_buffer_by_num(bufnum) + table.insert(acc, entry) + if is_active then + active_index = #acc + end + end + end + if active_index >= 0 then + local offset = status_line_max_length / 2 + local min_buf_num = math.max(0, (active_index - offset)) + local max_buf_num = math.min(#acc - 1, min_buf_num + status_line_max_length - 1) + min_buf_num = math.max(0, max_buf_num - status_line_max_length + 1) + local buflist = table.concat({ unpack(acc, min_buf_num + 1, max_buf_num + 1) }, '') + local prefix = '' + local suffix = '' + if min_buf_num > 0 then + prefix = '< ' + end + if max_buf_num < (#acc - 1) then + suffix = ' >' + end + return prefix .. buflist .. suffix + else + local suffix = '' + if #acc - 1 > status_line_max_length then + suffix = ' >' + end + local buflist = table.concat({ unpack(acc, 1, math.min(#acc, status_line_max_length)) }, '') + return buflist .. suffix .. active_index + end +end + +local whitespace = function() + local result = "" + if vim.o.expandtab == true then + result = result .. vim.o.shiftwidth .. "S" + else + result = result .. vim.o.tabstop .. "T" + end + return result +end + +function StatusLine() + return status_line_buffers() .. '%*%=%{&filetype} %l;%c (%p%%/%L) ' .. whitespace() +end + +vim.o.statusline = '%!v:lua.StatusLine()' + +local lsp = require 'lspconfig' +-- local coq = require'coq' + +local lsp_format = require 'lsp-format' + +local on_attach = function(client, bufnr) + lsp_format.on_attach(client) + + local lsp_mappings = { + ['n'] = { + ['e'] = 'vim.diagnostic.open_float()', + [''] = 'vim.lsp.buf.signature_help()', + ['gi'] = 'vim.lsp.buf.implementation()', + ['K'] = 'vim.lsp.buf.hover()', + ['gd'] = 'vim.lsp.buf.definition()', + ['gD'] = 'vim.lsp.buf.declaration()', + ['g['] = 'vim.diagnostic.goto_prev()', + ['g]'] = 'vim.diagnostic.goto_next()', + ['wa'] = 'vim.lsp.buf.add_workspace_folder()', + ['wr'] = 'vim.lsp.buf.remove_workspace_folder()', + ['wl'] = 'print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', + ['D'] = 'vim.lsp.buf.type_definition()', + ['rn'] = 'vim.lsp.buf.rename()', + ['ca'] = 'vim.lsp.buf.code_action()', + ['gr'] = 'vim.lsp.buf.references()', + ['f'] = 'vim.lsp.buf.formatting_seq_sync()', + } + } + + for mode, mappings in pairs(lsp_mappings) do + for keys, script in pairs(mappings) do + vim.api.nvim_buf_set_keymap(bufnr, mode, keys, 'lua ' .. script .. '', m.sn) + end + end +end + +--[[ + +set els_path ~/.local/share/nvim/lsp_servers/elixir +curl -fLO https://github.com/elixir-lsp/elixir-ls/releases/latest/download/elixir-ls.zip +mkdir -p $els_path +unzip elixir-ls.zip -d $els_path/elixir-ls/ +chmod +x $els_path/elixir-ls/language_server.sh + +]] -- + +local lsp_configs = { + gopls = {}, + elixirls = { + cmd = { vim.fn.expand '~/.local/share/nvim/lsp_servers/elixir/elixir-ls/language_server.sh' }, + settings = { + elixirLS = { + dialyzerEnabled = true, + fetchDeps = false, + } + } + }, + sumneko_lua = { + settings = { + Lua = { + diagnostics = { + globals = { 'vim' } + } + } + } + }, + vimls = {}, + rust_analyzer = {}, + -- tsserver = {}, + pylsp = {}, + denols = { + root_dir = lsp.util.root_pattern("deno.json"), + }, +} + +local capabilities = require 'cmp_nvim_lsp'.update_capabilities(vim.lsp.protocol.make_client_capabilities()) +local common_config = { + capabilities = capabilities, + on_attach = on_attach, + flags = { + debounce_text_changes = 150 + }, +} + +for server, config in pairs(lsp_configs) do + for k, v in pairs(common_config) do config[k] = v end + lsp[server].setup(config) +end + +require 'nvim-lsp-installer'.setup { + automatic_installation = true, +} diff --git a/common/neovim/lua/fold.lua b/common/neovim/lua/fold.lua deleted file mode 100644 index e69de29..0000000 diff --git a/common/neovim/lua/keymap.lua b/common/neovim/lua/keymap.lua deleted file mode 100644 index 414ae64..0000000 --- a/common/neovim/lua/keymap.lua +++ /dev/null @@ -1,79 +0,0 @@ -for _, keys in ipairs { 'jj', 'jJ', 'Jj', 'JJ', 'jk', 'jK', 'Jk', 'JK' } do vim.api.nvim_set_keymap('i', keys, '', {}) end - -local m = { - s = { silent = true }, - n = { noremap = true }, - sn = { silent = true, noremap = true }, -} -local keymap = { - n = { - ['/'] = { ':let @/ = "":', m.s }, - - ['r'] = { ':luafile ' .. vim.g.vimdir .. '/init.lua:echo \'Reloaded init.lua\'', m.s }, - ['gv'] = { ':e ' .. vim.g.vimdir .. '/init.lua', m.s }, - - ['w'] = { ':bd', m.s }, - ['h'] = { ':b#', m.s }, - ['k'] = { ':bnext', m.s }, - ['j'] = { ':bprevious', m.s }, - - [''] = ':qa', - - [''] = 'Telescope git_files', - [''] = 'Telescope live_grep', - [''] = 'Telescope buffers', - ['t'] = 'Telescope help_tags', - - [''] = ':TmuxNavigateLeft', - [''] = ':TmuxNavigateDown', - [''] = ':TmuxNavigateUp', - [''] = ':TmuxNavigateRight', - - [' n'] = "'Nn'[v:searchforward]", - [' N'] = "'nN'[v:searchforward]", - [''] = ':lua SynGroup()', - - ['s'] = "SessionToggleecho 'Persisting Session: ' .. g:persisting .. ' (' .. getcwd() .. ')'", - ['S'] = "SessionSaveecho 'Saved Session: ' .. getcwd()", - ['l'] = "SessionLoadecho 'Loaded Session: ' .. getcwd()", - ['L'] = "SessionLoadLastecho 'Loaded Last Session: ' .. getcwd()", - ['d'] = "SessionDeleteecho 'Deleted Session for cwd: ' .. getcwd()", - }, - - -- terminal bindings - t = {}, - - [''] = { - [''] = { '', m.sn }, - - -- remove trailing whitespace - [''] = 'mw:%s/\\s\\+$//:let @/ = ""\'w', - ['gs'] = ':setlocal spell!', - [',w'] = { 'CamelCaseMotion_w', m.s }, - [',b'] = { 'CamelCaseMotion_b', m.s }, - [',e'] = { 'CamelCaseMotion_e', m.s }, - [',ge'] = { 'CamelCaseMotion_ge', m.s }, - }, - o = { - ['ib'] = { 'CamelCaseMotion_ib', m.s }, - ['ie'] = { 'CamelCaseMotion_ie', m.s }, - }, - x = { - ['<'] = ''] = '>gv', - ['ib'] = { 'CamelCaseMotion_ib', m.s }, - ['ie'] = { 'CamelCaseMotion_ie', m.s }, - }, - i = { - [''] = '', - }, -} -for mode, mappings in pairs(keymap) do - for key, bind in pairs(mappings) do - if type(bind) == 'table' then - vim.api.nvim_set_keymap(mode, key, bind[1], bind[2]) - else - vim.api.nvim_set_keymap(mode, key, bind, {}) - end - end -end diff --git a/common/neovim/lua/lsp.lua b/common/neovim/lua/lsp.lua deleted file mode 100644 index 7c27933..0000000 --- a/common/neovim/lua/lsp.lua +++ /dev/null @@ -1,92 +0,0 @@ -local lsp = require 'lspconfig' --- local coq = require'coq' - --- TODO: replace with nvim lsp bindings for jumping to next linting issue? ---vim.api.nvim_set_keymap('n', '[d', ')', opts) - -local opts = { - noremap = true, - silent = true, -} - -local lsp_format = require 'lsp-format' - -local on_attach = function(client, bufnr) - lsp_format.on_attach(client) - - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'e', 'lua vim.diagnostic.open_float()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'g]', 'lua vim.diagnostic.goto_next()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'g[', 'lua vim.diagnostic.goto_prev()', opts) - - 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', 'gi', '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, 'i', '', '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', 'ca', 'lua vim.lsp.buf.code_action()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) - vim.api.nvim_buf_set_keymap(bufnr, 'n', 'f', 'lua vim.lsp.buf.formatting_seq_sync()', opts) -end - -local capabilities = require 'cmp_nvim_lsp'.update_capabilities(vim.lsp.protocol.make_client_capabilities()) -local common_config = { - capabilities = capabilities, - on_attach = on_attach, - flags = { - debounce_text_changes = 150 - }, -} - ---[[ - -set els_path ~/.local/share/nvim/lsp_servers/elixir -curl -fLO https://github.com/elixir-lsp/elixir-ls/releases/latest/download/elixir-ls.zip -mkdir -p $els_path -unzip elixir-ls.zip -d $els_path/elixir-ls/ -chmod +x $els_path/elixir-ls/language_server.sh - -]] - -local lsp_configs = { - gopls = {}, - elixirls = { - cmd = { vim.fn.expand '~/.local/share/nvim/lsp_servers/elixir/elixir-ls/language_server.sh' }, - settings = { - elixirLS = { - dialyzerEnabled = true, - fetchDeps = false, - } - } - }, - sumneko_lua = { - settings = { - Lua = { - diagnostics = { - globals = { 'vim' } - } - } - } - }, - vimls = {}, - rust_analyzer = {}, - -- tsserver = {}, - pylsp = {}, - denols = { - root_dir = lsp.util.root_pattern("deno.json"), - }, -} - -for server, config in pairs(lsp_configs) do - for k, v in pairs(common_config) do config[k] = v end - lsp[server].setup(config) -end - -require'nvim-lsp-installer'.setup{ - automatic_installation = true, -} diff --git a/common/neovim/lua/options.lua b/common/neovim/lua/options.lua deleted file mode 100644 index 72896a0..0000000 --- a/common/neovim/lua/options.lua +++ /dev/null @@ -1,105 +0,0 @@ -local globals = { - coq_settings = { - ['display.icons.mode'] = 'none' - }, - dashboard_default_executive = 'telescope', - mapleader = ' ', - maplocalleader = ' ', - completion_enable_auto_popup = 0, - skipview_files = {'COMMIT_EDITMSG'}, - indent_blankline_char = '▏', - indent_blankline_filetype_exclude = {'help', 'packer'}, - indent_blankline_buftype_exclude = {'terminal', 'nofile'}, - indent_blankline_char_highlight = 'LineNr', - svelte_preprocessors = {'typescript', 'coffeescript', 'sass', 'pug'}, - svelte_preprocessor_tags = { - {name = 'sass', tag = 'lang', as = 'sass'}, - {name = 'coffeescript', tag = 'lang', as = 'coffeescript'}, - {name = 'pug', tag = 'pug', as = 'pug'}, - }, - svelte_indent_script = 0, - svelte_indent_style = 0, -} -for k,v in pairs(globals) do vim.g[k] = v end - -local options = { - clipboard = 'unnamedplus', - inccommand = 'nosplit', - tabstop = 2, - softtabstop = 2, - shiftwidth = 2, - smartindent = true, - list = true, - listchars = 'trail:·,tab: ', - linebreak = true, - formatoptions = 'crql1jn', - synmaxcol = 200, - lazyredraw = true, - scrolloff = 8, - sidescrolloff = 15, - mouse = 'a', - splitright = true, - splitbelow = true, - errorbells = false, - visualbell = true, - backup = false, - writebackup = false, - swapfile = false, - timeout = true, - timeoutlen = 150, - hidden = true, - shortmess = 'filnxToOFIac', - history = 1000, - undofile = true, - undodir = vim.fn.stdpath'data' .. '/undo', - undolevels = 1000, - undoreload = 1000, - spellfile = vim.fn.stdpath'data' .. '/spell/en.utf-8.add', - ignorecase = true, - smartcase = true, - incsearch = true, - wrapscan = true, - hlsearch = true, - foldmethod = 'syntax', - foldlevel = 99, - foldnestmax = 10, - foldlevelstart = 99, - autowrite = false, - autochdir = false, - autoread = true, - modeline = false, - showmode = false, - showcmd = false, - laststatus = 2, - ruler = false, - number = true, -} -for k,v in pairs(options) do - vim.o[k] = v -end - -vim.api.nvim_command'colorscheme donokai' - -function SynGroup() - local s = vim.fn.synID(vim.fn.line('.'), vim.fn.col('.'), 1) - print(vim.fn.synIDattr(s, 'name') .. ' -> ' .. vim.fn.synIDattr(vim.fn.synIDtrans(s), 'name')) -end - -vim.api.nvim_exec([[ -au! TextYankPost * silent! lua vim.highlight.on_yank { higroup='Search', timeout=200 } -au! FileType gitcommit exec 'norm gg' | startinsert! -au! BufNewFile,BufRead *.slimleex set syntax=slime -command! W write -]], true) --- au! VimEnter * COQnow -s - -function NeatFoldText() - -- TODO: finish this! - -- local lines_count = vim.foldend - vim.foldstart + 1 - -- local foldchar = vim.fn.matchstr(vim.fillchars, 'fold:\\zs.') - -- local foldtextstart = vim.fn.strpart('^' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) - -- let foldtextend = printf("%s %".(winwidth(0)-20)."dL", foldtextstart, getline(v:foldstart), lines_count) - -- let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn - -- return printf("%s%d", substitute(getline(v:foldstart), "^.", ">"), lines_count) -end --- set foldtext=NeatFoldText() diff --git a/common/neovim/lua/plugins.lua b/common/neovim/lua/plugins.lua deleted file mode 100644 index b7d5774..0000000 --- a/common/neovim/lua/plugins.lua +++ /dev/null @@ -1,192 +0,0 @@ -local packer_install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' -if #vim.fn.glob(packer_install_path) == 0 then - vim.fn.system { 'git', 'clone', 'https://github.com/wbthomason/packer.nvim', packer_install_path } - vim.api.nvim_command 'packadd packer.nvim' -end - -local has_words_before = function() - local line, col = vim.api.nvim_win_get_cursor(0) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil -end - -local packer = require 'packer' - -packer.startup(function() - local plugins = { - 'wbthomason/packer.nvim', -- neovim plugin manager - - 'vim-scripts/LargeFile', -- degrade gracefully with large files - 'tpope/vim-repeat', -- enable repeat for plugin maps - 'tpope/vim-sleuth', -- use whatever whitespace is in the file - 'editorconfig/editorconfig-vim', -- handle .editorconfig files - 'christoomey/vim-tmux-navigator', -- navigate vim splits and tmux panes fluidly - 'machakann/vim-sandwich', -- edit surrounding characters - 'michaeljsmith/vim-indent-object', -- adds indent-level text objects - -- 'wellle/targets.vim', -- add many other text objects - 'bkad/CamelCaseMotion', -- invaluable motions for properly operating on various casings - - { - -- session management - 'olimorris/persisted.nvim', - config = function() - local should_autoload = #vim.v.argv == 1 - require 'persisted'.setup { - autoload = should_autoload, - autosave = should_autoload, - } - end - }, - { - -- toggle comments - 'terrortylor/nvim-comment', - config = function() - require 'nvim_comment'.setup() - end - }, - { - -- fuzzy finder - 'nvim-telescope/telescope.nvim', - requires = { - 'nvim-lua/popup.nvim', - 'nvim-lua/plenary.nvim', - } - }, - { - 'nvim-telescope/telescope-fzf-native.nvim', - run = 'make', - }, - { - 'tzachar/cmp-fuzzy-path', - requires = { 'hrsh7th/nvim-cmp', 'tzachar/fuzzy.nvim' }, - }, - -- TODO: add keymap ig for toggling these - 'lukas-reineke/indent-blankline.nvim', -- indentation guide lines - 'L3MON4D3/LuaSnip', - - 'neovim/nvim-lspconfig', -- language server configuration helper - 'williamboman/nvim-lsp-installer', -- plugin containing installation commands for many language servers - 'hrsh7th/cmp-nvim-lsp-signature-help', - 'hrsh7th/cmp-nvim-lsp', -- add lsp to completion engine - 'hrsh7th/cmp-buffer', -- add buffer information to completion engine - 'hrsh7th/cmp-path', -- add filesystem information to complete enging - 'hrsh7th/cmp-cmdline', -- add completion for vim commands - 'onsails/lspkind-nvim', - 'saadparwaiz1/cmp_luasnip', - { - -- completion engine - 'hrsh7th/nvim-cmp', - config = function() - local cmp = require 'cmp' - local luasnip = require 'luasnip' - - local prev_item = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end - - local next_item = function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end - - cmp.setup { - snippet = { - expand = function(args) - luasnip.lsp_expand(args.body) - end, - }, - mapping = { - [''] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }), - [''] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - [''] = cmp.config.disable, - [''] = cmp.mapping { - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }, - [''] = cmp.mapping.confirm { select = false }, - [""] = cmp.mapping(next_item, { "i", "s" }), - [""] = cmp.mapping(prev_item, { "i", "s" }), - [''] = cmp.mapping(next_item, { "i", "s" }), - [''] = cmp.mapping(prev_item, { "i", "s" }), - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'nvim_lsp_signature_help' }, - { name = 'luasnip' }, - }, { - { name = 'buffer' }, - { name = 'path' }, - { name = 'fuzzy_path' }, - }), - formatting = { - format = require("lspkind").cmp_format { - with_text = true, - menu = { - nvim_lsp = "[LSP]", - }, - } - }, - } - - cmp.setup.cmdline('/', { - -- mapping = cmp.mapping.preset.cmdline(), - sources = { - { name = 'buffer' }, - { name = 'fuzzy_path' }, - } - }) - - cmp.setup.cmdline(':', { - -- mapping = cmp.mapping.preset.cmdline(), - sources = cmp.config.sources({ - { name = 'path' } - }, { - { name = 'cmdline' } - }) - }) - end, - }, - -- TODO: automate this installation process of :COQdeps:COQnow - -- {'ms-jpq/coq_nvim', branch = 'coq'}, - -- {'ms-jpq/coq.thirdparty', branch = '3p'}, - { - -- syntax highlighting and indentation - 'nvim-treesitter/nvim-treesitter', - run = ':TSUpdate', - config = function() - require 'nvim-treesitter.configs'.setup { - ensure_installed = "all", - sync_install = false, - ignore_install = { "phpdoc" }, - indent = { - enable = true, - }, - highlight = { - enable = true, - disable = {}, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - -- additional_vim_regex_highlighting = false, - }, - } - end - }, - 'lukas-reineke/lsp-format.nvim', - } - for _, plugin in pairs(plugins) do packer.use(plugin) end -end) diff --git a/common/neovim/lua/statusline.lua b/common/neovim/lua/statusline.lua deleted file mode 100644 index 91c18da..0000000 --- a/common/neovim/lua/statusline.lua +++ /dev/null @@ -1,86 +0,0 @@ -local fn = vim.fn -local api = vim.api -local status_line_max_length = 5 - --- TODO: only update this portion when needed instead of every render? -local status_line_buffer_by_num = function(bufnum) - local is_active = false - local bufinfo = fn.getbufinfo(bufnum)[1] - local prefix = ' %#InactiveBuffer#' - local suffix = '%* ' - - if bufinfo.changed == 1 then - prefix = '%#DirtyBuffer# ' - suffix = ' %*' - end - - local windex = fn.index(bufinfo.windows, vim.g.statusline_winid) - if bufinfo.hidden and windex >= 0 then - is_active = true - prefix = '%#ActiveBuffer# ' - suffix = ' %*' - if bufinfo.changed == 1 then - prefix = '%#ActiveDirtyBuffer# *' - suffix = ' %*' - end - end - - return (prefix .. fn.fnamemodify(fn.bufname(bufnum), ':t') .. suffix), is_active -end - -local status_line_buffers = function() - -- TODO: mark buffers with unsaved changes - - local active_index = -1 - local acc = {} - for _,bufnum in ipairs(api.nvim_list_bufs()) do - local bufinfo = fn.getbufinfo(bufnum)[1] - if bufinfo.listed ~= 0 then - local entry, is_active = status_line_buffer_by_num(bufnum) - table.insert(acc, entry) - if is_active then - active_index = #acc - end - end - end - if active_index >= 0 then - -- TODO: instead implement this as a wraparound carousel? - local offset = status_line_max_length / 2 - local min_buf_num = math.max(0, (active_index - offset)) - local max_buf_num = math.min(#acc - 1, min_buf_num + status_line_max_length - 1) - min_buf_num = math.max(0, max_buf_num - status_line_max_length + 1) - local buflist = table.concat({unpack(acc, min_buf_num+1, max_buf_num+1)}, '') - local prefix = '' - local suffix = '' - if min_buf_num > 0 then - prefix = '< ' - end - if max_buf_num < (#acc - 1) then - suffix = ' >' - end - return prefix .. buflist .. suffix - else - local suffix = '' - if #acc - 1 >status_line_max_length then - suffix = ' >' - end - local buflist = table.concat({unpack(acc, 1, math.min(#acc, status_line_max_length))}, '') - return buflist .. suffix .. active_index - end -end - -local whitespace = function() - local result = "" - if vim.o.expandtab == true then - result = result .. vim.o.shiftwidth .. "S" - else - result = result .. vim.o.tabstop .. "T" - end - return result -end - -function StatusLine() - return status_line_buffers() .. '%*%=%{&filetype} %l;%c (%p%%/%L) ' .. whitespace() -end - -vim.o.statusline = '%!v:lua.StatusLine()' -- 2.44.1 From cc386f92c9c70afd1bf349190e8f04af4395f7aa Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Mon, 13 Jun 2022 23:46:09 -0500 Subject: [PATCH 6/7] Coming soon! --- common/neovim/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/neovim/init.lua b/common/neovim/init.lua index f5a9e07..9ee8a7b 100644 --- a/common/neovim/init.lua +++ b/common/neovim/init.lua @@ -261,7 +261,7 @@ local options = { laststatus = 2, ruler = false, number = true, - -- cmdheight = 0, + -- cmdheight = 0, -- TODO: coming soon! } for k, v in pairs(options) do vim.o[k] = v -- 2.44.1 From bc046ff484c03397222cd6f1bc8b68db3de65e32 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Tue, 14 Jun 2022 14:54:53 -0500 Subject: [PATCH 7/7] LSP --- common/neovim/init.lua | 46 ++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/common/neovim/init.lua b/common/neovim/init.lua index 9ee8a7b..0cbb3e5 100644 --- a/common/neovim/init.lua +++ b/common/neovim/init.lua @@ -166,6 +166,7 @@ packer.startup(function() 'hrsh7th/cmp-path', -- add filesystem information to complete enging 'hrsh7th/cmp-cmdline', -- add completion for vim commands 'onsails/lspkind-nvim', + 'simrat39/symbols-outline.nvim', 'saadparwaiz1/cmp_luasnip', -- TODO: automate this installation process of :COQdeps:COQnow -- {'ms-jpq/coq_nvim', branch = 'coq'}, @@ -272,7 +273,7 @@ vim.api.nvim_command 'colorscheme donokai' function SynGroup() local s = vim.fn.synID(vim.fn.line('.'), vim.fn.col('.'), 1) -- TODO: instead of printing, put it in a popup? virtual text? - print(vim.fn.synIDattr(s, 'name') .. ' -> ' .. vim.fn.synIDattr(vim.fn.synIDtrans(s), 'name')) + print(s .. ': ' .. vim.fn.synIDattr(s, 'name') .. ' -> ' .. vim.fn.synIDattr(vim.fn.synIDtrans(s), 'name')) end vim.api.nvim_create_autocmd("TextYankPost", { @@ -324,12 +325,22 @@ local keymap = { ['k'] = { ':bnext', m.s }, ['j'] = { ':bprevious', m.s }, + + ['s'] = "SessionToggleecho 'Persisting Session: ' .. g:persisting .. ' (' .. getcwd() .. ')'", + ['S'] = "SessionSaveecho 'Saved Session: ' .. getcwd()", + ['l'] = "SessionLoadecho 'Loaded Session: ' .. getcwd()", + ['L'] = "SessionLoadLastecho 'Loaded Last Session: ' .. getcwd()", + ['d'] = "SessionDeleteecho 'Deleted Session for cwd: ' .. getcwd()", + + ['t'] = 'Telescope help_tags', + + ['m'] = 'lua SynGroup()', + [''] = ':qa', [''] = 'Telescope git_files', [''] = 'Telescope live_grep', [''] = 'Telescope buffers', - ['t'] = 'Telescope help_tags', [''] = ':TmuxNavigateLeft', [''] = ':TmuxNavigateDown', @@ -338,13 +349,6 @@ local keymap = { [' n'] = "'Nn'[v:searchforward]", [' N'] = "'nN'[v:searchforward]", - [''] = ':lua SynGroup()', - - ['s'] = "SessionToggleecho 'Persisting Session: ' .. g:persisting .. ' (' .. getcwd() .. ')'", - ['S'] = "SessionSaveecho 'Saved Session: ' .. getcwd()", - ['l'] = "SessionLoadecho 'Loaded Session: ' .. getcwd()", - ['L'] = "SessionLoadLastecho 'Loaded Last Session: ' .. getcwd()", - ['d'] = "SessionDeleteecho 'Deleted Session for cwd: ' .. getcwd()", }, -- terminal bindings @@ -514,7 +518,14 @@ chmod +x $els_path/elixir-ls/language_server.sh ]] -- local lsp_configs = { - gopls = {}, + ansiblels = {}, + bashls = {}, + clangd = {}, + denols = { + root_dir = lsp.util.root_pattern("deno.json"), + }, + diagnosticls = {}, + dockerls = {}, elixirls = { cmd = { vim.fn.expand '~/.local/share/nvim/lsp_servers/elixir/elixir-ls/language_server.sh' }, settings = { @@ -524,6 +535,13 @@ local lsp_configs = { } } }, + gopls = {}, + nimls = {}, + openscad_ls = {}, + pylsp = {}, + rnix = {}, + rust_analyzer = {}, + sqlls = {}, sumneko_lua = { settings = { Lua = { @@ -533,13 +551,11 @@ local lsp_configs = { } } }, + terraform_lsp = {}, + tflint = {}, vimls = {}, - rust_analyzer = {}, -- tsserver = {}, - pylsp = {}, - denols = { - root_dir = lsp.util.root_pattern("deno.json"), - }, + yamlls = {}, } local capabilities = require 'cmp_nvim_lsp'.update_capabilities(vim.lsp.protocol.make_client_capabilities()) -- 2.44.1