move to nvim lua and lsp
parent
fc16a5466b
commit
b63772bd4d
@ -0,0 +1,5 @@
|
||||
vim.g.tokyonight_transparent_sidebar = true
|
||||
vim.g.tokyonight_transparent = true
|
||||
vim.opt.background = "dark"
|
||||
|
||||
vim.cmd("colorscheme tokyonight")
|
@ -0,0 +1 @@
|
||||
|
@ -0,0 +1,219 @@
|
||||
local Remap = require("rahcodes.keymap")
|
||||
local nnoremap = Remap.nnoremap
|
||||
local inoremap = Remap.inoremap
|
||||
|
||||
local sumneko_root_path = "/usr/lib/lua-language-server"
|
||||
local sumneko_binary = "/usr/bin/lua-language-server"
|
||||
|
||||
-- Setup nvim-cmp.
|
||||
local cmp = require("cmp")
|
||||
local source_mapping = {
|
||||
youtube = "[Suck it YT]",
|
||||
buffer = "[Buffer]",
|
||||
nvim_lsp = "[LSP]",
|
||||
nvim_lua = "[Lua]",
|
||||
-- cmp_tabnine = "[TN]",
|
||||
path = "[Path]",
|
||||
}
|
||||
local lspkind = require("lspkind")
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
-- For `vsnip` user.
|
||||
-- vim.fn["vsnip#anonymous"](args.body)
|
||||
|
||||
-- For `luasnip` user.
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
|
||||
-- For `ultisnips` user.
|
||||
-- vim.fn["UltiSnips#Anon"](args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
|
||||
formatting = {
|
||||
format = function(entry, vim_item)
|
||||
vim_item.kind = lspkind.presets.default[vim_item.kind]
|
||||
local menu = source_mapping[entry.source.name]
|
||||
-- if entry.source.name == "cmp_tabnine" then
|
||||
-- if entry.completion_item.data ~= nil and entry.completion_item.data.detail ~= nil then
|
||||
-- menu = entry.completion_item.data.detail .. " " .. menu
|
||||
-- end
|
||||
-- vim_item.kind = ""
|
||||
-- end
|
||||
vim_item.menu = menu
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
|
||||
sources = {
|
||||
-- tabnine completion? yayaya
|
||||
-- { name = "cmp_tabnine" },
|
||||
|
||||
{ name = "nvim_lsp" },
|
||||
|
||||
-- For vsnip user.
|
||||
-- { name = 'vsnip' },
|
||||
|
||||
-- For luasnip user.
|
||||
{ name = "luasnip" },
|
||||
|
||||
-- For ultisnips user.
|
||||
-- { name = 'ultisnips' },
|
||||
|
||||
{ name = "buffer" },
|
||||
|
||||
{ name = "youtube" },
|
||||
},
|
||||
})
|
||||
|
||||
--[[
|
||||
local tabnine = require("cmp_tabnine.config")
|
||||
tabnine:setup({
|
||||
max_lines = 1000,
|
||||
max_num_results = 20,
|
||||
sort = true,
|
||||
run_on_every_keystroke = true,
|
||||
snippet_placeholder = "..",
|
||||
})
|
||||
]]--
|
||||
|
||||
local function config(_config)
|
||||
return vim.tbl_deep_extend("force", {
|
||||
on_attach = function()
|
||||
nnoremap("gD", function() vim.lsp.buf.definition() end)
|
||||
nnoremap("gd", function() vim.lsp.buf.definition() end)
|
||||
nnoremap("K", function() vim.lsp.buf.hover() end)
|
||||
nnoremap("gi", function() vim.lsp.buf.implementation() end)
|
||||
nnoremap("<leader>wa", function() vim.lsp.buf.add_workspace_folder() end)
|
||||
nnoremap("<leader>wr", function() vim.lsp.buf.remove_workspace_folder() end)
|
||||
nnoremap("<leader>wl", function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end)
|
||||
nnoremap("<leader>vws", function() vim.lsp.buf.workspace_symbol() end)
|
||||
nnoremap("<leader>vd", function() vim.diagnostic.open_float() end)
|
||||
nnoremap("[d", function() vim.diagnostic.goto_next() end)
|
||||
nnoremap("]d", function() vim.diagnostic.goto_prev() end)
|
||||
nnoremap("<leader>ca", function() vim.lsp.buf.code_action() end)
|
||||
nnoremap("<leader>vco", function() vim.lsp.buf.code_action({
|
||||
filter = function(code_action)
|
||||
if not code_action or not code_action.data then
|
||||
return false
|
||||
end
|
||||
|
||||
local data = code_action.data.id
|
||||
return string.sub(data, #data - 1, #data) == ":0"
|
||||
end,
|
||||
apply = true
|
||||
}) end)
|
||||
nnoremap("<leader>gr", function() vim.lsp.buf.references() end)
|
||||
nnoremap("<leader>rn", function() vim.lsp.buf.rename() end)
|
||||
inoremap("<C-h>", function() vim.lsp.buf.signature_help() end)
|
||||
nnoremap("<leader>f", function() vim.lsp.buf.format({ async = true }) end)
|
||||
end,
|
||||
}, _config or {})
|
||||
end
|
||||
|
||||
require("lspconfig").zls.setup(config())
|
||||
|
||||
require("lspconfig").tsserver.setup(config())
|
||||
|
||||
require("lspconfig").ccls.setup(config())
|
||||
|
||||
require("lspconfig").jedi_language_server.setup(config())
|
||||
|
||||
require("lspconfig").svelte.setup(config())
|
||||
|
||||
require("lspconfig").solang.setup(config())
|
||||
|
||||
require("lspconfig").cssls.setup(config())
|
||||
|
||||
require("lspconfig").gopls.setup(config({
|
||||
cmd = { "gopls", "serve" },
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedparams = true,
|
||||
},
|
||||
staticcheck = true,
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
-- who even uses this?
|
||||
require("lspconfig").rust_analyzer.setup(config({
|
||||
cmd = { "rustup", "run", "nightly", "rust-analyzer" },
|
||||
--[[
|
||||
settings = {
|
||||
rust = {
|
||||
unstable_features = true,
|
||||
build_on_save = false,
|
||||
all_features = true,
|
||||
},
|
||||
}
|
||||
--]]
|
||||
}))
|
||||
|
||||
require("lspconfig").sumneko_lua.setup(config({
|
||||
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||
version = "LuaJIT",
|
||||
-- Setup your lua path
|
||||
path = vim.split(package.path, ";"),
|
||||
},
|
||||
diagnostics = {
|
||||
-- Get the language server to recognize the `vim` global
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
-- Make the server aware of Neovim runtime files
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
local opts = {
|
||||
-- whether to highlight the currently hovered symbol
|
||||
-- disable if your cpu usage is higher than you want it
|
||||
-- or you just hate the highlight
|
||||
-- default: true
|
||||
highlight_hovered_item = true,
|
||||
|
||||
-- whether to show outline guides
|
||||
-- default: true
|
||||
show_guides = true,
|
||||
}
|
||||
|
||||
require("symbols-outline").setup(opts)
|
||||
|
||||
local snippets_paths = function()
|
||||
local plugins = { "friendly-snippets" }
|
||||
local paths = {}
|
||||
local path
|
||||
local root_path = vim.env.HOME .. "/.vim/plugged/"
|
||||
for _, plug in ipairs(plugins) do
|
||||
path = root_path .. plug
|
||||
if vim.fn.isdirectory(path) ~= 0 then
|
||||
table.insert(paths, path)
|
||||
end
|
||||
end
|
||||
return paths
|
||||
end
|
||||
|
||||
require("luasnip.loaders.from_vscode").lazy_load({
|
||||
paths = snippets_paths(),
|
||||
include = nil, -- Load all languages
|
||||
exclude = {},
|
||||
})
|
||||
|
@ -0,0 +1,7 @@
|
||||
require('lualine').setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -0,0 +1,33 @@
|
||||
local mason_status, mason = pcall(require, "mason")
|
||||
if not mason_status then
|
||||
return
|
||||
end
|
||||
|
||||
local mason_lspconfig_status, mason_lspconfig = pcall(require, "mason-lspconfig")
|
||||
if not mason_lspconfig_status then
|
||||
return
|
||||
end
|
||||
|
||||
local mason_null_ls_status, mason_null_ls = pcall(require, "mason-null-ls")
|
||||
if not mason_null_ls_status then
|
||||
return
|
||||
end
|
||||
|
||||
mason.setup()
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {
|
||||
"tsserver",
|
||||
"html",
|
||||
"cssls",
|
||||
"sumneko_lua",
|
||||
}
|
||||
})
|
||||
|
||||
mason_null_ls.setup({
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
"stylua",
|
||||
"eslint_d",
|
||||
}
|
||||
})
|
@ -0,0 +1,31 @@
|
||||
local setup, null_ls = pcall(require, "null-ls")
|
||||
if not setup then
|
||||
return
|
||||
end
|
||||
|
||||
local formatting = null_ls.builtins.formatting
|
||||
local diagnostics = null_ls.builtins.diagnostics
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
formatting.prettier,
|
||||
formatting.stylua,
|
||||
diagnostics.eslint_d
|
||||
},
|
||||
-- format on save
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
||||
vim.lsp.buf.format({ bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
@ -0,0 +1,36 @@
|
||||
require("nvim-treesitter.configs").setup({
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "ruby", "typescript", "javascript", "lua", "rust" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
|
||||
---- If you need to change the installation directory of the parsers (see -> Advanced Setup)
|
||||
-- parser_install_dir = "/some/path/to/store/parsers", -- Remember to run vim.opt.runtimepath:append("/some/path/to/store/parsers")!
|
||||
|
||||
indent = { enable = true },
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- Or use a function for more flexibility, e.g. to disable slow treesitter highlight for large files
|
||||
disable = function(_, buf)
|
||||
local max_filesize = 100 * 1024 -- 100 KB
|
||||
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
||||
if ok and stats and stats.size > max_filesize then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
})
|
@ -1,19 +0,0 @@
|
||||
{
|
||||
"coc.preferences.formatOnSaveFiletypes": [
|
||||
"css",
|
||||
"markdown",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"go",
|
||||
"ruby"
|
||||
],
|
||||
"eslint.autoFixOnSave": true,
|
||||
"diagnostic.checkCurrentLine": true,
|
||||
"codeLens.enabled": true,
|
||||
"solargraph.autoformat": true,
|
||||
"solargraph.formatting": true,
|
||||
"solargraph.hover": true,
|
||||
"solargraph.diagnostics": true,
|
||||
"solargraph.checkGemVersion": false
|
||||
}
|
@ -0,0 +1 @@
|
||||
require('rahcodes')
|
@ -1,132 +0,0 @@
|
||||
let mapleader = " "
|
||||
vnoremap J :m '>+1<CR>gv=gv
|
||||
vnoremap K :m '<-2<CR>gv=gv
|
||||
|
||||
nnoremap / /\v
|
||||
vnoremap / /\v
|
||||
nnoremap <leader>/ :Rg<space>
|
||||
vnoremap <leader>/ :Rg<space>
|
||||
nnoremap <leader>` :noh<cr>
|
||||
|
||||
" No Cheating
|
||||
nnoremap <up> <nop>
|
||||
nnoremap <down> <nop>
|
||||
nnoremap <left> <nop>
|
||||
nnoremap <right> <nop>
|
||||
inoremap <up> <nop>
|
||||
inoremap <down> <nop>
|
||||
inoremap <left> <nop>
|
||||
inoremap <right> <nop>
|
||||
|
||||
" No weird line jumps
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
|
||||
" FZF Bindings
|
||||
noremap <leader><leader> :GFiles<CR>
|
||||
noremap <leader>pf :Files<CR>
|
||||
nnoremap <leader>C :Colors<CR>
|
||||
nnoremap <leader>B :Buffers<CR>
|
||||
nnoremap <leader>fl :Lines<CR>
|
||||
noremap <leader>m :History<CR>
|
||||
noremap <leader>/ :Rg<space>
|
||||
|
||||
" Use fuzzy completion relative filepaths across directory
|
||||
imap <expr> <c-x><c-f> fzf#vim#complete#path('git ls-files $(git rev-parse --show-toplevel)')
|
||||
|
||||
" Better command history with q:
|
||||
command! CmdHist call fzf#vim#command_history({'right': '40'})
|
||||
nnoremap q: :CmdHist<CR>
|
||||
|
||||
" Better search history
|
||||
command! QHist call fzf#vim#search_history({'right': '40'})
|
||||
nnoremap q/ :QHist<CR>
|
||||
|
||||
command! -bang -nargs=* Ack call fzf#vim#ag(<q-args>, {'down': '40%', 'options': --no-color'})
|
||||
|
||||
inoremap <F1> <ESC>
|
||||
nnoremap <F1> <ESC>
|
||||
vnoremap <F1> <ESC>
|
||||
|
||||
inoremap hh <ESC>
|
||||
|
||||
" - Avoid using standard Vim directory names like 'plugin'
|
||||
call plug#begin()
|
||||
|
||||
Plug 'gruvbox-community/gruvbox'
|
||||
Plug 'tpope/vim-repeat'
|
||||
Plug 'tpope/vim-surround'
|
||||
Plug 'tpope/vim-fugitive'
|
||||
Plug 'vim-airline/vim-airline'
|
||||
Plug 'vim-airline/vim-airline-themes'
|
||||
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'stsewd/fzf-checkout.vim'
|
||||
Plug 'leafgarland/typescript-vim'
|
||||
Plug 'airblade/vim-gitgutter'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'tpope/vim-rhubarb'
|
||||
Plug 'thesis/vim-solidity'
|
||||
Plug 'vim-test/vim-test'
|
||||
|
||||
" Initialize plugin system
|
||||
call plug#end()
|
||||
|
||||
syntax on
|
||||
let g:gruvbox_contrast_dark = 'hard'
|
||||
let g:gruvbox_italic=1
|
||||
let g:gruvbox_invert_selection='0'
|
||||
set termguicolors
|
||||
set background=dark
|
||||
|
||||
augroup RAH_CODES
|
||||
autocmd!
|
||||
autocmd vimenter * ++nested colorscheme gruvbox
|
||||
augroup END
|
||||
|
||||
"let g:netrw_banner = 0
|
||||
"let g:netrw_liststyle = 3
|
||||
"let g:netrw_browse_split = 4
|
||||
"let g:netrw_altv = 1
|
||||
"let g:netrw_winsize = 25
|
||||
"augroup ProjectDrawer
|
||||
" autocmd!
|
||||
" autocmd VimEnter * :Vexplore
|
||||
"augroup END
|
||||
nnoremap <leader>pv :Vex<CR>
|
||||
|
||||
let g:airline_powerline_fonts = 1
|
||||
let g:airline#extensions#tGabline#enabled = 1
|
||||
|
||||
" Completion
|
||||
set completeopt=menuone,noinsert,noselect
|
||||
let g:completion_matching_strategy_list = ['exact', 'substring', 'fuzzy']
|
||||
|
||||
" Git Fugitive
|
||||
nnoremap <leader>gs :G<CR>
|
||||
nnoremap <leader>gh :diffget //3<CR>
|
||||
nnoremap <leader>gu :diffget //2<CR>
|
||||
nnoremap <leader>gc :GCheckout<CR>
|
||||
nnoremap <leader>ga :G add %:p<CR><CR>
|
||||
nnoremap <leader>gc :G commit -v -q<CR>
|
||||
nnoremap <leader>gt :G commit -v -q %:p<CR>
|
||||
nnoremap <leader>gca :G commit --amend --no-edit<CR>
|
||||
nnoremap <leader>gd :Gdiff<CR>
|
||||
nnoremap <leader>ge :Gedit<CR>
|
||||
nnoremap <leader>gr :Gread<CR>
|
||||
nnoremap <leader>gw :Gwrite<CR><CR>
|
||||
nnoremap <leader>gl :silent! Glog<CR>:bot copen<CR>
|
||||
nnoremap <leader>gp :Ggrep<Space>
|
||||
nnoremap <leader>gm :Gmove<Space>
|
||||
nnoremap <leader>gb :G branch<Space>
|
||||
nnoremap <leader>go :G checkout<Space>
|
||||
nnoremap <leader>gps :Dispatch! git push<CR>
|
||||
nnoremap <leader>gpl :Dispatch! git pull<CR>
|
||||
|
||||
" Copy to system clipboard
|
||||
vnoremap <leader>y "*y
|
||||
vnoremap <leader>yy "+y
|
||||
|
||||
" Move buffers
|
||||
nmap sp :bprev<Return>
|
||||
nmap sn :bnext<Return>
|
@ -0,0 +1,3 @@
|
||||
require("rahcodes.set")
|
||||
require("rahcodes.remap")
|
||||
require("rahcodes.packer")
|
@ -0,0 +1,20 @@
|
||||
local M = {}
|
||||
|
||||
local function bind(op, outer_opts)
|
||||
outer_opts = outer_opts or {noremap = true}
|
||||
return function(lhs, rhs, opts)
|
||||
opts = vim.tbl_extend("force",
|
||||
outer_opts,
|
||||
opts or {}
|
||||
)
|
||||
vim.keymap.set(op, lhs,rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
M.nmap = bind("n", {noremap = false})
|
||||
M.nnoremap = bind("n")
|
||||
M.vnoremap = bind("v")
|
||||
M.xnoremap = bind("x")
|
||||
M.inoremap = bind("i")
|
||||
|
||||
return M
|
@ -0,0 +1,80 @@
|
||||
-- This file can be loaded by calling `lua require('plugins')` from your init.vim
|
||||
local ensure_packer = function()
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath("data") .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
fn.system({ "git", "clone", "--depth", "1", "https://github.com/wbthomason/packer.nvim", install_path })
|
||||
vim.cmd([[packadd packer.nvim]])
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local packer_bootstrap = ensure_packer()
|
||||
|
||||
return require("packer").startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
use("folke/tokyonight.nvim")
|
||||
use({
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.0",
|
||||
requires = { { "nvim-lua/plenary.nvim" } },
|
||||
})
|
||||
use({
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = function()
|
||||
local ts_update = require("nvim-treesitter.install").update({ with_sync = true })
|
||||
ts_update()
|
||||
end,
|
||||
})
|
||||
use({ "williamboman/mason.nvim" })
|
||||
use({ "williamboman/mason-lspconfig.nvim" })
|
||||
|
||||
-- configure lsp servers
|
||||
use("neovim/nvim-lspconfig")
|
||||
use("hrsh7th/cmp-nvim-lsp")
|
||||
use("hrsh7th/cmp-buffer")
|
||||
use("hrsh7th/nvim-cmp")
|
||||
-- use("tzachar/cmp-tabnine", { run = "./install.sh" })
|
||||
use("onsails/lspkind-nvim")
|
||||
use("nvim-lua/lsp_extensions.nvim")
|
||||
use("glepnir/lspsaga.nvim")
|
||||
use("simrat39/symbols-outline.nvim")
|
||||
use("L3MON4D3/LuaSnip")
|
||||
use("saadparwaiz1/cmp_luasnip")
|
||||
|
||||
-- formatting & linting
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
use("jayp0521/mason-null-ls.nvim")
|
||||
|
||||
use({
|
||||
"nvim-lualine/lualine.nvim",
|
||||
requires = { "nvim-tree/nvim-web-devicons", opt = true },
|
||||
})
|
||||
|
||||
use({
|
||||
"lewis6991/gitsigns.nvim",
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
})
|
||||
|
||||
use({
|
||||
"folke/trouble.nvim",
|
||||
requires = "kyazdani42/nvim-web-devicons",
|
||||
config = function()
|
||||
require("trouble").setup({
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
-- Automatically set up your configuration after cloning packer.nvim
|
||||
-- Put this at the end after all plugins
|
||||
if packer_bootstrap then
|
||||
require("packer").sync()
|
||||
end
|
||||
end)
|
@ -0,0 +1,14 @@
|
||||
local nnoremap = require("rahcodes.keymap").nnoremap
|
||||
|
||||
nnoremap("<leader>pv", "<cmd>Ex<CR>")
|
||||
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
||||
|
||||
vim.keymap.set('n', '<leader>m', builtin.oldfiles, {})
|
||||
vim.keymap.set('n', '<leader>gb', builtin.git_branches, {})
|
||||
vim.keymap.set('n', '<leader>gs', builtin.git_status, {})
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.git_files, {})
|
@ -0,0 +1,22 @@
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
vim.g.netrw_browse_split = 0
|
||||
vim.g.netrw_banner = 0
|
||||
vim.g.netrw_winsize = 25
|
||||
|
@ -1,114 +0,0 @@
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ <SID>check_back_space() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! s:check_back_space() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
if has('nvim')
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
else
|
||||
inoremap <silent><expr> <c-@> coc#refresh()
|
||||
endif
|
||||
|
||||
" Make <CR> auto-select the first completion item and notify coc.nvim to
|
||||
" format on enter, <cr> could be remapped by other vim plugin
|
||||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||
|
||||
function! s:show_documentation()
|
||||
if (index(['vim','help'], &filetype) >= 0)
|
||||
execute 'h '.expand('<cword>')
|
||||
elseif (coc#rpc#ready())
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
execute '!' . &keywordprg . " " . expand('<cword>')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
|
||||
augroup mygroup
|
||||
autocmd!
|
||||
" Setup formatexpr specified filetype(s).
|
||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||
" Update signature help on jump placeholder.
|
||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||
augroup end
|
||||
|
||||
" Applying codeAction to the selected region.
|
||||
" Example: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap keys for applying codeAction to the current buffer.
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Apply AutoFix to problem on the current line.
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
command! -nargs=0 Prettier :CocCommand prettier.formatFile
|
||||
|
||||
" Add `:Format` command to format current buffer.
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer.
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer.
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" <M-Esc>" Remap <C-f> and <C-b> for scroll float windows/popups.
|
||||
if has('nvim-0.4.0') || has('patch-8.2.0750')
|
||||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>"
|
||||
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>"
|
||||
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>"
|
||||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>"
|
||||
endif
|
||||
|
||||
let g:coc_global_extensions = [
|
||||
\'coc-tsserver',
|
||||
\'coc-css',
|
||||
\'coc-eslint',
|
||||
\'coc-highlight',
|
||||
\'coc-html',
|
||||
\'coc-prettier',
|
||||
\'coc-solargraph',
|
||||
\'coc-vimlsp',
|
||||
\'coc-actions',
|
||||
\'coc-go',
|
||||
\'coc-explorer',
|
||||
\'coc-json',
|
||||
\'coc-git'
|
||||
\]
|
||||
|
@ -0,0 +1,220 @@
|
||||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.inside_compile = true
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
if threshold then
|
||||
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||
end
|
||||
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/home/striderz/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
config = { "\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
["lsp_extensions.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lsp_extensions.nvim",
|
||||
url = "https://github.com/nvim-lua/lsp_extensions.nvim"
|
||||
},
|
||||
["lspkind-nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lspkind-nvim",
|
||||
url = "https://github.com/onsails/lspkind-nvim"
|
||||
},
|
||||
["lspsaga.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lspsaga.nvim",
|
||||
url = "https://github.com/glepnir/lspsaga.nvim"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||
},
|
||||
["mason-null-ls.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/mason-null-ls.nvim",
|
||||
url = "https://github.com/jayp0521/mason-null-ls.nvim"
|
||||
},
|
||||
["mason.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||
url = "https://github.com/williamboman/mason.nvim"
|
||||
},
|
||||
["null-ls.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
|
||||
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = false,
|
||||
needs_bufread = false,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/opt/nvim-web-devicons",
|
||||
url = "https://github.com/nvim-tree/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["symbols-outline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/symbols-outline.nvim",
|
||||
url = "https://github.com/simrat39/symbols-outline.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["tokyonight.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
|
||||
url = "https://github.com/folke/tokyonight.nvim"
|
||||
},
|
||||
["trouble.nvim"] = {
|
||||
config = { "\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0" },
|
||||
loaded = true,
|
||||
path = "/home/striderz/.local/share/nvim/site/pack/packer/start/trouble.nvim",
|
||||
url = "https://github.com/folke/trouble.nvim"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
-- Config for: trouble.nvim
|
||||
time([[Config for trouble.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n9\0\0\3\0\3\0\a6\0\0\0'\2\1\0B\0\2\0029\0\2\0004\2\0\0B\0\2\1K\0\1\0\nsetup\ftrouble\frequire\0", "config", "trouble.nvim")
|
||||
time([[Config for trouble.nvim]], false)
|
||||
-- Config for: gitsigns.nvim
|
||||
time([[Config for gitsigns.nvim]], true)
|
||||
try_loadstring("\27LJ\2\n6\0\0\3\0\3\0\0066\0\0\0'\2\1\0B\0\2\0029\0\2\0B\0\1\1K\0\1\0\nsetup\rgitsigns\frequire\0", "config", "gitsigns.nvim")
|
||||
time([[Config for gitsigns.nvim]], false)
|
||||
|
||||
_G._packer.inside_compile = false
|
||||
if _G._packer.needs_bufread == true then
|
||||
vim.cmd("doautocmd BufRead")
|
||||
end
|
||||
_G._packer.needs_bufread = false
|
||||
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
@ -1,58 +0,0 @@
|
||||
|
||||
set rtp+=/usr/local/opt/fzf
|
||||
set background=dark
|
||||
set nowrap
|
||||
set textwidth=79
|
||||
set formatoptions=qrn1
|
||||
|
||||
set ignorecase
|
||||
set smartcase
|
||||
set gdefault
|
||||
|
||||
set incsearch
|
||||
set showmatch
|
||||
set hlsearch
|
||||
set nocompatible
|
||||
set exrc
|
||||
|
||||
set modelines=0
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set softtabstop=4
|
||||
set expandtab
|
||||
|
||||
set encoding=utf-8
|
||||
set scrolloff=8
|
||||
set autoindent
|
||||
set smartindent
|
||||
set showmode
|
||||
set showcmd
|
||||
set cmdheight=2
|
||||
set hidden
|
||||
set wildmenu
|
||||
set wildmode=list:longest
|
||||
set visualbell
|
||||
set cursorline
|
||||
set ttyfast
|
||||
set ruler
|
||||
set backspace=indent,eol,start
|
||||
set laststatus=2
|
||||
set relativenumber
|
||||
set nu
|
||||
set noswapfile
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
set undodir=~/.config/nvim/undodir
|
||||
set undofile
|
||||
set signcolumn=yes
|
||||
set colorcolumn=80
|
||||
|
||||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
" delays and poor user experience.
|
||||
set updatetime=300
|
||||
|
||||
" Don't pass messages to |ins-completion-menu|.
|
||||
set shortmess+=c
|
||||
|
||||
set grepprg=rg\ --vimgrep\ --smart-case\ --follow
|
||||
|
Loading…
Reference in New Issue