Mercurial > dotfiles
comparison dot_config/nvim/config.lua @ 336:7a8b66395d69
Add floating terminal to be toggled via c-z
author | zegervdv <zegervdv@me.com> |
---|---|
date | Thu, 21 Jan 2021 09:17:28 +0100 |
parents | cd9a31235699 |
children | e89bdbc1a2dd |
comparison
equal
deleted
inserted
replaced
335:cd9a31235699 | 336:7a8b66395d69 |
---|---|
110 use {'zegervdv/nvcode-color-schemes.vim'} | 110 use {'zegervdv/nvcode-color-schemes.vim'} |
111 | 111 |
112 end) | 112 end) |
113 end | 113 end |
114 | 114 |
115 -- This came from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/lsp_config.lua | |
116 local mapper = function(mode, key, result, noremap) | |
117 if noremap == nil then | |
118 noremap = true | |
119 end | |
120 vim.fn.nvim_buf_set_keymap(0, mode, key, result, {noremap=noremap, silent=true}) | |
121 end | |
122 | |
123 -- Terminal | |
124 mapper('n', '<c-z>', '<cmd>lua require"terminal".toggle()<CR>') | |
125 -- mapper('t', '<c-z>', '<C-\\><C-n><cmd>lua require"terminal".toggle()<CR>') | |
126 vim.cmd "tnoremap <silent> <c-z> <c-\\><c-n>:lua require'terminal'.toggle()<CR>" | |
127 | |
128 -- LSP and Treesitter config | |
115 | 129 |
116 local lsp = require'lspconfig' | 130 local lsp = require'lspconfig' |
117 local lsputil = require'lspconfig.util' | 131 local lsputil = require'lspconfig.util' |
118 | 132 |
119 require "nvim-treesitter.highlight" | 133 require "nvim-treesitter.highlight" |
244 require'completion'.on_attach({ | 258 require'completion'.on_attach({ |
245 sorting = 'alphabet', | 259 sorting = 'alphabet', |
246 matching_strategy_list = {'exact', 'fuzzy'}, | 260 matching_strategy_list = {'exact', 'fuzzy'}, |
247 chain_complete_list = chain_complete_list, | 261 chain_complete_list = chain_complete_list, |
248 }) | 262 }) |
249 -- This came from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/lsp_config.lua | |
250 local mapper = function(mode, key, result, noremap) | |
251 if noremap == nil then | |
252 noremap = true | |
253 end | |
254 vim.fn.nvim_buf_set_keymap(0, mode, key, result, {noremap=noremap, silent=true}) | |
255 end | |
256 | 263 |
257 mapper('n', '<CR>', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({show_header=false})<CR>') | 264 mapper('n', '<CR>', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics({show_header=false})<CR>') |
258 mapper('n', 'gd', '<cmd>lua vim.lsp.buf.declaration()<CR>') | 265 mapper('n', 'gd', '<cmd>lua vim.lsp.buf.declaration()<CR>') |
259 mapper('n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>') | 266 mapper('n', '<c-]>', '<cmd>lua vim.lsp.buf.definition()<CR>') |
260 mapper('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>') | 267 mapper('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>') |