Compare commits
1 Commits
helpgrep
...
3adcb18a5b
| Author | SHA1 | Date | |
|---|---|---|---|
| 3adcb18a5b |
1
after/ftdetect/cmakecache.vim
Normal file
1
after/ftdetect/cmakecache.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
autocmd BufNewFile,BufReadPost CMakeCache.txt set filetype=cmakecache
|
||||||
2
after/ftdetect/cpp.vim
Normal file
2
after/ftdetect/cpp.vim
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
" Force *.def to C++ filetype for LLVM
|
||||||
|
au BufNewFile,BufReadPost *.def set filetype=cpp
|
||||||
3
after/ftdetect/llvm.vim
Normal file
3
after/ftdetect/llvm.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
" Set .ll files to LLVM IR filetype
|
||||||
|
au BufNewFile,BufReadPost *.ll set filetype=llvm
|
||||||
|
au BufNewFile,BufReadPost *.test set filetype=llvm
|
||||||
3
after/ftdetect/markdown.vim
Normal file
3
after/ftdetect/markdown.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
" Force *.md to markdown filetype
|
||||||
|
au BufNewFile,BufReadPost *.md set filetype=markdown
|
||||||
|
au BufNewFile,BufReadPost *.ronn set filetype=markdown
|
||||||
2
after/ftdetect/opencl.vim
Normal file
2
after/ftdetect/opencl.vim
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
" Force *.cl to OpenCL C filetype
|
||||||
|
au BufNewFile,BufReadPost *.cl set filetype=opencl
|
||||||
3
after/ftdetect/python.vim
Normal file
3
after/ftdetect/python.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
" Force lit.cfg/lit.local.cfg to be Python
|
||||||
|
au BufNewFile,BufReadPost lit.cfg set filetype=python
|
||||||
|
au BufNewFile,BufReadPost lit.local.cfg set filetype=python
|
||||||
1
after/ftdetect/requirments.vim
Normal file
1
after/ftdetect/requirments.vim
Normal file
@@ -0,0 +1 @@
|
|||||||
|
autocmd BufNewFile,BufReadPost */requirements.txt set filetype=requirements
|
||||||
2
after/ftdetect/tablegen.vim
Normal file
2
after/ftdetect/tablegen.vim
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
" Force *.td to tablegen filetype
|
||||||
|
au BufNewFile,BufReadPost *.td set filetype=tablegen
|
||||||
3
after/ftdetect/zsh.vim
Normal file
3
after/ftdetect/zsh.vim
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
" Force .enter/.exit to be zsh
|
||||||
|
au BufNewFile,BufReadPost .enter set filetype=zsh
|
||||||
|
au BufNewFile,BufReadPost .exit set filetype=zsh
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
vim.opt.spell = true
|
vim.opt.spell = true
|
||||||
vim.opt.textwidth = 72
|
|
||||||
|
|
||||||
-- Auto-wrap text using textwidth
|
-- Auto-wrap text using textwidth
|
||||||
vim.opt.formatoptions:append('t')
|
vim.opt.formatoptions:append('t')
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
vim.opt.expandtab = false
|
|
||||||
vim.opt.tabstop = 4
|
|
||||||
vim.opt.shiftwidth = 4
|
|
||||||
vim.opt.softtabstop = 4
|
|
||||||
vim.wo.listchars = 'extends:»,nbsp:⦸,precedes:«,tab: ,trail:·'
|
|
||||||
vim.bo.formatprg = 'gofmt'
|
|
||||||
9
init.lua
9
init.lua
@@ -1,5 +1,10 @@
|
|||||||
vim.g.mapleader = ' '
|
require('settings')
|
||||||
vim.g.maplocalleader = ' '
|
require('mappings')
|
||||||
|
require('commands')
|
||||||
|
require('netrw')
|
||||||
|
require('autocmds')
|
||||||
|
require('statusline')
|
||||||
|
require('build')
|
||||||
|
|
||||||
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ vim.api.nvim_create_autocmd('BufRead', {
|
|||||||
vim.api.nvim_create_autocmd('TermOpen', {
|
vim.api.nvim_create_autocmd('TermOpen', {
|
||||||
group = group, pattern = 'term://*',
|
group = group, pattern = 'term://*',
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd.startinsert()
|
vim.cmd [[ startinsert ]]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ function build.set_dir(dirname)
|
|||||||
-- Restart clangd language server
|
-- Restart clangd language server
|
||||||
-- TODO: Configure cmake language server?
|
-- TODO: Configure cmake language server?
|
||||||
on_exit = function()
|
on_exit = function()
|
||||||
vim.cmd.LspRestart('clangd')
|
vim.cmd [[ LspRestart clangd ]]
|
||||||
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
|
echo('Build directory selected: ' .. dirname, 'DiagnosticInfo')
|
||||||
end,
|
end,
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
-- :RString strip white psace from right of all lines, ranges supported
|
-- :RString Strip white psace from right of all lines, ranges supported
|
||||||
vim.api.nvim_create_user_command('RStrip', function(opts)
|
vim.api.nvim_create_user_command('RStrip', function(opts)
|
||||||
local pos = vim.fn.getcurpos(vim.api.nvim_get_current_win())
|
local pos = vim.fn.getcurpos(vim.api.nvim_get_current_win())
|
||||||
local range = opts.line1 .. ',' .. opts.line2
|
local range = opts.line1 .. ',' .. opts.line2
|
||||||
@@ -7,9 +7,13 @@ vim.api.nvim_create_user_command('RStrip', function(opts)
|
|||||||
vim.fn.setpos('.', pos)
|
vim.fn.setpos('.', pos)
|
||||||
end, { range = '%' })
|
end, { range = '%' })
|
||||||
|
|
||||||
-- :TabWidth set the tab width for the current buffer
|
-- :TabWidth <N> set the tab width for the current buffer
|
||||||
vim.api.nvim_create_user_command('TabWidth', function(opts)
|
vim.api.nvim_create_user_command('TabWidth', function(opts)
|
||||||
-- Set the tab width for the current filetype
|
-- Set the tab width for the current filetype
|
||||||
|
-- FIXME: Doesn't seem to cover all bases in neovim when editorconfig is
|
||||||
|
-- involved, specifically with pressing o/O in C++ from a line with a brace.
|
||||||
|
-- This might be related to tree-sitter indentation? Or could be that I've
|
||||||
|
-- not ported over all my filetype settings yet.
|
||||||
local width = tonumber(opts.args)
|
local width = tonumber(opts.args)
|
||||||
vim.opt.tabstop = width
|
vim.opt.tabstop = width
|
||||||
vim.opt.shiftwidth = width
|
vim.opt.shiftwidth = width
|
||||||
@@ -46,44 +50,25 @@ vim.api.nvim_create_user_command('Remove', function(opts)
|
|||||||
vim.loop.fs_unlink(path, callback)
|
vim.loop.fs_unlink(path, callback)
|
||||||
end, { bang = true })
|
end, { bang = true })
|
||||||
|
|
||||||
-- :Move the file associated with the current buffer
|
-- TODO: :Move
|
||||||
vim.api.nvim_create_user_command('Move', function(opts)
|
|
||||||
local source = vim.fn.expand('%:p')
|
|
||||||
local dest = opts.args
|
|
||||||
if vim.fn.isdirectory(dest) ~= 0 then
|
|
||||||
dest = vim.fn.resolve(dest .. '/' .. vim.fn.expand('%:t'))
|
|
||||||
end
|
|
||||||
vim.loop.fs_rename(source, dest, function(err, success)
|
|
||||||
if success then
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.cmd.edit(dest)
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
error(err)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end, {
|
|
||||||
nargs = 1,
|
|
||||||
complete = 'file',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- :Rename the file associated with current buffer
|
-- :Rename the file associated with current buffer
|
||||||
vim.api.nvim_create_user_command('Rename', function(opts)
|
vim.api.nvim_create_user_command('Rename', function(opts)
|
||||||
local source = vim.fn.expand('%')
|
local from = vim.fn.expand('%')
|
||||||
local dest = nil
|
local buffer = vim.api.nvim_get_current_buf()
|
||||||
|
local to = nil
|
||||||
local dir = vim.fn.expand('%:h')
|
local dir = vim.fn.expand('%:h')
|
||||||
if dir == '.' then
|
if dir == '.' then
|
||||||
dest = opts.args
|
to = opts.args
|
||||||
else
|
else
|
||||||
dest = vim.fn.resolve(dir .. '/' .. opts.args)
|
to = dir .. '/' .. opts.args
|
||||||
end
|
end
|
||||||
local buffer = vim.api.nvim_get_current_buf()
|
vim.loop.fs_rename(from, to, function(err, success)
|
||||||
vim.loop.fs_rename(source, dest, function(err, success)
|
|
||||||
if not success then
|
if not success then
|
||||||
error(err)
|
error(err)
|
||||||
else
|
else
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.cmd.edit(dest)
|
vim.cmd('edit ' .. to)
|
||||||
vim.api.nvim_buf_delete(buffer, {})
|
vim.api.nvim_buf_delete(buffer, {})
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -95,34 +80,17 @@ end, {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- :Chmod change file mode bits
|
-- TODO: :Chmod
|
||||||
if vim.fn.executable('chmod') == 1 then
|
|
||||||
vim.api.nvim_create_user_command('Chmod', function(opts)
|
|
||||||
local file = vim.fn.expand('%:p')
|
|
||||||
vim.fn.system('chmod ' .. opts.args .. ' ' .. file)
|
|
||||||
end, { nargs = '+' })
|
|
||||||
end
|
|
||||||
|
|
||||||
-- :Mkdir create a directory, bang to create intermediate directories
|
-- TODO: :Mkdir
|
||||||
vim.api.nvim_create_user_command('Mkdir', function(opts)
|
|
||||||
local flags = nil
|
|
||||||
if opts.bang then
|
|
||||||
flags = 'p'
|
|
||||||
end
|
|
||||||
vim.fn.mkdir(opts.args, flags)
|
|
||||||
end, {
|
|
||||||
bang = true,
|
|
||||||
nargs = 1,
|
|
||||||
complete = 'file',
|
|
||||||
})
|
|
||||||
|
|
||||||
-- :Rg grep for the given string and fuzzy find the results, bang to enable
|
-- :Rg <STRING> grep for the string and fuzzy find the results, bang to enable
|
||||||
-- regex in given string
|
-- regex in search term
|
||||||
-- FIXME: Support visual select modes
|
|
||||||
vim.api.nvim_create_user_command('Rg', function(opts)
|
vim.api.nvim_create_user_command('Rg', function(opts)
|
||||||
local grep_opts = { search = opts.args }
|
local grep_opts = { search = opts.args }
|
||||||
if opts.bang then
|
if opts.bang then
|
||||||
grep_opts['use_regex'] = true
|
grep_opts['use_regex'] = true
|
||||||
end
|
end
|
||||||
require('telescope.builtin').grep_string(grep_opts)
|
print(vim.inspect(grep_opts))
|
||||||
|
-- require('telescope.builtin').grep_string(grep_opts)
|
||||||
end, { bang = true, nargs = '*' })
|
end, { bang = true, nargs = '*' })
|
||||||
59
lua/mappings.lua
Normal file
59
lua/mappings.lua
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
vim.g.mapleader = ' '
|
||||||
|
|
||||||
|
-- Quick write
|
||||||
|
vim.keymap.set('n', '<leader>w', ':w!<CR>', { remap = false })
|
||||||
|
|
||||||
|
-- Treat long lines as line containing breaks
|
||||||
|
vim.keymap.set('n', 'j', 'gj', { remap = false })
|
||||||
|
vim.keymap.set('n', 'k', 'gk', { remap = false })
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>tn', ':tabnew<Space>', { remap = false })
|
||||||
|
vim.keymap.set('n', '<leader>tc', ':tabclose<CR>', { remap = false })
|
||||||
|
vim.keymap.set('n', '<leader>to', ':tabonly<CR>', { remap = false })
|
||||||
|
vim.keymap.set('n', '<leader>tm', ':tabmove<Space>', { remap = false })
|
||||||
|
|
||||||
|
-- Quickly access spelling menu
|
||||||
|
vim.keymap.set('i', '<C-s>', '<C-g>u<C-X>s', { remap = false })
|
||||||
|
vim.keymap.set('n', '<C-s>', 'i<C-g>u<C-X>s', { remap = false })
|
||||||
|
|
||||||
|
-- Clear search highlights
|
||||||
|
vim.keymap.set('n', '<leader><Space>', ':nohlsearch<CR>', { remap = false })
|
||||||
|
|
||||||
|
-- Disable 'Q' from opening Ex mode
|
||||||
|
vim.keymap.set('n', 'Q', '<nop>', { remap = false })
|
||||||
|
|
||||||
|
-- Yank and put mappings
|
||||||
|
-- TODO: This doesn't handle all use cases, only the basics. For example,
|
||||||
|
-- this doesn't handle a local tmux session with a remote nvim in a pane.
|
||||||
|
-- if tmux#isOption('set-clipboard', 'on') || $SSH_CONNECTION !=# ''
|
||||||
|
-- " When connected to a remote session the + selection register is not
|
||||||
|
-- " available and the unnamed register is used instead. Add mappings using the
|
||||||
|
-- " z register instead.
|
||||||
|
-- noremap <leader>y "zy
|
||||||
|
-- noremap <leader>Y "zY
|
||||||
|
-- " Enable OSC 52 copy on yank.
|
||||||
|
-- call osc52#autocmd()
|
||||||
|
-- else
|
||||||
|
-- System clipboard yank/put
|
||||||
|
vim.keymap.set('', '<leader>y', '"+y', { remap = false })
|
||||||
|
vim.keymap.set('', '<leader>Y', '"+Y', { remap = false })
|
||||||
|
vim.keymap.set('', '<leader>p', '"+p', { remap = false })
|
||||||
|
vim.keymap.set('', '<leader>P', '"+P', { remap = false })
|
||||||
|
-- end
|
||||||
|
|
||||||
|
-- Undo neovim's default mapping of Y to y$
|
||||||
|
vim.cmd('unmap Y')
|
||||||
|
|
||||||
|
-- Make nvim :terminal more like vim :terminal
|
||||||
|
vim.keymap.set('t', '<C-w>N', '<C-\\><C-n>', { remap = true })
|
||||||
|
|
||||||
|
-- Mappings to make navigating :Termdebug
|
||||||
|
local opts = { remap = false, silent = true }
|
||||||
|
vim.keymap.set('n', '<C-w><C-g>', ':Gdb<CR>:startinsert<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<C-w><C-e>', ':Program<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<C-w><C-s>', ':Source<CR>', opts)
|
||||||
|
vim.keymap.set('n', '<C-w><C-a>', ':Asm<CR>', opts)
|
||||||
|
vim.keymap.set('t', '<C-w><C-g>', '<C-\\><C-n>:Gdb<CR>:startinsert<CR>', opts)
|
||||||
|
vim.keymap.set('t', '<C-w><C-e>', '<C-\\><C-n>:Program<CR>', opts)
|
||||||
|
vim.keymap.set('t', '<C-w><C-s>', '<C-\\><C-n>:Source<CR>', opts)
|
||||||
|
vim.keymap.set('t', '<C-w><C-a>', '<C-\\><C-n>:Asm<CR>', opts)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
local kanagawa = {
|
return {
|
||||||
'rebelot/kanagawa.nvim',
|
'rebelot/kanagawa.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
local kanagawa = require('kanagawa')
|
local kanagawa = require('kanagawa')
|
||||||
@@ -8,12 +8,8 @@ local kanagawa = {
|
|||||||
bg = '#080808',
|
bg = '#080808',
|
||||||
bg_m3 = '#262626',
|
bg_m3 = '#262626',
|
||||||
bg_gutter = '#121212',
|
bg_gutter = '#121212',
|
||||||
bg_search = '#404000',
|
-- bg_search = '#404000',
|
||||||
bg_visual = '#202020',
|
bg_visual = '#202020',
|
||||||
float = {
|
|
||||||
bg = '#080808',
|
|
||||||
bg_border = '#080808',
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,15 +21,8 @@ local kanagawa = {
|
|||||||
kanagawa.load('dragon')
|
kanagawa.load('dragon')
|
||||||
|
|
||||||
-- Override highlight groups
|
-- Override highlight groups
|
||||||
vim.cmd.highlight('TabLine', 'guifg=#949494', 'guibg=' .. dragon.ui.bg_m3)
|
|
||||||
vim.cmd.highlight('TabLineFill', 'guibg=' .. dragon.ui.bg_gutter)
|
|
||||||
vim.cmd.highlight('TabLineSel', 'guifg=#c8c093', 'guibg=' .. dragon.ui.bg_m3)
|
|
||||||
|
|
||||||
vim.cmd.highlight('WinSeparator', 'guifg=' .. dragon.ui.bg_m3, 'guibg=' .. dragon.ui.bg_m3)
|
vim.cmd.highlight('WinSeparator', 'guifg=' .. dragon.ui.bg_m3, 'guibg=' .. dragon.ui.bg_m3)
|
||||||
vim.cmd.highlight('MsgSeparator', 'guifg=' .. dragon.ui.bg_m3, 'guibg=' .. dragon.ui.bg_m3)
|
vim.cmd.highlight('MsgSeparator', 'guifg=' .. dragon.ui.bg_m3, 'guibg=' .. dragon.ui.bg_m3)
|
||||||
vim.cmd.highligh('TreesitterContext', 'guibg=' .. dragon.ui.bg_gutter)
|
|
||||||
vim.cmd.highlight('link zshTodo Comment')
|
vim.cmd.highlight('link zshTodo Comment')
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
return kanagawa
|
|
||||||
|
|||||||
@@ -1,106 +1,74 @@
|
|||||||
-- Language servers
|
|
||||||
local ensure_installed = {
|
|
||||||
'clangd', -- C/C++
|
|
||||||
'lua_ls', -- Lua
|
|
||||||
'opencl_ls', -- OpenCL
|
|
||||||
}
|
|
||||||
|
|
||||||
if vim.fn.executable('npm') == 1 then
|
|
||||||
local ensure_install_from_npm = {
|
|
||||||
'ansiblels', -- Ansible
|
|
||||||
'bashls', -- Bash
|
|
||||||
'docker_compose_language_service', -- Docker Compose
|
|
||||||
'dockerls', -- Dockerfile
|
|
||||||
'html', -- HTML
|
|
||||||
'jsonls', -- JSON
|
|
||||||
'pyright', -- Python
|
|
||||||
'vimls', -- VimScript
|
|
||||||
'yamlls', -- YAML
|
|
||||||
}
|
|
||||||
for _, package in ipairs(ensure_install_from_npm) do
|
|
||||||
table.insert(ensure_installed, package)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.fn.executable('pip') == 1 then
|
|
||||||
local ensure_install_from_pip = {
|
|
||||||
'cmake', -- CMake
|
|
||||||
'esbonio', -- Sphinx
|
|
||||||
'ruff_lsp', -- Python
|
|
||||||
}
|
|
||||||
for _, package in ipairs(ensure_install_from_pip) do
|
|
||||||
table.insert(ensure_installed, package)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if vim.fn.has('win32') == 1 then
|
|
||||||
table.insert(ensure_installed, 'powershell_es')
|
|
||||||
end
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Language server management plugins
|
-- Language server management plugins
|
||||||
-- 'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'kbenzie/mason.nvim',
|
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
-- Completion sources plugins
|
-- Completion plugins
|
||||||
'hrsh7th/cmp-nvim-lsp', -- Source for built-in language server client
|
'hrsh7th/cmp-nvim-lsp', -- Source for built-in language server client
|
||||||
'saadparwaiz1/cmp_luasnip', -- Source for LuaSnip snippets
|
'hrsh7th/cmp-buffer', -- Source for buffer words
|
||||||
'hrsh7th/cmp-buffer', -- Source for buffer words
|
'hrsh7th/cmp-path', -- Source for filesystem paths
|
||||||
'hrsh7th/cmp-path', -- Source for filesystem paths
|
'hrsh7th/cmp-cmdline', -- Source for command-line
|
||||||
'kbenzie/cmp-git', -- Source for Git/GitHub/GitLab
|
'hrsh7th/nvim-cmp', -- Completion engine combines and use the above
|
||||||
'hrsh7th/nvim-cmp', -- Completion engine combines and uses the above
|
|
||||||
|
|
||||||
-- Lua vim module support in lua language server
|
|
||||||
'folke/neodev.nvim',
|
|
||||||
-- Expose clangd extensions
|
|
||||||
'p00f/clangd_extensions.nvim',
|
|
||||||
|
|
||||||
-- LSP UI plugins
|
-- LSP UI plugins
|
||||||
'aznhe21/actions-preview.nvim',
|
'aznhe21/actions-preview.nvim',
|
||||||
'j-hui/fidget.nvim',
|
'j-hui/fidget.nvim',
|
||||||
|
'folke/trouble.nvim',
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
'ray-x/lsp_signature.nvim',
|
|
||||||
|
|
||||||
-- TODO: https://github.com/b0o/SchemaStore.nvim
|
-- Lue vim module support in lua language server
|
||||||
-- TODO: https://github.com/jmbuhr/otter.nvim
|
'folke/neodev.nvim',
|
||||||
|
|
||||||
|
-- Snippet pluggins
|
||||||
|
{ 'L3MON4D3/LuaSnip', build = 'make install_jsregexp' },
|
||||||
|
'saadparwaiz1/cmp_luasnip',
|
||||||
|
|
||||||
|
-- Expose clangd extensions
|
||||||
|
'p00f/clangd_extensions.nvim',
|
||||||
|
|
||||||
-- TODO: https://github.com/nvimtools/none-ls.nvim
|
-- TODO: https://github.com/nvimtools/none-ls.nvim
|
||||||
|
|
||||||
-- TODO: https://github.com/mfussenegger/nvim-dap
|
-- TODO: https://github.com/mfussenegger/nvim-dap
|
||||||
-- TODO: https://github.com/rcarriga/nvim-dap-ui
|
-- TODO: https://github.com/rcarriga/nvim-dap-ui
|
||||||
},
|
},
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
||||||
capabilities = vim.tbl_deep_extend(
|
|
||||||
'force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
|
||||||
|
|
||||||
require('mason').setup()
|
require('mason').setup()
|
||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
automatic_installation = false,
|
automatic_installation = false,
|
||||||
ensure_installed = ensure_installed,
|
ensure_installed = {
|
||||||
|
'ansiblels', -- Ansible
|
||||||
|
'bashls', -- Bash
|
||||||
|
'clangd', -- C/C++
|
||||||
|
'cmake', -- Cmake
|
||||||
|
'docker_compose_language_service', -- Docker Compose
|
||||||
|
'dockerls', -- Dockerfile
|
||||||
|
'esbonio', -- Sphinx
|
||||||
|
'html', -- HTML
|
||||||
|
'jsonls', -- JSON
|
||||||
|
'lemminx', -- XML
|
||||||
|
'lua_ls', -- Lua
|
||||||
|
'opencl_ls', -- OpenCL
|
||||||
|
'powershell_es', -- Powershell
|
||||||
|
'pyright', -- Python
|
||||||
|
'ruff_lsp', -- Python
|
||||||
|
'vimls', -- VimScript
|
||||||
|
'yamlls', -- YAML
|
||||||
|
},
|
||||||
|
|
||||||
handlers = {
|
handlers = {
|
||||||
-- Default handler, sets up everything unless a custom language server
|
-- Default handler, sets up everything unless a custom language server
|
||||||
-- setup handler is defined below
|
-- setup handler is defined below
|
||||||
function(server_name)
|
function(server_name)
|
||||||
require('lspconfig')[server_name].setup({
|
require('lspconfig')[server_name].setup({})
|
||||||
capabilities = capabilities,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
|
|
||||||
['clangd'] = function()
|
|
||||||
require('lspconfig').clangd.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
cmd = { 'clangd', '--completion-style=detailed' }
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
['lua_ls'] = function()
|
['lua_ls'] = function()
|
||||||
require('neodev').setup()
|
require('neodev').setup()
|
||||||
require('lspconfig').lua_ls.setup({
|
require('lspconfig').lua_ls.setup({
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
@@ -114,7 +82,6 @@ return {
|
|||||||
|
|
||||||
['pyright'] = function()
|
['pyright'] = function()
|
||||||
require('lspconfig').pyright.setup({
|
require('lspconfig').pyright.setup({
|
||||||
capabilities = capabilities,
|
|
||||||
settings = {
|
settings = {
|
||||||
pyright = {
|
pyright = {
|
||||||
disableOrganizeImports = true, -- Use ruff import sorter instead
|
disableOrganizeImports = true, -- Use ruff import sorter instead
|
||||||
@@ -149,23 +116,9 @@ return {
|
|||||||
sources = {
|
sources = {
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip' },
|
||||||
{ name = 'buffer' },
|
-- { name = 'buffer' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
{ name = 'git' },
|
-- { name = 'cmdline' },
|
||||||
},
|
|
||||||
|
|
||||||
formatting = {
|
|
||||||
format = function(entry, vim_item)
|
|
||||||
-- Set a limit to how wide the completion menu can be
|
|
||||||
local winwidth = vim.fn.winwidth(vim.api.nvim_get_current_win())
|
|
||||||
local menuwidth = math.min(winwidth / 2, 70)
|
|
||||||
if menuwidth < 70 then
|
|
||||||
vim_item.menu = ''
|
|
||||||
vim_item.kind = ''
|
|
||||||
end
|
|
||||||
vim_item.abbr = string.sub(vim_item.abbr, 1, menuwidth)
|
|
||||||
return vim_item
|
|
||||||
end
|
|
||||||
},
|
},
|
||||||
|
|
||||||
window = {
|
window = {
|
||||||
@@ -173,7 +126,35 @@ return {
|
|||||||
documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
require("cmp_git").setup({})
|
|
||||||
|
-- Customise LSP UI
|
||||||
|
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.hover, {
|
||||||
|
border = 'rounded',
|
||||||
|
title = 'Hover',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
||||||
|
vim.lsp.handlers.signature_help, {
|
||||||
|
border = 'rounded',
|
||||||
|
title = 'Signature Help',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Customise diagnostics UI
|
||||||
|
vim.diagnostic.config({
|
||||||
|
float = {
|
||||||
|
border = 'rounded', -- Enable rounded border on floats
|
||||||
|
},
|
||||||
|
virtual_text = false, -- Disable trailing virtual text
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Diagnostics mappings
|
||||||
|
-- TODO: trouble.nvim mappings instead? https://youtu.be/MuUrCcvE-Yw?t=631
|
||||||
|
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { remap = false })
|
||||||
|
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { remap = false })
|
||||||
|
vim.keymap.set('n', '<leader>sd', vim.diagnostic.open_float, { remap = false })
|
||||||
|
vim.keymap.set('n', '<leader>sq', vim.diagnostic.setqflist, { remap = false })
|
||||||
|
|
||||||
-- Mappings created when LSP is attached to a buffer
|
-- Mappings created when LSP is attached to a buffer
|
||||||
local augroup = vim.api.nvim_create_augroup('lsp', { clear = true })
|
local augroup = vim.api.nvim_create_augroup('lsp', { clear = true })
|
||||||
@@ -184,19 +165,17 @@ return {
|
|||||||
local opts = { noremap = true, buffer = ev.buf }
|
local opts = { noremap = true, buffer = ev.buf }
|
||||||
|
|
||||||
-- Fixit mapping, or close enough, actually any code action
|
-- Fixit mapping, or close enough, actually any code action
|
||||||
vim.keymap.set('n', '<leader>fi', require('actions-preview').code_actions, opts)
|
vim.keymap.set('n', '<leader>fi',
|
||||||
|
require('actions-preview').code_actions, opts)
|
||||||
|
|
||||||
-- Goto mappings
|
-- Goto mappings
|
||||||
local tb = require('telescope.builtin')
|
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, opts)
|
||||||
vim.keymap.set('n', 'gd', tb.lsp_definitions, opts)
|
|
||||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||||
vim.keymap.set('n', 'gi', tb.lsp_implementations, opts)
|
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, opts)
|
||||||
vim.keymap.set('n', 'go', tb.lsp_type_definitions, opts)
|
vim.keymap.set('n', 'go', vim.lsp.buf.type_definition, opts)
|
||||||
vim.keymap.set('n', 'gr', tb.lsp_references, opts)
|
vim.keymap.set('n', 'gr', require('telescope.builtin').lsp_references, opts)
|
||||||
vim.keymap.set('n', '<leader>ic', tb.lsp_incoming_calls, opts)
|
vim.keymap.set('n', '<leader>ds', require('telescope.builtin').lsp_document_symbols, opts)
|
||||||
vim.keymap.set('n', '<leader>oc', tb.lsp_outgoing_calls, opts)
|
vim.keymap.set('n', '<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, opts)
|
||||||
vim.keymap.set('n', '<leader>ss', tb.lsp_document_symbols, opts)
|
|
||||||
vim.keymap.set('n', '<leader>sw', tb.lsp_workspace_symbols, opts)
|
|
||||||
|
|
||||||
-- Refactoring mappings
|
-- Refactoring mappings
|
||||||
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
vim.keymap.set('n', '<leader>rn', vim.lsp.buf.rename, opts)
|
||||||
@@ -206,24 +185,37 @@ return {
|
|||||||
-- |vim.lsp.buf.hover()| if the server supports it, unless
|
-- |vim.lsp.buf.hover()| if the server supports it, unless
|
||||||
-- |'keywordprg'| was customized before calling |vim.lsp.start()|.
|
-- |'keywordprg'| was customized before calling |vim.lsp.start()|.
|
||||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
vim.keymap.set('n', 'K', vim.lsp.buf.hover, opts)
|
||||||
|
vim.keymap.set('i', '<C-h>', vim.lsp.buf.signature_help, opts)
|
||||||
|
|
||||||
-- Format whole buffer mapping
|
-- Format whole buffer mapping
|
||||||
vim.keymap.set('n', '<leader>gq', vim.lsp.buf.format, opts)
|
vim.keymap.set('n', '<leader>gq', vim.lsp.buf.format, opts)
|
||||||
|
|
||||||
-- Swtich file using clangd extension
|
|
||||||
-- TODO: limit this to only filetypes supported by clangd
|
|
||||||
vim.keymap.set('n', '<leader>sf', ':ClangdSwitchSourceHeader<CR>', { silent = true })
|
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Snippet mappings
|
||||||
|
local luasnip = require('luasnip')
|
||||||
|
luasnip.setup({})
|
||||||
|
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
|
||||||
|
if luasnip.expand_or_jumpable() then
|
||||||
|
luasnip.expand_or_jump()
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
vim.keymap.set({ 'i', 's' }, '<C-K>', function()
|
||||||
|
if luasnip.jumpable(-1) then
|
||||||
|
luasnip.jump(-1)
|
||||||
|
end
|
||||||
|
end, { silent = true })
|
||||||
|
|
||||||
|
-- Load snippets
|
||||||
|
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
|
||||||
|
require('luasnip.loaders.from_snipmate').lazy_load(opts)
|
||||||
|
require('luasnip.loaders.from_lua').lazy_load(opts)
|
||||||
|
|
||||||
-- LSP UI plugins
|
-- LSP UI plugins
|
||||||
require('fidget').setup({})
|
require('fidget').setup({})
|
||||||
require('lsp_signature').setup({
|
require('trouble').setup({})
|
||||||
floating_window = true,
|
vim.keymap.set('n', '<leader>t', function()
|
||||||
hint_enable = false,
|
require('trouble').toggle()
|
||||||
toggle_key = '<C-h>',
|
end, { remap = false })
|
||||||
toggle_key_flip_floatwin_setting = true,
|
|
||||||
select_signature_key = '<C-l>',
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
return {
|
|
||||||
{
|
|
||||||
'folke/trouble.nvim',
|
|
||||||
dependencies = {
|
|
||||||
'nvim-tree/nvim-web-devicons',
|
|
||||||
},
|
|
||||||
config = function()
|
|
||||||
require('trouble').setup({})
|
|
||||||
local opts = { remap = false }
|
|
||||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
|
||||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
|
||||||
vim.keymap.set('n', '<leader>ds', vim.diagnostic.open_float, opts)
|
|
||||||
vim.keymap.set('n', '<leader>dq', function()
|
|
||||||
require('trouble').toggle()
|
|
||||||
end, opts)
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
return {
|
|
||||||
-- TODO: v0.10.0 might have builtins snippets?
|
|
||||||
'L3MON4D3/LuaSnip',
|
|
||||||
build = 'make install_jsregexp',
|
|
||||||
config = function()
|
|
||||||
local luasnip = require('luasnip')
|
|
||||||
luasnip.setup({})
|
|
||||||
|
|
||||||
-- Load snippets
|
|
||||||
local opts = { paths = vim.fn.stdpath('config') .. '/snippets' }
|
|
||||||
require('luasnip.loaders.from_snipmate').lazy_load(opts)
|
|
||||||
require('luasnip.loaders.from_lua').lazy_load(opts)
|
|
||||||
|
|
||||||
-- Snippet keybindings
|
|
||||||
vim.keymap.set({ 'i', 's' }, '<C-j>', function()
|
|
||||||
if luasnip.expand_or_jumpable() then
|
|
||||||
luasnip.expand_or_jump()
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
vim.keymap.set({ 'i', 's' }, '<C-K>', function()
|
|
||||||
if luasnip.jumpable(-1) then
|
|
||||||
luasnip.jump(-1)
|
|
||||||
end
|
|
||||||
end, { silent = true })
|
|
||||||
end
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
'kylechui/nvim-surround',
|
'kylechui/nvim-surround',
|
||||||
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
version = "*", -- Use for stability; omit to use `main` branch for the latest features
|
||||||
event = "VeryLazy",
|
event = "VeryLazy", -- FIXME: Causes splash screen to disappear on startup
|
||||||
config = function()
|
config = function()
|
||||||
require("nvim-surround").setup({})
|
require("nvim-surround").setup({})
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,11 +5,9 @@ return {
|
|||||||
'nvim-telescope/telescope-fzy-native.nvim',
|
'nvim-telescope/telescope-fzy-native.nvim',
|
||||||
'nvim-tree/nvim-web-devicons',
|
'nvim-tree/nvim-web-devicons',
|
||||||
'axkirillov/easypick.nvim',
|
'axkirillov/easypick.nvim',
|
||||||
'catgoose/telescope-helpgrep.nvim',
|
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local telescope = require('telescope')
|
local telescope = require('telescope')
|
||||||
local actions = require('telescope.actions')
|
|
||||||
telescope.setup({
|
telescope.setup({
|
||||||
defaults = {
|
defaults = {
|
||||||
mappings = {
|
mappings = {
|
||||||
@@ -22,39 +20,23 @@ return {
|
|||||||
['<C-s>'] = 'select_horizontal',
|
['<C-s>'] = 'select_horizontal',
|
||||||
['<C-h>'] = 'preview_scrolling_left',
|
['<C-h>'] = 'preview_scrolling_left',
|
||||||
['<C-l>'] = 'preview_scrolling_right',
|
['<C-l>'] = 'preview_scrolling_right',
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
layout_config = {
|
layout_config = {
|
||||||
height = 0.7,
|
height = 0.7,
|
||||||
},
|
}
|
||||||
},
|
|
||||||
extensions = {
|
|
||||||
helpgrep = {
|
|
||||||
mappings = {
|
|
||||||
i = {
|
|
||||||
["<CR>"] = actions.select_default,
|
|
||||||
["<C-v>"] = actions.select_vertical,
|
|
||||||
},
|
|
||||||
n = {
|
|
||||||
["<CR>"] = actions.select_default,
|
|
||||||
["<C-s>"] = actions.select_horizontal,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
telescope.load_extension('fzy_native')
|
telescope.load_extension('fzy_native')
|
||||||
|
|
||||||
local builtin = require('telescope.builtin')
|
-- TODO: Add more mappings?
|
||||||
local opts = { noremap = true }
|
local opts = { noremap = true }
|
||||||
vim.keymap.set('n', '<leader>gF', builtin.find_files, opts)
|
vim.keymap.set('n', '<leader>gF', ':Telescope find_files<CR>', opts)
|
||||||
vim.keymap.set('n', '<leader>gf', builtin.git_files, opts)
|
vim.keymap.set('n', '<leader>gf', ':Telescope git_files<CR>', opts)
|
||||||
vim.keymap.set('n', '<leader>gg', builtin.live_grep, opts)
|
vim.keymap.set('n', '<leader>gg', ':Telescope live_grep<CR>', opts)
|
||||||
vim.keymap.set('n', '<leader>rg', builtin.grep_string, opts)
|
vim.keymap.set('n', '<leader>rg', ':Telescope grep_string<CR>', opts)
|
||||||
vim.keymap.set('n', '<leader>gb', builtin.buffers, opts)
|
vim.keymap.set('n', '<leader>gb', ':Telescope buffers<CR>', opts)
|
||||||
vim.keymap.set('n', '<leader>ht', builtin.help_tags, opts)
|
vim.keymap.set('n', '<leader>gh', ':Telescope help_tags<CR>', opts)
|
||||||
vim.keymap.set('n', '<leader>gh', require('telescope-helpgrep').live_grep, opts)
|
|
||||||
vim.keymap.set('n', '<leader>bl', builtin.current_buffer_fuzzy_find, opts)
|
|
||||||
|
|
||||||
require('easypick').setup({
|
require('easypick').setup({
|
||||||
pickers = { },
|
pickers = { },
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
return {
|
return {
|
||||||
'folke/todo-comments.nvim',
|
'folke/todo-comments.nvim', -- FIXME: Causes splash screen to disappear on startup
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||||
config = function()
|
config = function()
|
||||||
require('todo-comments').setup({
|
require('todo-comments').setup({
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ return {
|
|||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
{ 'nvim-treesitter/nvim-treesitter-context', opts = {} },
|
|
||||||
-- TODO: Fork this and add CMake support
|
-- TODO: Fork this and add CMake support
|
||||||
-- TODO: Add shell support (sh/bash/zsh if/for/while/etc)
|
|
||||||
'RRethy/nvim-treesitter-endwise',
|
'RRethy/nvim-treesitter-endwise',
|
||||||
},
|
},
|
||||||
build = ':TSUpdate',
|
build = ':TSUpdate',
|
||||||
@@ -48,7 +46,6 @@ return {
|
|||||||
'lua',
|
'lua',
|
||||||
'make',
|
'make',
|
||||||
'markdown',
|
'markdown',
|
||||||
'markdown_inline',
|
|
||||||
'meson',
|
'meson',
|
||||||
'ninja',
|
'ninja',
|
||||||
'objc',
|
'objc',
|
||||||
@@ -80,9 +77,6 @@ return {
|
|||||||
lookahead = true,
|
lookahead = true,
|
||||||
-- include_surrounding_whitespace = true,
|
-- include_surrounding_whitespace = true,
|
||||||
keymaps = {
|
keymaps = {
|
||||||
-- Class text objects
|
|
||||||
['ac'] = '@class.outer',
|
|
||||||
['ic'] = '@class.inner',
|
|
||||||
-- Function text objects
|
-- Function text objects
|
||||||
['af'] = '@function.outer',
|
['af'] = '@function.outer',
|
||||||
['if'] = '@function.inner',
|
['if'] = '@function.inner',
|
||||||
|
|||||||
@@ -22,12 +22,11 @@ local noice = {
|
|||||||
signature = { enable = false },
|
signature = { enable = false },
|
||||||
message = { enable = false },
|
message = { enable = false },
|
||||||
},
|
},
|
||||||
signature = { enabled = false },
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Override highlight groups
|
-- Override highlight groups
|
||||||
vim.cmd.highlight('NoiceCmdlinePopupBorder', 'guibg=#080808')
|
vim.cmd [[ highlight NoiceCmdlinePopupBorder guibg=#080808 ]]
|
||||||
vim.cmd.highlight('link', 'NoiceCmdlinePopupBorder', 'NoiceCmdlinePopupBorderSearch')
|
vim.cmd [[ highlight link NoiceCmdlinePopupBorder NoiceCmdlinePopupBorderSearch ]]
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,11 +27,12 @@ modes[116] = { name = 'Terminal', color = 'light_blue' }
|
|||||||
modes[33] = { name = 'Shell', color = 'light_grey' }
|
modes[33] = { name = 'Shell', color = 'light_grey' }
|
||||||
|
|
||||||
local function highlight(group, color, attrs)
|
local function highlight(group, color, attrs)
|
||||||
local args = { group, 'guifg=' .. color.fg, 'guibg=' .. color.bg }
|
local command = 'highlight ' .. group ..
|
||||||
|
' guifg=' .. color.fg .. ' guibg=' .. color.bg
|
||||||
if attrs then
|
if attrs then
|
||||||
table.insert(args, 'gui=' .. attrs)
|
command = command .. ' gui=' .. attrs
|
||||||
end
|
end
|
||||||
vim.cmd.highlight(args)
|
vim.cmd(command)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- StatusLineLight is shows the mode and cursor information, it is dynamically
|
-- StatusLineLight is shows the mode and cursor information, it is dynamically
|
||||||
@@ -109,7 +110,7 @@ end
|
|||||||
|
|
||||||
-- Define active statusline, this statusline is dynamic with StatusLineLight
|
-- Define active statusline, this statusline is dynamic with StatusLineLight
|
||||||
-- being updated based on the current mode and only used for current buffer.
|
-- being updated based on the current mode and only used for current buffer.
|
||||||
function _G.statusline_active()
|
function statusline.active()
|
||||||
local mode = get_mode()
|
local mode = get_mode()
|
||||||
if vim.o.buftype == 'help' then
|
if vim.o.buftype == 'help' then
|
||||||
if mode == 'Normal' then mode = 'Help' end
|
if mode == 'Normal' then mode = 'Help' end
|
||||||
@@ -138,7 +139,7 @@ function _G.statusline_active()
|
|||||||
return generic('StatusLineLight', mode, true)
|
return generic('StatusLineLight', mode, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
function _G.statusline_inactive()
|
function statusline.inactive()
|
||||||
local mode = modes[vim.fn.char2nr(vim.fn.mode())].name
|
local mode = modes[vim.fn.char2nr(vim.fn.mode())].name
|
||||||
local line = ''
|
local line = ''
|
||||||
if vim.o.buftype == 'help' then
|
if vim.o.buftype == 'help' then
|
||||||
@@ -169,7 +170,7 @@ vim.api.nvim_create_autocmd({ 'BufEnter', 'WinEnter', 'BufWinEnter' }, {
|
|||||||
pattern = '*',
|
pattern = '*',
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd.setlocal("statusline=%{%v:lua.statusline_active()%}")
|
vim.cmd [[ setlocal statusline=%{%v:lua.require('statusline').active()%} ]]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -178,7 +179,7 @@ vim.api.nvim_create_autocmd({ 'BufLeave', 'WinLeave' }, {
|
|||||||
pattern = '*',
|
pattern = '*',
|
||||||
group = group,
|
group = group,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.cmd.setlocal("statusline=%{%v:lua.statusline_inactive()%}")
|
vim.cmd [[ setlocal statusline=%{%v:lua.require('statusline').inactive()%} ]]
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
vim.filetype.add({
|
|
||||||
extension = {
|
|
||||||
cl = 'opencl',
|
|
||||||
def = 'cpp',
|
|
||||||
ll = 'llvm',
|
|
||||||
md = 'markdown',
|
|
||||||
ronn = 'markdown',
|
|
||||||
td = 'tablegen',
|
|
||||||
test = 'llvm',
|
|
||||||
},
|
|
||||||
filename = {
|
|
||||||
['.enter'] = 'zsh',
|
|
||||||
['.exit'] = 'zsh',
|
|
||||||
['CMakeCache.txt'] = 'cmakecache',
|
|
||||||
['lit.cfg'] = 'python',
|
|
||||||
['lit.local.cfg'] = 'python',
|
|
||||||
['requirements.txt'] = 'requirements',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
local opts = { remap = false, silent = true }
|
|
||||||
|
|
||||||
-- Quick write
|
|
||||||
vim.keymap.set('n', '<leader>w', ':w!<CR>', opts)
|
|
||||||
|
|
||||||
-- Treat long lines as line containing breaks
|
|
||||||
vim.keymap.set('n', 'j', 'gj', opts)
|
|
||||||
vim.keymap.set('n', 'k', 'gk', opts)
|
|
||||||
|
|
||||||
vim.keymap.set('n', '<leader>tn', ':tabnew<Space>', { remap = false })
|
|
||||||
vim.keymap.set('n', '<leader>tm', ':tabmove<Space>', { remap = false })
|
|
||||||
vim.keymap.set('n', '<leader>tc', ':tabclose<CR>', opts)
|
|
||||||
vim.keymap.set('n', '<leader>to', ':tabonly<CR>', opts)
|
|
||||||
|
|
||||||
-- Quickly access spelling menu
|
|
||||||
vim.keymap.set('i', '<C-s>', '<C-g>u<C-X>s', opts)
|
|
||||||
vim.keymap.set('n', '<C-s>', 'i<C-g>u<C-X>s', opts)
|
|
||||||
|
|
||||||
-- Clear search highlights
|
|
||||||
vim.keymap.set('n', '<leader><Space>', ':nohlsearch<CR>', opts)
|
|
||||||
|
|
||||||
-- Disable 'Q' from opening Ex mode
|
|
||||||
vim.keymap.set('n', 'Q', '<nop>', opts)
|
|
||||||
|
|
||||||
-- System clipboard yank/put
|
|
||||||
vim.keymap.set('', '<leader>y', '"+y', opts)
|
|
||||||
vim.keymap.set('', '<leader>Y', '"+Y', opts)
|
|
||||||
vim.keymap.set('', '<leader>p', '"+p', opts)
|
|
||||||
vim.keymap.set('', '<leader>P', '"+P', opts)
|
|
||||||
|
|
||||||
-- Undo neovim's default mapping of Y to y$
|
|
||||||
vim.cmd.unmap('Y')
|
|
||||||
|
|
||||||
-- Make nvim :terminal more like vim :terminal
|
|
||||||
vim.keymap.set('t', '<C-w>N', '<C-\\><C-n>', opts)
|
|
||||||
|
|
||||||
-- Mappings to make navigating :Termdebug
|
|
||||||
vim.keymap.set('n', '<C-w><C-g>', ':Gdb<CR>:startinsert<CR>', opts)
|
|
||||||
vim.keymap.set('n', '<C-w><C-e>', ':Program<CR>', opts)
|
|
||||||
vim.keymap.set('n', '<C-w><C-s>', ':Source<CR>', opts)
|
|
||||||
vim.keymap.set('n', '<C-w><C-a>', ':Asm<CR>', opts)
|
|
||||||
vim.keymap.set('t', '<C-w><C-g>', '<C-\\><C-n>:Gdb<CR>:startinsert<CR>', opts)
|
|
||||||
vim.keymap.set('t', '<C-w><C-e>', '<C-\\><C-n>:Program<CR>', opts)
|
|
||||||
vim.keymap.set('t', '<C-w><C-s>', '<C-\\><C-n>:Source<CR>', opts)
|
|
||||||
vim.keymap.set('t', '<C-w><C-a>', '<C-\\><C-n>:Asm<CR>', opts)
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
-- Customise LSP UI
|
|
||||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
|
||||||
vim.lsp.handlers.hover, {
|
|
||||||
border = 'rounded',
|
|
||||||
title = 'Hover',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(
|
|
||||||
vim.lsp.handlers.signature_help, {
|
|
||||||
border = 'rounded',
|
|
||||||
title = 'Signature Help',
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
-- Customise diagnostic UI
|
|
||||||
vim.diagnostic.config({
|
|
||||||
float = {
|
|
||||||
border = 'rounded',
|
|
||||||
title = 'Diagnostics',
|
|
||||||
},
|
|
||||||
virtual_text = false,
|
|
||||||
})
|
|
||||||
@@ -1,19 +1,7 @@
|
|||||||
# Global SnipMate snippets
|
# Global SnipMate snippets
|
||||||
|
|
||||||
snippet joy
|
|
||||||
(◦U ◡ U◦)
|
|
||||||
|
|
||||||
snippet shrug
|
snippet shrug
|
||||||
¯\_(ツ)_/¯
|
¯\_(ツ)_/¯
|
||||||
|
|
||||||
snippet confuse
|
|
||||||
(ノ*・_・)ノ
|
|
||||||
|
|
||||||
snippet tableflip
|
snippet tableflip
|
||||||
(╯°▪°)╯︵┻━┻
|
(╯°▪°)╯︵┻━┻
|
||||||
|
|
||||||
snippet cry
|
|
||||||
(ㅠ﹏ㅠ)
|
|
||||||
|
|
||||||
snippet think
|
|
||||||
(╭ರ_•́)
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
# Python SnipMate snippets
|
|
||||||
|
|
||||||
snippet main
|
|
||||||
def main():
|
|
||||||
${0:pass}
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
try:
|
|
||||||
main()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
exit(130)
|
|
||||||
|
|
||||||
snippet debug
|
|
||||||
import ipdb; ipdb.set_trace()
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# reStructuredText snippets
|
|
||||||
|
|
||||||
snippet code
|
|
||||||
.. code-block:: ${1:language}
|
|
||||||
|
|
||||||
$0
|
|
||||||
Reference in New Issue
Block a user