2023-07-28 14:26:18 +00:00
|
|
|
(let
|
|
|
|
[cmp (require :cmp)
|
|
|
|
luasnip (require :luasnip)
|
|
|
|
]
|
2023-07-28 14:38:06 +00:00
|
|
|
{:options (fn []
|
|
|
|
(set vim.o.termguicolors true)
|
|
|
|
(set vim.o.mouse :a)
|
|
|
|
(set vim.o.clipboard :unnamedplus)
|
2023-07-28 22:48:46 +00:00
|
|
|
(set vim.o.wrap false)
|
2023-07-29 13:10:39 +00:00
|
|
|
(set vim.opt.colorcolumn "80,120")
|
2023-07-28 14:38:06 +00:00
|
|
|
(vim.cmd.colorscheme :everforest))
|
2023-07-28 14:26:18 +00:00
|
|
|
|
2023-07-28 14:38:06 +00:00
|
|
|
:keymap (fn []
|
|
|
|
(let [nmap #(vim.keymap.set [:n] $1 $2 {:desc $3})]
|
|
|
|
(nmap "<Tab>" ":bnext<CR>" "Next Buffer")
|
|
|
|
(nmap "<S-Tab>" ":bprevious<CR>" "Previous Buffer")
|
|
|
|
(nmap "<C-X>" ":write|bdelete<CR>" "Save and delete buffer")
|
|
|
|
(nmap "<C-P>" ":Telescope find_files<CR>" "Telescope find_files")
|
|
|
|
(nmap "<C-F>" ":Telescope live_grep<CR>" "Telescope live_grep")
|
|
|
|
(nmap "<C-B>" ":Telescope buffers<CR>" "Telescope buffers")
|
|
|
|
(nmap "<C-T>" ":Telescope treesitter<CR>" "Telescope treesitter")))
|
2023-07-28 14:26:18 +00:00
|
|
|
|
2023-07-28 14:47:02 +00:00
|
|
|
:treesitter-languages
|
|
|
|
[:c :lua :vim :vimdoc :query ; required
|
|
|
|
:fennel] ; add new languages here
|
|
|
|
|
2023-07-28 14:26:18 +00:00
|
|
|
:language-servers
|
|
|
|
{:lua_ls {:filetypes [:lua]
|
|
|
|
:Lua
|
2023-07-29 13:10:39 +00:00
|
|
|
{:workspace {:checkThirdParty false}}
|
2023-07-28 14:26:18 +00:00
|
|
|
:telemetry {:enable false}
|
|
|
|
:diagnostics {:globals
|
|
|
|
[:vim
|
|
|
|
]}}
|
|
|
|
:fennel_language_server {:filetypes [:fennel]
|
|
|
|
:fennel
|
|
|
|
{:workspace {:library (vim.api.nvim_list_runtime_paths)}
|
|
|
|
:diagnostics {:globals
|
|
|
|
[:vim
|
|
|
|
]}}}
|
|
|
|
:bashls {:filetypes [:bash]}}
|
2023-07-28 14:38:06 +00:00
|
|
|
|
2023-07-28 14:26:18 +00:00
|
|
|
:lsp-attach (fn [_ bufnr]
|
|
|
|
(let
|
|
|
|
[nmap #(vim.keymap.set :n $1 $2 {:buffer bufnr :desc (.. "LSP: " $3)})
|
|
|
|
telescope (require :telescope.builtin)
|
|
|
|
]
|
|
|
|
(nmap :gd vim.lsp.buf.definition "[G]o to [D]efiniton")
|
|
|
|
(nmap :gr telescope.lsp_references "[G]o to [R]eferences")
|
|
|
|
(nmap :gI vim.lsp.buf.implementation "[G]o to [I]mplementation")
|
|
|
|
(vim.api.nvim_buf_create_user_command bufnr "Format"
|
|
|
|
#(vim.lsp.buf.format)
|
|
|
|
"Format current buffer with LSP")))
|
2023-07-28 14:47:02 +00:00
|
|
|
|
|
|
|
:cmp-mapping
|
|
|
|
{:<C-j> (cmp.mapping.select_next_item)
|
|
|
|
:<C-k> (cmp.mapping.select_prev_item)
|
|
|
|
:<C-d> (cmp.mapping.scroll_docs -4)
|
|
|
|
:<C-f> (cmp.mapping.scroll_docs 4)
|
|
|
|
:<C-Space> (cmp.mapping.complete)
|
|
|
|
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Replace :select true})
|
|
|
|
:<Tab> (cmp.mapping (fn [fallback]
|
|
|
|
(if (cmp.visible) (cmp.select_prev_item)
|
|
|
|
(luasnip.expand_or_locally_jumpable) (luasnip.expand_or_jump)
|
|
|
|
(fallback))) [:i :s])
|
|
|
|
:<S-Tab> (cmp.mapping (fn [fallback]
|
|
|
|
(if (cmp.visible) (cmp.select_prev_item)
|
|
|
|
(luasnip.locally_jumpable -1) (luasnip.jump -1)
|
|
|
|
(fallback))) [:i :s])}})
|