Add trouble keymap
This commit is contained in:
parent
e115f6e8d6
commit
91aa6f9c8a
@ -36,10 +36,10 @@ require "paq" {
|
|||||||
"kylechui/nvim-surround";
|
"kylechui/nvim-surround";
|
||||||
"windwp/nvim-autopairs";
|
"windwp/nvim-autopairs";
|
||||||
"numToStr/Comment.nvim";
|
"numToStr/Comment.nvim";
|
||||||
{"phaazon/hop.nvim", branch="v2"};
|
{ "phaazon/hop.nvim", branch = "v2" };
|
||||||
|
|
||||||
-- Fuzzy search
|
-- Fuzzy search
|
||||||
{"nvim-telescope/telescope-fzf-native.nvim", run="gmake"};
|
{ "nvim-telescope/telescope-fzf-native.nvim", run = "gmake" };
|
||||||
"nvim-telescope/telescope-file-browser.nvim";
|
"nvim-telescope/telescope-file-browser.nvim";
|
||||||
"nvim-telescope/telescope.nvim";
|
"nvim-telescope/telescope.nvim";
|
||||||
"folke/trouble.nvim";
|
"folke/trouble.nvim";
|
||||||
@ -65,18 +65,18 @@ require('nvim-surround').setup()
|
|||||||
require('Comment').setup()
|
require('Comment').setup()
|
||||||
require('dapui').setup()
|
require('dapui').setup()
|
||||||
require('gitsigns').setup()
|
require('gitsigns').setup()
|
||||||
require("trouble").setup()
|
require("trouble").setup {}
|
||||||
require('nvim-autopairs').setup({
|
require('nvim-autopairs').setup({
|
||||||
fast_wrap = {},
|
fast_wrap = {},
|
||||||
})
|
})
|
||||||
|
|
||||||
require 'colorizer'.setup {
|
require 'colorizer'.setup {
|
||||||
filetypes = {
|
filetypes = {
|
||||||
'css',
|
'css',
|
||||||
'javascript',
|
'javascript',
|
||||||
scss = { rgb_fn = true; };
|
scss = { rgb_fn = true; };
|
||||||
html = { mode = 'foreground'; }
|
html = { mode = 'foreground'; }
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
require('lualine').setup {
|
require('lualine').setup {
|
||||||
@ -89,9 +89,9 @@ require('lualine').setup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
require('toggleterm').setup({
|
require('toggleterm').setup({
|
||||||
open_mapping = '<C-g>',
|
open_mapping = '<C-g>',
|
||||||
direction = 'horizontal',
|
direction = 'horizontal',
|
||||||
shade_terminals = true
|
shade_terminals = true
|
||||||
})
|
})
|
||||||
|
|
||||||
require("gruvbox").setup {
|
require("gruvbox").setup {
|
||||||
@ -103,15 +103,15 @@ require("gruvbox").setup {
|
|||||||
local o = vim.opt
|
local o = vim.opt
|
||||||
|
|
||||||
-- basic settings
|
-- basic settings
|
||||||
o.encoding = "utf-8"
|
o.encoding = "utf-8"
|
||||||
o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
o.backspace = "indent,eol,start" -- backspace works on every char in insert mode
|
||||||
o.completeopt = {'menu', 'menuone', 'noselect'}
|
o.completeopt = { 'menu', 'menuone', 'noselect' }
|
||||||
o.history = 1000
|
o.history = 1000
|
||||||
-- o.dictionary = '/home/jan/.vim/dict/words'
|
-- o.dictionary = '/home/jan/.vim/dict/words'
|
||||||
-- o.dictionary = '/usr/share/dict/words'
|
-- o.dictionary = '/usr/share/dict/words'
|
||||||
o.startofline = true
|
o.startofline = true
|
||||||
o.title = true
|
o.title = true
|
||||||
o.clipboard='unnamedplus'
|
o.clipboard = 'unnamedplus'
|
||||||
|
|
||||||
-- Mapping waiting time
|
-- Mapping waiting time
|
||||||
o.timeoutlen = 200
|
o.timeoutlen = 200
|
||||||
@ -120,22 +120,22 @@ o.ttimeoutlen = 0
|
|||||||
-- Spellchecker
|
-- Spellchecker
|
||||||
o.spell = false
|
o.spell = false
|
||||||
o.spelllang = { 'en_us' }
|
o.spelllang = { 'en_us' }
|
||||||
o.spellfile= HOME .. '/.vim/spell/en.utf8.add'
|
o.spellfile = HOME .. '/.vim/spell/en.utf8.add'
|
||||||
o.thesaurus= HOME .. '/.vim/thesaurus/english.txt'
|
o.thesaurus = HOME .. '/.vim/thesaurus/english.txt'
|
||||||
|
|
||||||
-- Display
|
-- Display
|
||||||
o.showmatch = true -- show matching brackets
|
o.showmatch = true -- show matching brackets
|
||||||
o.colorcolumn = '90'
|
o.colorcolumn = '90'
|
||||||
o.cursorline = true
|
o.cursorline = true
|
||||||
o.scrolloff = 8 -- always show 3 rows from edge of the screen
|
o.scrolloff = 8 -- always show 3 rows from edge of the screen
|
||||||
o.splitbelow = true
|
o.splitbelow = true
|
||||||
o.splitright = true
|
o.splitright = true
|
||||||
o.virtualedit = 'block'
|
o.virtualedit = 'block'
|
||||||
o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
o.synmaxcol = 300 -- stop syntax highlight after x lines for performance
|
||||||
o.laststatus = 2 -- always show status line
|
o.laststatus = 2 -- always show status line
|
||||||
o.list = false -- do not display white characters
|
o.list = false -- do not display white characters
|
||||||
o.termguicolors = true
|
o.termguicolors = true
|
||||||
o.background = "dark"
|
o.background = "dark"
|
||||||
-- o.updatetime = 100
|
-- o.updatetime = 100
|
||||||
|
|
||||||
-- Folding
|
-- Folding
|
||||||
@ -144,7 +144,7 @@ o.foldlevel = 4 -- limit folding to 4 levels
|
|||||||
o.foldmethod = 'syntax' -- use language syntax to generate folds
|
o.foldmethod = 'syntax' -- use language syntax to generate folds
|
||||||
o.wrap = false --do not wrap lines even if very long
|
o.wrap = false --do not wrap lines even if very long
|
||||||
o.eol = false -- show if there's no eol char
|
o.eol = false -- show if there's no eol char
|
||||||
o.showbreak= '↪' -- character to show when line is broken
|
o.showbreak = '↪' -- character to show when line is broken
|
||||||
|
|
||||||
-- Sidebar
|
-- Sidebar
|
||||||
o.number = true -- line number on the left
|
o.number = true -- line number on the left
|
||||||
@ -203,7 +203,7 @@ o.backup = true -- use backup files
|
|||||||
o.writebackup = false
|
o.writebackup = false
|
||||||
o.swapfile = false -- do not use swap file
|
o.swapfile = false -- do not use swap file
|
||||||
o.undofile = true
|
o.undofile = true
|
||||||
o.undodir = HOME .. '/.local/share/nvim/dirs/undo//' -- undo files
|
o.undodir = HOME .. '/.local/share/nvim/dirs/undo//' -- undo files
|
||||||
o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups
|
o.backupdir = HOME .. '/.local/share/nvim/dirs/backup//' -- backups
|
||||||
|
|
||||||
-- Commands mode
|
-- Commands mode
|
||||||
@ -216,57 +216,63 @@ au BufRead,BufNewFile *.md set ft=mkd tw=80 syntax=markdown
|
|||||||
|
|
||||||
vim.api.nvim_create_user_command('ReloadConfig', 'source $MYVIMRC', {})
|
vim.api.nvim_create_user_command('ReloadConfig', 'source $MYVIMRC', {})
|
||||||
|
|
||||||
local group = vim.api.nvim_create_augroup('user_cmds', {clear = true})
|
local group = vim.api.nvim_create_augroup('user_cmds', { clear = true })
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
desc = 'Highlight on yank',
|
desc = 'Highlight on yank',
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.highlight.on_yank({higroup = 'Visual', timeout = 200})
|
vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
local map = vim.keymap.set
|
local map = vim.keymap.set
|
||||||
|
|
||||||
map({'n','v'}, '<Space>', "<Nop>", { silent = true })
|
map({ 'n', 'v' }, '<Space>', "<Nop>", { silent = true })
|
||||||
|
|
||||||
-- clear the search buffer when hitting return
|
-- clear the search buffer when hitting return
|
||||||
map('n', '<CR>', '{->v:hlsearch ? ":nohl\\<CR>" : "\\<CR>"}()', { expr = true })
|
map('n', '<CR>', '{->v:hlsearch ? ":nohl\\<CR>" : "\\<CR>"}()', { expr = true })
|
||||||
|
|
||||||
-- sane regexes
|
-- sane regexes
|
||||||
map({'n','v'}, '/', '/\\v', { noremap = true, silent = true })
|
map({ 'n', 'v' }, '/', '/\\v', { noremap = true, silent = true })
|
||||||
|
|
||||||
-- don't jump when using *
|
-- don't jump when using *
|
||||||
map('n','*', '*<c-o>')
|
map('n', '*', '*<c-o>')
|
||||||
|
|
||||||
-- keep search matches in the middle of the window
|
-- keep search matches in the middle of the window
|
||||||
map('n','n', 'nzzzv')
|
map('n', 'n', 'nzzzv')
|
||||||
map('n','N', 'Nzzzv')
|
map('n', 'N', 'Nzzzv')
|
||||||
|
|
||||||
-- Same when jumping around
|
-- Same when jumping around
|
||||||
map('n','g;', 'g;zz', { silent = true })
|
map('n', 'g;', 'g;zz')
|
||||||
|
|
||||||
-- replace ex mode map and use it for repeating 'q' macro
|
-- replace ex mode map and use it for repeating 'q' macro
|
||||||
map('n','Q', '@q', { silent = true })
|
map('n', 'Q', '@q')
|
||||||
map('v','Q', '<cmd>norm @q<CR>', { silent = true })
|
map('v', 'Q', '<cmd>norm @q<CR>')
|
||||||
|
|
||||||
-- Shortcut to close quickfix windows
|
-- Shortcut to close quickfix windows
|
||||||
map('n','<leader>a', '<cmd>windo lcl|ccl<CR>', { silent = true })
|
map('n', '<leader>a', '<cmd>windo lcl|ccl<CR>')
|
||||||
|
|
||||||
-- <Leader>q Closes the current buffer
|
-- <Leader>q Closes the current buffer
|
||||||
map('n','<leader>q', '<cmd>bdelete<CR>', { silent = true })
|
map('n', '<leader>q', '<cmd>bdelete<CR>')
|
||||||
|
|
||||||
-- Easier in-file navigation with Tab and S-Tab
|
-- Easier in-file navigation with Tab and S-Tab
|
||||||
map('n','<S-Tab>', '<C-U>')
|
map('n', '<S-Tab>', '<C-U>')
|
||||||
map('n','<Tab>', '<C-D>')
|
map('n', '<Tab>', '<C-D>')
|
||||||
|
|
||||||
-- Easy buffer navigation
|
-- Easy buffer navigation
|
||||||
map('n','<C-h>', '<C-w>h', { silent = true })
|
map('n', '<C-h>', '<C-w>h')
|
||||||
map('n','<C-j>', '<C-w>j', { silent = true })
|
map('n', '<C-j>', '<C-w>j')
|
||||||
map('n','<C-k>', '<C-w>k', { silent = true })
|
map('n', '<C-k>', '<C-w>k')
|
||||||
map('n','<C-l>', '<C-w>l', { silent = true })
|
map('n', '<C-l>', '<C-w>l')
|
||||||
|
|
||||||
map('n','<up>', '<cmd>resize -2<CR>', { silent = true })
|
map('n', '<up>', '<cmd>resize -2<CR>')
|
||||||
map('n','<down>', '<cmd>resize +2<CR>', { silent = true })
|
map('n', '<down>', '<cmd>resize +2<CR>')
|
||||||
map('n','<left>', '<cmd>vertical resize -2<CR>', { silent = true })
|
map('n', '<left>', '<cmd>vertical resize -2<CR>')
|
||||||
map('n','<right>', '<cmd>vertical resize +2<CR>', { silent = true })
|
map('n', '<right>', '<cmd>vertical resize +2<CR>')
|
||||||
|
|
||||||
|
-- Trouble keymap
|
||||||
|
map('n', '<leader>xx', '<cmd>TroubleToggle<cr>', { noremap = true, silent = true })
|
||||||
|
map('n', '<leader>xd', '<cmd>TroubleToggle document_diagnostics<cr>', { noremap = true, silent = true })
|
||||||
|
map('n', '<leader>xl', '<cmd>TroubleToggle loclist<cr>', { noremap = true, silent = true })
|
||||||
|
map('n', '<leader>xq', '<cmd>TroubleToggle quickfix<cr>', { noremap = true, silent = true })
|
||||||
|
Loading…
Reference in New Issue
Block a user