add half-space and double-space user commands
parent
fb8f2363d3
commit
6b4da6304f
|
@ -3,7 +3,7 @@
|
|||
-- Features:
|
||||
-- - LSP
|
||||
-- - Auto-complete (in insert mode: ctrl-space, navigate w/ Tab+S-Tab, confirm: Enter)
|
||||
-- - cmd: ":Format" to format
|
||||
-- - <leader>df to format document
|
||||
-- - Harpoon marks: Navigate through main files within each project
|
||||
--
|
||||
-- REQUIREMENTS:
|
||||
|
@ -46,8 +46,10 @@ vim.keymap.set({ 'n', 'i', 'v' }, '<c-l>', '<Cmd>:mode<Cr>') -- redraw on every
|
|||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float) -- opens diag in box (floating)
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist) -- opens list of diags
|
||||
vim.keymap.set('n', '<leader>wq', vim.diagnostic.setqflist) -- workspace diags
|
||||
-- vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist) -- opens list of diags
|
||||
-- vim.keymap.set('n', '<leader>wq', vim.diagnostic.setqflist) -- workspace diags
|
||||
vim.keymap.set('n', '<leader>q', '<cmd>TroubleToggle loclist<cr>')
|
||||
vim.keymap.set('n', '<leader>wq', '<cmd>TroubleToggle workspace_diagnostics<cr>')
|
||||
|
||||
|
||||
-- vim-plug
|
||||
|
@ -61,6 +63,7 @@ endif
|
|||
|
||||
local Plug = vim.fn['plug#']
|
||||
vim.call('plug#begin', '~/.config/nvim/plugged')
|
||||
|
||||
-- libs and dependencies
|
||||
Plug('nvim-lua/plenary.nvim')
|
||||
|
||||
|
@ -71,12 +74,14 @@ Plug('nvim-telescope/telescope.nvim', { tag = '0.1.0' }) -- file browser
|
|||
Plug('nvim-telescope/telescope-fzf-native.nvim',
|
||||
{ ['do'] = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=release && cmake --build build --config Release && cmake --install build --prefix build' })
|
||||
Plug('nvim-telescope/telescope-file-browser.nvim')
|
||||
|
||||
-- cmp: auto-complete/suggestions
|
||||
Plug('neovim/nvim-lspconfig') -- built-in LSP configurations
|
||||
Plug('hrsh7th/cmp-nvim-lsp')
|
||||
Plug('hrsh7th/cmp-buffer')
|
||||
Plug('hrsh7th/nvim-cmp')
|
||||
Plug('onsails/lspkind-nvim')
|
||||
|
||||
-- DevExp
|
||||
Plug('windwp/nvim-autopairs') -- matches pairs like [] (),...
|
||||
Plug('windwp/nvim-ts-autotag') -- matches tags <body>hello</body>
|
||||
|
@ -88,19 +93,22 @@ Plug('williamboman/mason.nvim') -- LSP, debuggers,... package manager
|
|||
Plug('williamboman/mason-lspconfig.nvim') -- lsp config for mason
|
||||
Plug('ThePrimeagen/harpoon') -- 1-click through marked files per project
|
||||
Plug('TimUntersberger/neogit') -- Easy-to-see git status
|
||||
Plug('folke/trouble.nvim') -- File-grouped workspace diagnostics
|
||||
|
||||
-- UI & colorscheme
|
||||
Plug('gruvbox-community/gruvbox')
|
||||
Plug('gruvbox-community/gruvbox') -- theme provider
|
||||
Plug('nvim-lualine/lualine.nvim') -- fancy status line
|
||||
Plug('lukas-reineke/indent-blankline.nvim') -- identation lines on blank lines
|
||||
Plug('sunjon/shade.nvim')
|
||||
Plug('sunjon/shade.nvim') -- make inactive panes have lower opacity
|
||||
Plug('kyazdani42/nvim-web-devicons') -- icons for folder and filetypes
|
||||
Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog
|
||||
Plug('folke/todo-comments.nvim') -- Highlights TODO
|
||||
|
||||
-- other
|
||||
-- other utilities
|
||||
Plug('nvim-treesitter/nvim-treesitter', { run = ':TSUpdate' })
|
||||
Plug('saadparwaiz1/cmp_luasnip') -- snippet engine
|
||||
Plug('L3MON4D3/LuaSnip') -- snippet engine
|
||||
Plug('mickael-menu/zk-nvim') -- Zettelkasten
|
||||
Plug('m-demare/hlargs.nvim') -- highlights arguments; great for func prog
|
||||
|
||||
---------
|
||||
vim.call('plug#end')
|
||||
|
@ -117,6 +125,9 @@ require('shade').setup {
|
|||
toggle = '<Leader>s', -- s: sha
|
||||
}
|
||||
}
|
||||
require('nvim-web-devicons').setup()
|
||||
require('trouble').setup()
|
||||
require('todo-comments').setup()
|
||||
|
||||
-- plugin keymaps
|
||||
|
||||
|
@ -136,6 +147,30 @@ require("indent_blankline").setup {
|
|||
show_end_of_line = true,
|
||||
space_char_blankline = " ",
|
||||
}
|
||||
-- User command that transform into 2-spaces by translating to tabstop
|
||||
vim.api.nvim_create_user_command(
|
||||
'HalfSpaces',
|
||||
function(opts)
|
||||
vim.api.nvim_command("set ts=2 sts=2 noet")
|
||||
vim.api.nvim_command("retab!")
|
||||
vim.api.nvim_command("set ts=1 sts=1 et")
|
||||
vim.api.nvim_command("retab")
|
||||
vim.api.nvim_command("GuessIndent")
|
||||
end,
|
||||
{ nargs = 0 }
|
||||
)
|
||||
vim.api.nvim_create_user_command(
|
||||
'DoubleSpaces',
|
||||
function(opts)
|
||||
vim.api.nvim_command("set ts=1 sts=1 noet")
|
||||
vim.api.nvim_command("retab!")
|
||||
vim.api.nvim_command("set ts=2 sts=2 et")
|
||||
vim.api.nvim_command("retab")
|
||||
vim.api.nvim_command("GuessIndent")
|
||||
end,
|
||||
{ nargs = 0 }
|
||||
)
|
||||
|
||||
-- telescope
|
||||
local fb_actions = require "telescope".extensions.file_browser.actions
|
||||
require('telescope').setup {
|
||||
|
|
Loading…
Reference in New Issue