summaryrefslogtreecommitdiff
path: root/.config/nvim/lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua')
-rw-r--r--.config/nvim/lua/_compe/init.lua70
-rw-r--r--.config/nvim/lua/_telescope/init.lua83
-rw-r--r--.config/nvim/lua/bufferline/init.lua28
-rw-r--r--.config/nvim/lua/colorizer/init.lua (renamed from .config/nvim/lua/plug-colorizer.lua)0
-rw-r--r--.config/nvim/lua/galaxyline/init.lua (renamed from .config/nvim/lua/statusline.lua)0
-rw-r--r--.config/nvim/lua/lightbulb/init.lua36
-rw-r--r--.config/nvim/lua/lsp/bash.lua2
-rw-r--r--.config/nvim/lua/lsp/docker.lua2
-rw-r--r--.config/nvim/lua/lsp/general.lua15
-rw-r--r--.config/nvim/lua/lsp/json.lua10
-rw-r--r--.config/nvim/lua/lsp/lsp-config.lua4
-rw-r--r--.config/nvim/lua/lsp/lsp-kind.lua26
-rw-r--r--.config/nvim/lua/lsp/lua.lua37
-rw-r--r--.config/nvim/lua/lsp/python.lua2
-rw-r--r--.config/nvim/lua/lsp/vim.lua2
-rw-r--r--.config/nvim/lua/lsp/wrapper.lua129
-rw-r--r--.config/nvim/lua/lsp/yaml.lua2
-rw-r--r--.config/nvim/lua/nvimtree/init.lua31
-rw-r--r--.config/nvim/lua/treesitter/init.lua (renamed from .config/nvim/lua/treesitter.lua)0
19 files changed, 479 insertions, 0 deletions
diff --git a/.config/nvim/lua/_compe/init.lua b/.config/nvim/lua/_compe/init.lua
new file mode 100644
index 0000000..d269be4
--- /dev/null
+++ b/.config/nvim/lua/_compe/init.lua
@@ -0,0 +1,70 @@
+require'compe'.setup {
+ enabled = true;
+ autocomplete = true;
+ debug = false;
+ min_length = 1;
+ preselect = 'enable';
+ throttle_time = 80;
+ source_timeout = 200;
+ incomplete_delay = 400;
+ max_abbr_width = 100;
+ max_kind_width = 100;
+ max_menu_width = 100;
+ documentation = true;
+
+ source = {
+ path = true;
+ buffer = true;
+ calc = true;
+ vsnip = true;
+ nvim_lsp = true;
+ nvim_lua = true;
+ spell = true;
+ tags = true;
+ snippets_nvim = true;
+ treesitter = true;
+ };
+}
+
+
+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 "<C-n>"
+ elseif vim.fn.call("vsnip#available", {1}) == 1 then
+ return t "<Plug>(vsnip-expand-or-jump)"
+ elseif check_back_space() then
+ return t "<Tab>"
+ else
+ return vim.fn['compe#complete']()
+ end
+end
+_G.s_tab_complete = function()
+ if vim.fn.pumvisible() == 1 then
+ return t "<C-p>"
+ elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
+ return t "<Plug>(vsnip-jump-prev)"
+ else
+ return t "<S-Tab>"
+ end
+end
+
+vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
+vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
+vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
+vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
diff --git a/.config/nvim/lua/_telescope/init.lua b/.config/nvim/lua/_telescope/init.lua
new file mode 100644
index 0000000..4dfa57f
--- /dev/null
+++ b/.config/nvim/lua/_telescope/init.lua
@@ -0,0 +1,83 @@
+local actions = require('telescope.actions')
+-- Global remapping
+------------------------------
+-- '--color=never',
+require('telescope').load_extension('media_files')
+require('telescope').setup {
+ defaults = {
+ vimgrep_arguments = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
+ prompt_position = "top",
+ prompt_prefix = " ",
+ selection_caret = " ",
+ entry_prefix = " ",
+ initial_mode = "insert",
+ selection_strategy = "reset",
+ sorting_strategy = "descending",
+ layout_strategy = "horizontal",
+ layout_defaults = {horizontal = {mirror = false}, vertical = {mirror = false}},
+ file_sorter = require'telescope.sorters'.get_fuzzy_file,
+ file_ignore_patterns = {},
+ generic_sorter = require'telescope.sorters'.get_generic_fuzzy_sorter,
+ shorten_path = true,
+ winblend = 0,
+ width = 0.75,
+ preview_cutoff = 120,
+ results_height = 1,
+ results_width = 0.8,
+ border = {},
+ borderchars = {
+ { '─', '│', '─', '│', '┌', '┐', '┘', '└'},
+ prompt = {"─", "│", " ", "│", '┌', '┐', "│", "│"},
+ results = {"─", "│", "─", "│", "├", "┤", "┘", "└"},
+ preview = { '─', '│', '─', '│', '┌', '┐', '┘', '└'},
+ },
+ color_devicons = true,
+ use_less = true,
+ set_env = {['COLORTERM'] = 'truecolor'}, -- default = nil,
+ file_previewer = require'telescope.previewers'.vim_buffer_cat.new,
+ grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new,
+ qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new,
+
+ -- Developer configurations: Not meant for general override
+ buffer_previewer_maker = require'telescope.previewers'.buffer_previewer_maker,
+ mappings = {
+ i = {
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous,
+ -- To disable a keymap, put [map] = false
+ -- So, to not map "<C-n>", just put
+ -- ["<c-x>"] = false,
+
+ -- Otherwise, just set the mapping to the function that you want it to be.
+ -- ["<C-i>"] = actions.select_horizontal,
+
+ -- Add up multiple actions
+ ["<CR>"] = actions.select_default + actions.center
+
+ -- You can perform as many actions in a row as you like
+ -- ["<CR>"] = actions.select_default + actions.center + my_cool_custom_action,
+ },
+ n = {
+ ["<C-j>"] = actions.move_selection_next,
+ ["<C-k>"] = actions.move_selection_previous
+ -- ["<esc>"] = actions.close,
+ -- ["<C-i>"] = my_cool_custom_action,
+ }
+ }
+ },
+ require'telescope'.setup {
+ extensions = {
+ media_files = {
+ -- filetypes whitelist
+ -- defaults to {"png", "jpg", "mp4", "webm", "pdf"}
+ filetypes = {"png", "webp", "jpg", "jpeg"},
+ find_cmd = "rg" -- find command (defaults to `fd`)
+ }
+ }
+ }
+}
+
+vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>lua require("telescope.builtin").find_files()<cr>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>fg', '<cmd>lua require("telescope.builtin").live_grep()<cr>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>fb', '<cmd>lua require("telescope.builtin").buffers()<cr>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>lua require("telescope.builtin").help_tags()<cr>', { noremap = true, silent = true })
diff --git a/.config/nvim/lua/bufferline/init.lua b/.config/nvim/lua/bufferline/init.lua
new file mode 100644
index 0000000..ab7ecae
--- /dev/null
+++ b/.config/nvim/lua/bufferline/init.lua
@@ -0,0 +1,28 @@
+require'bufferline'.setup{
+ options = {
+ view = "default",
+ numbers = "none",
+ number_style = "superscript",
+ mappings = false,
+ buffer_close_icon= '',
+ modified_icon = '●',
+ close_icon = '',
+ left_trunc_marker = '',
+ right_trunc_marker = '',
+ max_name_length = 18,
+ max_prefix_length = 15, -- prefix used when a buffer is deduplicated
+ tab_size = 18,
+ diagnostics = "nvim_lsp",
+ show_buffer_close_icons = true,
+ show_tab_indicators = true,
+ persist_buffer_sort = true, -- whether or not custom sorted buffers should persist
+ -- can also be a table containing 2 custom separators
+ -- [focused and unfocused]. eg: { '|', '|' }
+ separator_style = "thin",
+ enforce_regular_tabs = false,
+ always_show_bufferline = true,
+ sort_by = 'relative_directory'
+ }
+}
+vim.api.nvim_set_keymap('n', '<TAB>', ':BufferLineCycleNext<CR>', { noremap = true, silent = true })
+vim.api.nvim_set_keymap('n', '<S-TAB>', ':BufferLineCyclePrev<CR>', { noremap = true, silent = true })
diff --git a/.config/nvim/lua/plug-colorizer.lua b/.config/nvim/lua/colorizer/init.lua
index 1e25d7d..1e25d7d 100644
--- a/.config/nvim/lua/plug-colorizer.lua
+++ b/.config/nvim/lua/colorizer/init.lua
diff --git a/.config/nvim/lua/statusline.lua b/.config/nvim/lua/galaxyline/init.lua
index 44801cf..44801cf 100644
--- a/.config/nvim/lua/statusline.lua
+++ b/.config/nvim/lua/galaxyline/init.lua
diff --git a/.config/nvim/lua/lightbulb/init.lua b/.config/nvim/lua/lightbulb/init.lua
new file mode 100644
index 0000000..1469c5b
--- /dev/null
+++ b/.config/nvim/lua/lightbulb/init.lua
@@ -0,0 +1,36 @@
+-- Showing defaults
+require'nvim-lightbulb'.update_lightbulb {
+ sign = {
+ enabled = true,
+ -- Priority of the gutter sign
+ priority = 10,
+ },
+ float = {
+ enabled = false,
+ -- Text to show in the popup float
+ text = "💡",
+ -- Available keys for window options:
+ -- - height of floating window
+ -- - width of floating window
+ -- - wrap_at character to wrap at for computing height
+ -- - max_width maximal width of floating window
+ -- - max_height maximal height of floating window
+ -- - pad_left number of columns to pad contents at left
+ -- - pad_right number of columns to pad contents at right
+ -- - pad_top number of lines to pad contents at top
+ -- - pad_bottom number of lines to pad contents at bottom
+ -- - offset_x x-axis offset of the floating window
+ -- - offset_y y-axis offset of the floating window
+ -- - anchor corner of float to place at the cursor (NW, NE, SW, SE)
+ -- - winblend transparency of the window (0-100)
+ win_opts = {},
+ },
+ virtual_text = {
+ enabled = false,
+ -- Text to show at virtual text
+ text = "💡",
+ }
+}
+
+
+vim.cmd [[autocmd CursorHold,CursorHoldI * lua require'nvim-lightbulb'.update_lightbulb()]]
diff --git a/.config/nvim/lua/lsp/bash.lua b/.config/nvim/lua/lsp/bash.lua
new file mode 100644
index 0000000..8be0383
--- /dev/null
+++ b/.config/nvim/lua/lsp/bash.lua
@@ -0,0 +1,2 @@
+-- npm i -g bash-language-server
+require'lspconfig'.bashls.setup{}
diff --git a/.config/nvim/lua/lsp/docker.lua b/.config/nvim/lua/lsp/docker.lua
new file mode 100644
index 0000000..ad6e220
--- /dev/null
+++ b/.config/nvim/lua/lsp/docker.lua
@@ -0,0 +1,2 @@
+-- npm install -g dockerfile-language-server-nodejs
+require'lspconfig'.dockerls.setup{}
diff --git a/.config/nvim/lua/lsp/general.lua b/.config/nvim/lua/lsp/general.lua
new file mode 100644
index 0000000..fa28dbc
--- /dev/null
+++ b/.config/nvim/lua/lsp/general.lua
@@ -0,0 +1,15 @@
+require"lspconfig".efm.setup {
+ init_options = {documentFormatting = true},
+ filetypes = {"lua"},
+ settings = {
+ rootMarkers = {".git/"},
+ languages = {
+ lua = {
+ {
+ formatCommand = "lua-format -i --no-keep-simple-function-one-line --no-break-after-operator --column-limit=150 --break-after-table-lb",
+ formatStdin = true
+ }
+ }
+ }
+ }
+}
diff --git a/.config/nvim/lua/lsp/json.lua b/.config/nvim/lua/lsp/json.lua
new file mode 100644
index 0000000..d13fed3
--- /dev/null
+++ b/.config/nvim/lua/lsp/json.lua
@@ -0,0 +1,10 @@
+-- npm install -g vscode-json-languageserver
+require'lspconfig'.jsonls.setup {
+ commands = {
+ Format = {
+ function()
+ vim.lsp.buf.range_formatting({},{0,0},{vim.fn.line("$"),0})
+ end
+ }
+ }
+}
diff --git a/.config/nvim/lua/lsp/lsp-config.lua b/.config/nvim/lua/lsp/lsp-config.lua
new file mode 100644
index 0000000..fe5dfb7
--- /dev/null
+++ b/.config/nvim/lua/lsp/lsp-config.lua
@@ -0,0 +1,4 @@
+vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
+vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
+vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
+vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
diff --git a/.config/nvim/lua/lsp/lsp-kind.lua b/.config/nvim/lua/lsp/lsp-kind.lua
new file mode 100644
index 0000000..de928c2
--- /dev/null
+++ b/.config/nvim/lua/lsp/lsp-kind.lua
@@ -0,0 +1,26 @@
+-- commented options are defaults
+require('lspkind').init({
+ with_text = false,
+ symbol_map = {
+ Text = '  ',
+ Method = '  ',
+ Function = '  ',
+ Constructor = '  ',
+ Variable = '[]',
+ Class = '  ',
+ Interface = ' 蘒',
+ Module = '  ',
+ Property = '  ',
+ Unit = ' 塞 ',
+ Value = '  ',
+ Enum = ' 練',
+ Keyword = '  ',
+ Snippet = '  ',
+ Color = '',
+ File = '',
+ Folder = ' ﱮ ',
+ EnumMember = '  ',
+ Constant = '  ',
+ Struct = '  '
+ },
+})
diff --git a/.config/nvim/lua/lsp/lua.lua b/.config/nvim/lua/lsp/lua.lua
new file mode 100644
index 0000000..c04219a
--- /dev/null
+++ b/.config/nvim/lua/lsp/lua.lua
@@ -0,0 +1,37 @@
+-- https://github.com/sumneko/lua-language-server/wiki/Build-and-Run-(Standalone)
+USER = vim.fn.expand('$USER')
+
+local sumneko_root_path = ""
+local sumneko_binary = ""
+
+if vim.fn.has("mac") == 1 then
+ sumneko_root_path = "/Users/" .. USER .. "/.config/nvim/lua-language-server"
+ sumneko_binary = "/Users/" .. USER .. "/.config/nvim/lua-language-server/bin/macOS/lua-language-server"
+elseif vim.fn.has("unix") == 1 then
+ sumneko_root_path = "/home/" .. USER .. "/.config/nvim/lua-language-server"
+ sumneko_binary = "/home/" .. USER .. "/.config/nvim/lua-language-server/bin/Linux/lua-language-server"
+else
+ print("Unsupported system for sumneko")
+end
+
+require'lspconfig'.sumneko_lua.setup {
+ cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
+ settings = {
+ Lua = {
+ runtime = {
+ -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
+ version = 'LuaJIT',
+ -- Setup your lua path
+ path = vim.split(package.path, ';')
+ },
+ diagnostics = {
+ -- Get the language server to recognize the `vim` global
+ globals = {'vim'}
+ },
+ workspace = {
+ -- Make the server aware of Neovim runtime files
+ library = {[vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true}
+ }
+ }
+ }
+}
diff --git a/.config/nvim/lua/lsp/python.lua b/.config/nvim/lua/lsp/python.lua
new file mode 100644
index 0000000..11eeef9
--- /dev/null
+++ b/.config/nvim/lua/lsp/python.lua
@@ -0,0 +1,2 @@
+-- npm i -g pyright
+require'lspconfig'.pyright.setup{}
diff --git a/.config/nvim/lua/lsp/vim.lua b/.config/nvim/lua/lsp/vim.lua
new file mode 100644
index 0000000..a7555c6
--- /dev/null
+++ b/.config/nvim/lua/lsp/vim.lua
@@ -0,0 +1,2 @@
+-- npm install -g vim-language-server
+require'lspconfig'.vimls.setup{}
diff --git a/.config/nvim/lua/lsp/wrapper.lua b/.config/nvim/lua/lsp/wrapper.lua
new file mode 100644
index 0000000..7f3647c
--- /dev/null
+++ b/.config/nvim/lua/lsp/wrapper.lua
@@ -0,0 +1,129 @@
+local lsp_wrapper = {}
+
+-- buf
+
+function lsp_wrapper.add_to_workspace_folder()
+ vim.lsp.buf.add_workspace_folder()
+end
+
+function lsp_wrapper.clear_references()
+ vim.lsp.buf.clear_references()
+end
+
+function lsp_wrapper.code_action()
+ vim.lsp.buf.code_action()
+end
+
+function lsp_wrapper.declaration()
+ vim.lsp.buf.declaration()
+ vim.lsp.buf.clear_references()
+end
+
+function lsp_wrapper.definition()
+ vim.lsp.buf.definition()
+ vim.lsp.buf.clear_references()
+end
+
+function lsp_wrapper.document_highlight()
+ vim.lsp.buf.document_highlight()
+end
+
+function lsp_wrapper.document_symbol()
+ vim.lsp.buf.document_symbol()
+end
+
+function lsp_wrapper.formatting()
+ vim.lsp.buf.formatting()
+end
+
+function lsp_wrapper.formatting_sync()
+ vim.lsp.buf.formatting_sync()
+end
+
+function lsp_wrapper.hover()
+ vim.lsp.buf.hover()
+end
+
+function lsp_wrapper.implementation()
+ vim.lsp.buf.implementation()
+end
+
+function lsp_wrapper.incoming_calls()
+ vim.lsp.buf.incoming_calls()
+end
+
+function lsp_wrapper.list_workspace_folders()
+ vim.lsp.buf.list_workspace_folders()
+end
+
+function lsp_wrapper.outgoing_calls()
+ vim.lsp.buf.outgoing_calls()
+end
+
+function lsp_wrapper.range_code_action()
+ vim.lsp.buf.range_code_action()
+end
+
+function lsp_wrapper.range_formatting()
+ vim.lsp.buf.range_formatting()
+end
+
+function lsp_wrapper.references()
+ vim.lsp.buf.references()
+ vim.lsp.buf.clear_references()
+end
+
+function lsp_wrapper.remove_workspace_folder()
+ vim.lsp.buf.remove_workspace_folder()
+end
+
+function lsp_wrapper.rename()
+ vim.lsp.buf.rename()
+end
+
+function lsp_wrapper.signature_help()
+ vim.lsp.buf.signature_help()
+end
+
+function lsp_wrapper.type_definition()
+ vim.lsp.buf.type_definition()
+end
+
+function lsp_wrapper.workspace_symbol()
+ vim.lsp.buf.workspace_symbol()
+end
+
+-- diagnostic
+
+function lsp_wrapper.get_all()
+ vim.lsp.diagnostic.get_all()
+end
+
+function lsp_wrapper.get_next()
+ vim.lsp.diagnostic.get_next()
+end
+
+function lsp_wrapper.get_prev()
+ vim.lsp.diagnostic.get_prev()
+end
+
+function lsp_wrapper.goto_next()
+ vim.lsp.diagnostic.goto_next()
+end
+
+function lsp_wrapper.goto_prev()
+ vim.lsp.diagnostic.goto_prev()
+end
+
+function lsp_wrapper.show_line_diagnostics()
+ vim.lsp.diagnostic.show_line_diagnostics()
+end
+
+-- misc
+
+-- :lua print(vim.inspect(vim.lsp.buf_get_clients()))
+
+-- autoformat
+-- autocmd BufWritePre *.rs lua vim.lsp.buf.formatting_sync(nil, 1000)
+
+return lsp_wrapper
diff --git a/.config/nvim/lua/lsp/yaml.lua b/.config/nvim/lua/lsp/yaml.lua
new file mode 100644
index 0000000..904f20e
--- /dev/null
+++ b/.config/nvim/lua/lsp/yaml.lua
@@ -0,0 +1,2 @@
+-- npm install -g yaml-language-server
+require'lspconfig'.yamlls.setup{}
diff --git a/.config/nvim/lua/nvimtree/init.lua b/.config/nvim/lua/nvimtree/init.lua
new file mode 100644
index 0000000..3803765
--- /dev/null
+++ b/.config/nvim/lua/nvimtree/init.lua
@@ -0,0 +1,31 @@
+local tree_cb = require'nvim-tree.config'.nvim_tree_callback
+vim.g.nvim_tree_bindings = {
+ -- mappings
+ ["<CR>"] = tree_cb("edit"),
+ ["l"] = tree_cb("edit"),
+ ["o"] = tree_cb("edit"),
+ ["<2-LeftMouse>"] = tree_cb("edit"),
+ ["<2-RightMouse>"] = tree_cb("cd"),
+ ["<C-]>"] = tree_cb("cd"),
+ ["v"] = tree_cb("vsplit"),
+ ["s"] = tree_cb("split"),
+ ["<C-t>"] = tree_cb("tabnew"),
+ ["h"] = tree_cb("close_node"),
+ ["<BS>"] = tree_cb("close_node"),
+ ["<S-CR>"] = tree_cb("close_node"),
+ ["<Tab>"] = tree_cb("preview"),
+ ["I"] = tree_cb("toggle_ignored"),
+ ["H"] = tree_cb("toggle_dotfiles"),
+ ["R"] = tree_cb("refresh"),
+ ["a"] = tree_cb("create"),
+ ["d"] = tree_cb("remove"),
+ ["r"] = tree_cb("rename"),
+ ["<C-r>"] = tree_cb("full_rename"),
+ ["x"] = tree_cb("cut"),
+ ["c"] = tree_cb("copy"),
+ ["p"] = tree_cb("paste"),
+ ["[c"] = tree_cb("prev_git_item"),
+ ["]c"] = tree_cb("next_git_item"),
+ ["-"] = tree_cb("dir_up"),
+ ["q"] = tree_cb("close")
+}
diff --git a/.config/nvim/lua/treesitter.lua b/.config/nvim/lua/treesitter/init.lua
index d202a9f..d202a9f 100644
--- a/.config/nvim/lua/treesitter.lua
+++ b/.config/nvim/lua/treesitter/init.lua