mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-09 23:22:57 +00:00
nvim: cmp and telescope
This commit is contained in:
parent
f92b7cf891
commit
170a2a24de
@ -99,7 +99,8 @@ font:
|
|||||||
# - (Windows) Consolas
|
# - (Windows) Consolas
|
||||||
#family: Fira Code
|
#family: Fira Code
|
||||||
#family: Noto Sans Mono
|
#family: Noto Sans Mono
|
||||||
family: Fira Mono for Powerline
|
# family: Fira Mono for Powerline
|
||||||
|
family: FiraMono Nerd Font
|
||||||
|
|
||||||
# The `style` can be specified to pick a specific face.
|
# The `style` can be specified to pick a specific face.
|
||||||
#style: Regular
|
#style: Regular
|
||||||
@ -138,7 +139,7 @@ font:
|
|||||||
#style: Bold Italic
|
#style: Bold Italic
|
||||||
|
|
||||||
# Point size
|
# Point size
|
||||||
size: 18.0
|
size: 17.0
|
||||||
|
|
||||||
# Offset is the extra space around each character. `offset.y` can be thought of
|
# Offset is the extra space around each character. `offset.y` can be thought of
|
||||||
# as modifying the line spacing, and `offset.x` as modifying the letter spacing.
|
# as modifying the line spacing, and `offset.x` as modifying the letter spacing.
|
||||||
|
@ -24,6 +24,7 @@ cask "hammerspoon"
|
|||||||
# Fonts
|
# Fonts
|
||||||
tap "homebrew/cask-fonts"
|
tap "homebrew/cask-fonts"
|
||||||
cask "font-fira-mono-for-powerline"
|
cask "font-fira-mono-for-powerline"
|
||||||
|
cask "font-fira-mono-nerd-font"
|
||||||
|
|
||||||
# Personal
|
# Personal
|
||||||
cask "authy" # Authentication
|
cask "authy" # Authentication
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# DevOps Packages
|
# DevOps Packages
|
||||||
|
|
||||||
tap "nmasur/repo"
|
tap "nmasur/repo"
|
||||||
|
tap "hashicorp/tap"
|
||||||
|
|
||||||
brew "ansible" # Deploy to local server
|
brew "ansible" # Deploy to local server
|
||||||
brew "terraform" # Deploy cloud infra
|
brew "terraform" # Deploy cloud infra
|
||||||
@ -9,3 +10,5 @@ brew "awscli" # AWS API tools
|
|||||||
brew "kubectl" # Kubernetes CLI
|
brew "kubectl" # Kubernetes CLI
|
||||||
brew "k9s" # Kubernetes TUI
|
brew "k9s" # Kubernetes TUI
|
||||||
brew "nmasur/repo/drips" # Retrieve AWS IPs
|
brew "nmasur/repo/drips" # Retrieve AWS IPs
|
||||||
|
brew "hashicorp/tap/terraform-ls"
|
||||||
|
brew "tflint"
|
||||||
|
@ -11,21 +11,25 @@ end
|
|||||||
local use = require('packer').use
|
local use = require('packer').use
|
||||||
require('packer').startup(function()
|
require('packer').startup(function()
|
||||||
use 'wbthomason/packer.nvim' -- Maintain plugin manager
|
use 'wbthomason/packer.nvim' -- Maintain plugin manager
|
||||||
|
use 'lewis6991/impatient.nvim' -- Startup speed hacks
|
||||||
use 'tpope/vim-eunuch' -- File manipulation in Vim
|
use 'tpope/vim-eunuch' -- File manipulation in Vim
|
||||||
use 'tpope/vim-vinegar' -- Fixes netrw file explorer
|
use 'tpope/vim-vinegar' -- Fixes netrw file explorer
|
||||||
use 'tpope/vim-fugitive' -- Git commands
|
use 'tpope/vim-fugitive' -- Git commands and syntax
|
||||||
use 'tpope/vim-surround' -- Manipulate parentheses
|
use 'tpope/vim-surround' -- Manipulate parentheses
|
||||||
use 'tpope/vim-commentary' -- Use gc or gcc to add comments
|
use 'tpope/vim-commentary' -- Use gc or gcc to add comments
|
||||||
use 'tpope/vim-repeat' -- Actually repeat using .
|
use 'tpope/vim-repeat' -- Actually repeat using .
|
||||||
use 'christoomey/vim-tmux-navigator' -- Hotkeys for tmux panes
|
use 'christoomey/vim-tmux-navigator' -- Hotkeys for tmux panes
|
||||||
use 'morhetz/gruvbox' -- Colorscheme
|
use 'morhetz/gruvbox' -- Colorscheme
|
||||||
use 'phaazon/hop.nvim' -- Quick jump around the buffer
|
use 'L3MON4D3/LuaSnip' -- Snippet engine
|
||||||
use 'neovim/nvim-lspconfig' -- Language server linting
|
use 'neovim/nvim-lspconfig' -- Language server linting
|
||||||
use 'folke/lsp-colors.nvim' -- Pretty LSP highlights
|
use 'folke/lsp-colors.nvim' -- Pretty LSP highlights
|
||||||
use 'rafamadriz/friendly-snippets'
|
use 'hrsh7th/cmp-nvim-lsp' -- Language server completion
|
||||||
use 'hrsh7th/vim-vsnip'
|
use 'hrsh7th/cmp-buffer' -- Generic text completion
|
||||||
use 'hrsh7th/vim-vsnip-integ'
|
use 'hrsh7th/cmp-path' -- Local file completion
|
||||||
use 'hrsh7th/nvim-compe' -- Auto-complete
|
use 'hrsh7th/cmp-cmdline' -- Command line completion
|
||||||
|
use 'hrsh7th/cmp-nvim-lua' -- Nvim lua api completion
|
||||||
|
use 'saadparwaiz1/cmp_luasnip' -- Luasnip completion
|
||||||
|
use 'hrsh7th/nvim-cmp' -- Completion system
|
||||||
use 'godlygeek/tabular' -- Spacing and alignment
|
use 'godlygeek/tabular' -- Spacing and alignment
|
||||||
use 'vimwiki/vimwiki' -- Wiki Markdown System
|
use 'vimwiki/vimwiki' -- Wiki Markdown System
|
||||||
use 'airblade/vim-rooter' -- Change directory to git route
|
use 'airblade/vim-rooter' -- Change directory to git route
|
||||||
@ -36,47 +40,114 @@ require('packer').startup(function()
|
|||||||
opt = true
|
opt = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
use { -- Syntax highlighting for most languages
|
use 'nathom/filetype.nvim' -- Faster startup
|
||||||
|
use { -- Syntax highlighting processor
|
||||||
'nvim-treesitter/nvim-treesitter',
|
'nvim-treesitter/nvim-treesitter',
|
||||||
run = ':TSUpdate'
|
run = ':TSUpdate'
|
||||||
}
|
}
|
||||||
use 'bfontaine/Brewfile.vim' -- Brewfile syntax
|
use 'bfontaine/Brewfile.vim' -- Brewfile syntax
|
||||||
use 'blankname/vim-fish' -- Fish syntax
|
|
||||||
use 'chr4/nginx.vim' -- Nginx syntax
|
use 'chr4/nginx.vim' -- Nginx syntax
|
||||||
use 'hashivim/vim-terraform' -- Terraform syntax
|
use 'hashivim/vim-terraform' -- Terraform formatting
|
||||||
use 'cespare/vim-toml' -- TOML syntax
|
|
||||||
use 'towolf/vim-helm' -- Helm syntax
|
use 'towolf/vim-helm' -- Helm syntax
|
||||||
use 'LnL7/vim-nix' -- Nix syntax
|
|
||||||
use 'rodjek/vim-puppet' -- Puppet syntax
|
use 'rodjek/vim-puppet' -- Puppet syntax
|
||||||
use { -- Git next to line numbers
|
use { -- Git next to line numbers
|
||||||
'lewis6991/gitsigns.nvim',
|
'lewis6991/gitsigns.nvim',
|
||||||
|
branch = 'main',
|
||||||
requires = {'nvim-lua/plenary.nvim'},
|
requires = {'nvim-lua/plenary.nvim'},
|
||||||
config = function()
|
config = function()
|
||||||
require('gitsigns').setup()
|
require('gitsigns').setup()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
use { -- Fuzzy finder
|
use {
|
||||||
'junegunn/fzf.vim',
|
'nvim-telescope/telescope.nvim',
|
||||||
requires = {'/usr/local/opt/fzf'}
|
requires = { {'nvim-lua/plenary.nvim'} }
|
||||||
|
}
|
||||||
|
use 'nvim-telescope/telescope-fzy-native.nvim'
|
||||||
|
use 'camgraff/telescope-tmux.nvim'
|
||||||
|
use {
|
||||||
|
'jvgrootveld/telescope-zoxide',
|
||||||
|
requires = {'nvim-lua/popup.nvim'},
|
||||||
|
}
|
||||||
|
use {
|
||||||
|
"AckslD/nvim-neoclip.lua",
|
||||||
|
branch = 'main',
|
||||||
|
requires = {'tami5/sqlite.lua', module = 'sqlite'},
|
||||||
}
|
}
|
||||||
-- use 'ludovicchabant/vim-gutentags'
|
-- use 'ludovicchabant/vim-gutentags'
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
require('impatient') -- Faster startup
|
||||||
|
|
||||||
|
-- Completion Settings
|
||||||
|
-- ===================
|
||||||
|
|
||||||
|
local cmp = require'cmp'
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
require('luasnip').lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
mapping = {
|
||||||
|
['<C-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
||||||
|
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
||||||
|
['<Esc>'] = function(fallback)
|
||||||
|
cmp.mapping({
|
||||||
|
i = cmp.mapping.abort(),
|
||||||
|
c = cmp.mapping.close(),
|
||||||
|
})
|
||||||
|
vim.cmd('stopinsert') -- Abort and leave insert mode
|
||||||
|
end,
|
||||||
|
-- ['<Tab>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 's' }),
|
||||||
|
-- ['<S-Tab>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 's' }),
|
||||||
|
['<CR>'] = cmp.mapping.confirm({
|
||||||
|
behavior = cmp.ConfirmBehavior.Insert,
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
{ name = 'nvim_lua' },
|
||||||
|
{ name = 'nvim_lsp' },
|
||||||
|
{ name = 'path' },
|
||||||
|
{ name = 'luasnip' },
|
||||||
|
{ name = 'buffer', keyword_length = 5, max_item_count = 10 },
|
||||||
|
},
|
||||||
|
experimental = {
|
||||||
|
native_menu = false, -- Use cmp menu instead of Vim menu
|
||||||
|
ghost_text = true, -- Show preview auto-completion
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use buffer source for `/`
|
||||||
|
cmp.setup.cmdline('/', {
|
||||||
|
sources = {
|
||||||
|
{ name = 'buffer', keyword_length = 5 }
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use cmdline & path source for ':'
|
||||||
|
cmp.setup.cmdline(':', {
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = 'path' }
|
||||||
|
}, {
|
||||||
|
{ name = 'cmdline' }
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
-- LSP Settings
|
-- LSP Settings
|
||||||
-- ============
|
-- ============
|
||||||
|
|
||||||
require('lspconfig').rust_analyzer.setup{}
|
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
|
require('lspconfig').rust_analyzer.setup{ capabilities = capabilities }
|
||||||
|
require('lspconfig').tflint.setup{ capabilities = capabilities }
|
||||||
|
require('lspconfig').terraformls.setup{ capabilities = capabilities }
|
||||||
require('lspconfig').pyright.setup{
|
require('lspconfig').pyright.setup{
|
||||||
cmd = { "poetry", "run", "pyright-langserver", "--stdio" }
|
cmd = { "poetry", "run", "pyright-langserver", "--stdio" },
|
||||||
|
capabilities = capabilities,
|
||||||
}
|
}
|
||||||
require'compe'.setup({
|
|
||||||
enabled = true,
|
|
||||||
source = {
|
|
||||||
path = true,
|
|
||||||
buffer = true,
|
|
||||||
nvim_lsp = true,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
if require('lspconfig/util').has_bins('diagnostic-languageserver') then
|
if require('lspconfig/util').has_bins('diagnostic-languageserver') then
|
||||||
require('lspconfig').diagnosticls.setup{
|
require('lspconfig').diagnosticls.setup{
|
||||||
cmd = { "diagnostic-languageserver", "--stdio" },
|
cmd = { "diagnostic-languageserver", "--stdio" },
|
||||||
@ -114,52 +185,6 @@ if require('lspconfig/util').has_bins('diagnostic-languageserver') then
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Auto-complete
|
|
||||||
-- ====================
|
|
||||||
|
|
||||||
-- Auto-complete mapping
|
|
||||||
local t = function(str)
|
|
||||||
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
local check_back_space = function()
|
|
||||||
local col = vim.fn.col('.') - 1
|
|
||||||
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- Use (s-)tab to:
|
|
||||||
--- move to prev/next item in completion menuone
|
|
||||||
--- jump to prev/next snippet's placeholder
|
|
||||||
_G.tab_complete = function()
|
|
||||||
if vim.fn.pumvisible() == 1 then
|
|
||||||
return t "<C-n>"
|
|
||||||
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
|
||||||
return t "<Plug>(vsnip-expand-or-jump)"
|
|
||||||
elseif check_back_space() then
|
|
||||||
return t "<Tab>"
|
|
||||||
else
|
|
||||||
return vim.fn['compe#complete']()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
_G.s_tab_complete = function()
|
|
||||||
if vim.fn.pumvisible() == 1 then
|
|
||||||
return t "<C-p>"
|
|
||||||
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
|
||||||
return t "<Plug>(vsnip-jump-prev)"
|
|
||||||
else
|
|
||||||
return t "<S-Tab>"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Auto-complete keybinds
|
|
||||||
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
||||||
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
|
||||||
|
|
||||||
-- Settings
|
-- Settings
|
||||||
-- ========
|
-- ========
|
||||||
|
|
||||||
@ -189,13 +214,13 @@ vim.o.mouse = "nv" -- Mouse interaction / scrolling
|
|||||||
|
|
||||||
-- Neovim features
|
-- Neovim features
|
||||||
vim.o.inccommand = "split" -- Live preview search and replace
|
vim.o.inccommand = "split" -- Live preview search and replace
|
||||||
vim.o.completeopt = "menuone,noselect" -- Required for nvim-compe completion
|
vim.o.completeopt = "menu,menuone,noselect" -- Required for nvim-cmp completion
|
||||||
|
-- Required until 0.6.0: do not source the default filetype.vim
|
||||||
|
vim.g.did_load_filetypes = 1
|
||||||
|
|
||||||
-- Remember last position when reopening file
|
-- Remember last position when reopening file
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
if has("autocmd")
|
|
||||||
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
endif
|
|
||||||
]], false)
|
]], false)
|
||||||
|
|
||||||
-- Better backup, swap and undo storage
|
-- Better backup, swap and undo storage
|
||||||
@ -204,32 +229,49 @@ vim.bo.swapfile = false -- Instead of swaps, create backups
|
|||||||
vim.bo.undofile = true -- Keeps undos after quit
|
vim.bo.undofile = true -- Keeps undos after quit
|
||||||
|
|
||||||
-- Create backup directories if they don't exist
|
-- Create backup directories if they don't exist
|
||||||
|
-- Should be fixed in 0.6 by https://github.com/neovim/neovim/pull/15433
|
||||||
|
vim.o.backupdir = vim.fn.stdpath('cache') .. '/backup'
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
set backupdir=~/.local/share/nvim/backup
|
|
||||||
set undodir=~/.local/share/nvim/undo
|
|
||||||
if !isdirectory(&backupdir)
|
if !isdirectory(&backupdir)
|
||||||
call mkdir(&backupdir, "p")
|
call mkdir(&backupdir, "p")
|
||||||
endif
|
endif
|
||||||
if !isdirectory(&undodir)
|
|
||||||
call mkdir(&undodir, "p")
|
|
||||||
endif
|
|
||||||
]], false)
|
]], false)
|
||||||
|
|
||||||
-- Keep selection when tabbing
|
-- Filetype for .env files
|
||||||
vim.api.nvim_set_keymap("v", "<", "<gv", {noremap=true})
|
local envfiletype = function()
|
||||||
vim.api.nvim_set_keymap("v", ">", ">gv", {noremap=true})
|
vim.bo.filetype = 'text'
|
||||||
|
vim.bo.syntax = 'sh'
|
||||||
|
end
|
||||||
|
|
||||||
-- Force filetype patterns that Vim doesn't know about
|
-- Force filetype patterns that Vim doesn't know about
|
||||||
vim.api.nvim_exec([[
|
require('filetype').setup({
|
||||||
au BufRead,BufNewFile *.Brewfile setfiletype brewfile
|
overrides = {
|
||||||
au BufRead,BufNewFile tmux.conf* setfiletype tmux
|
extensions = {
|
||||||
au BufRead,BufNewFile *ignore.*link setfiletype gitignore
|
Brewfile = 'brewfile',
|
||||||
au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig
|
muttrc = 'muttrc',
|
||||||
au BufRead,BufNewFile *.toml.*link setfiletype toml
|
hcl = 'terraform',
|
||||||
au BufRead,BufNewFile *.muttrc setfiletype muttrc
|
},
|
||||||
au BufRead,BufNewFile .env* set ft=text | set syntax=sh
|
literal = {
|
||||||
au BufRead,BufNewFile *.hcl set ft=terraform
|
Caskfile = 'brewfile',
|
||||||
]], false)
|
[".gitignore"] = 'gitignore',
|
||||||
|
},
|
||||||
|
complex = {
|
||||||
|
[".*git/config"] = "gitconfig",
|
||||||
|
["tmux.conf%..*link"] = "tmux",
|
||||||
|
["gitconfig%..*link"] = "gitconfig",
|
||||||
|
[".*ignore%..*link"] = "gitignore",
|
||||||
|
[".*%.toml%..*link"] = "toml",
|
||||||
|
},
|
||||||
|
function_extensions = {},
|
||||||
|
function_literal = {
|
||||||
|
[".envrc"] = envfiletype,
|
||||||
|
[".env"] = envfiletype,
|
||||||
|
[".env.dev"] = envfiletype,
|
||||||
|
[".env.prod"] = envfiletype,
|
||||||
|
[".env.example"] = envfiletype,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
-- LaTeX options
|
-- LaTeX options
|
||||||
vim.api.nvim_exec([[
|
vim.api.nvim_exec([[
|
||||||
@ -242,11 +284,6 @@ vim.api.nvim_exec([[
|
|||||||
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
||||||
]], false)
|
]], false)
|
||||||
|
|
||||||
-- Rust stuff
|
|
||||||
-- vim.api.nvim_exec([[
|
|
||||||
-- au BufWritePost *.rs silent! execute "%! rustfmt"
|
|
||||||
-- ]], false)
|
|
||||||
|
|
||||||
-- Auto-pairs
|
-- Auto-pairs
|
||||||
vim.g.AutoPairsFlyMode = 0
|
vim.g.AutoPairsFlyMode = 0
|
||||||
|
|
||||||
@ -257,10 +294,16 @@ vim.g.netrw_winsize = 15 -- Explore window takes % of page
|
|||||||
vim.g.netrw_browse_split = 4 -- Open in previous window
|
vim.g.netrw_browse_split = 4 -- Open in previous window
|
||||||
vim.g.netrw_altv = 1 -- Always split left
|
vim.g.netrw_altv = 1 -- Always split left
|
||||||
|
|
||||||
-- Polyglot
|
-- Formatting
|
||||||
vim.g.terraform_fmt_on_save = 1 -- Formats with terraform plugin
|
vim.g.terraform_fmt_on_save = 1 -- Formats with terraform plugin
|
||||||
vim.g.rustfmt_autosave = 1 -- Formats with rust plugin
|
vim.g.rustfmt_autosave = 1 -- Formats with rust plugin
|
||||||
|
|
||||||
|
-- Tree-Sitter Syntax Processing
|
||||||
|
require('nvim-treesitter.configs').setup {
|
||||||
|
highlight = { enable = true },
|
||||||
|
indent = { enable = true },
|
||||||
|
}
|
||||||
|
|
||||||
-- VimWiki
|
-- VimWiki
|
||||||
vim.g.vimwiki_list = {
|
vim.g.vimwiki_list = {
|
||||||
{
|
{
|
||||||
@ -291,14 +334,48 @@ vim.api.nvim_exec([[
|
|||||||
|
|
||||||
-- Status bar
|
-- Status bar
|
||||||
require('lualine').setup({
|
require('lualine').setup({
|
||||||
options = { theme = 'gruvbox' }
|
options = {
|
||||||
|
theme = 'gruvbox',
|
||||||
|
icons_enabled = true
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Clipboard history
|
||||||
|
require('neoclip').setup({
|
||||||
|
enable_persistant_history = true,
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Telescope: quit instantly with escape
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
require("telescope").setup({
|
||||||
|
defaults = {
|
||||||
|
mappings = {
|
||||||
|
i = { ["<esc>"] = actions.close, },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pickers = {
|
||||||
|
find_files = { theme = "dropdown" },
|
||||||
|
oldfiles = { theme = "dropdown" },
|
||||||
|
buffers = { theme = "dropdown" },
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
fzy_native = {},
|
||||||
|
tmux = {},
|
||||||
|
zoxide = {},
|
||||||
|
neoclip = {},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
require('telescope').load_extension('neoclip')
|
||||||
|
|
||||||
-- Remap space as leader key
|
-- Remap space as leader key
|
||||||
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", {noremap=true, silent=true})
|
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", {noremap=true, silent=true})
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
vim.g.maplocalleader = " "
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
-- Keep selection when changing indentation
|
||||||
|
vim.api.nvim_set_keymap("v", "<", "<gv", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("v", ">", ">gv", {noremap=true})
|
||||||
|
|
||||||
-- Unset search pattern register
|
-- Unset search pattern register
|
||||||
vim.api.nvim_set_keymap("n", "<CR>", ":noh<CR><CR>", {noremap=true, silent=true})
|
vim.api.nvim_set_keymap("n", "<CR>", ":noh<CR><CR>", {noremap=true, silent=true})
|
||||||
|
|
||||||
@ -310,12 +387,33 @@ vim.api.nvim_set_keymap("i", "<A-k>", "<Esc>:m .-2<CR>==gi", {noremap=true})
|
|||||||
vim.api.nvim_set_keymap("v", "<A-j>", ":m '>+1<CR>gv=gv", {noremap=true})
|
vim.api.nvim_set_keymap("v", "<A-j>", ":m '>+1<CR>gv=gv", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("v", "<A-k>", ":m '<-2<CR>gv=gv", {noremap=true})
|
vim.api.nvim_set_keymap("v", "<A-k>", ":m '<-2<CR>gv=gv", {noremap=true})
|
||||||
|
|
||||||
-- Fzf (fuzzy finder)
|
-- Telescope (fuzzy finder)
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>/", ":Rg<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>/", ":Telescope live_grep<CR>", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>ff", ":Files<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>ff", ":Telescope find_files<CR>", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>fr", ":History<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>fa", ":Telescope file_browser<CR>", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>b", ":Buffers<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>wt", ":Telescope tmux sessions<CR>", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>s", ":BLines<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>ww", ":Telescope tmux windows<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>w/", ":Telescope tmux pane_contents<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fz", ":Telescope zoxide list<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>b", ":Telescope buffers<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>hh", ":Telescope help_tags<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fr", ":Telescope oldfiles<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>cc", ":Telescope commands<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>cr", ":Telescope command_history<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>y", ":Telescope neoclip<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>s", ":Telescope current_buffer_fuzzy_find<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>gc", ":Telescope git_commits<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>gf", ":Telescope git_bcommits<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>gb", ":Telescope git_branches<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>gs", ":Telescope git_status<CR>", {noremap=true})
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
vim.api.nvim_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "gi", "<Cmd>lua vim.lsp.buf.implementation()<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "gh", "<Cmd>lua vim.lsp.buf.hover()<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "]e", "<Cmd>lua vim.lsp.diagnostic.goto_next()<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "[e", "<Cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>e", "<Cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", {silent=true, noremap=true})
|
||||||
|
|
||||||
-- File commands
|
-- File commands
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>q", ":quit<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>q", ":quit<CR>", {noremap=true})
|
||||||
@ -327,7 +425,9 @@ vim.api.nvim_set_keymap("n", "<Leader>fd", ":lcd %:p:h<CR>", {silent=true, norem
|
|||||||
vim.api.nvim_set_keymap("n", "<Leader>fu", ":lcd ..<CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>fu", ":lcd ..<CR>", {silent=true, noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader><Tab>", ":b#<CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader><Tab>", ":b#<CR>", {silent=true, noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", {silent=true, noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", {silent=true, noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>tt", [[<Cmd>exe 'edit ~/notes/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]], {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>tt",
|
||||||
|
[[<Cmd>exe 'edit ~/notes/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]], {noremap=true}
|
||||||
|
)
|
||||||
|
|
||||||
-- Window commands
|
-- Window commands
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>wv", ":vsplit<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>wv", ":vsplit<CR>", {noremap=true})
|
||||||
@ -338,16 +438,17 @@ vim.api.nvim_set_keymap("n", "<Leader>wm", ":only<CR>", {noremap=true})
|
|||||||
vim.api.nvim_set_keymap("", "<Leader>ta", ":Tabularize /", {noremap=true})
|
vim.api.nvim_set_keymap("", "<Leader>ta", ":Tabularize /", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("", "<Leader>t#", ":Tabularize /#<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("", "<Leader>t#", ":Tabularize /#<CR>", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("", "<Leader>t\"", ":Tabularize /\"<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("", "<Leader>t\"", ":Tabularize /\"<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("", "<Leader>tl", ":Tabularize /--<CR>", {noremap=true})
|
||||||
|
|
||||||
-- Vimrc editing
|
-- Vimrc editing
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>fv", ":edit $MYVIMRC<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>fv", ":edit $MYVIMRC<CR>", {noremap=true})
|
||||||
vim.api.nvim_set_keymap("n", "<Leader>rr", ":luafile $MYVIMRC<CR>", {noremap=true})
|
vim.api.nvim_set_keymap("n", "<Leader>rr", ":luafile $MYVIMRC<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>rp", ":luafile $MYVIMRC<CR>:PackerCompile<CR>:PackerInstall<CR>", {noremap=true})
|
||||||
|
|
||||||
-- Other
|
-- Other
|
||||||
vim.api.nvim_set_keymap("n", "<Leader><Space>", ":HopWord<CR>", {noremap=true})
|
|
||||||
vim.api.nvim_set_keymap("t", "<A-CR>", "<C-\\><C-n>", {noremap=true}) -- Exit terminal mode
|
vim.api.nvim_set_keymap("t", "<A-CR>", "<C-\\><C-n>", {noremap=true}) -- Exit terminal mode
|
||||||
vim.api.nvim_set_keymap("n", "<A-CR>", ":noh<CR>", {noremap=true, silent=true})
|
vim.api.nvim_set_keymap("n", "<A-CR>", ":noh<CR>", {noremap=true, silent=true}) -- Clear search
|
||||||
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true})
|
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true}) -- Copy to end of line
|
||||||
|
|
||||||
-- Keep cursor in place
|
-- Keep cursor in place
|
||||||
vim.api.nvim_set_keymap("n", 'n', "nzz", {noremap=true})
|
vim.api.nvim_set_keymap("n", 'n', "nzz", {noremap=true})
|
||||||
|
Loading…
Reference in New Issue
Block a user