NeoVim clean and updated config
This commit is contained in:
1
.config/nvim/.gitignore
vendored
Normal file
1
.config/nvim/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
plugin/packer_compiled.lua
|
||||
@@ -1,59 +0,0 @@
|
||||
{
|
||||
"explorer.keyMappings": {
|
||||
"k": "nodePrev",
|
||||
"j": "nodeNext",
|
||||
|
||||
"*": "toggleSelection",
|
||||
"<tab>": "actionMenu",
|
||||
|
||||
"<Left>": "collapse",
|
||||
"<Right>": "expand",
|
||||
"J": ["toggleSelection", "normal:j"],
|
||||
"K": ["toggleSelection", "normal:k"],
|
||||
"gl": "expandRecursive",
|
||||
"gh": "collapseRecursive",
|
||||
"o": "expandOrCollapse",
|
||||
"<cr>": "open",
|
||||
"e": "open",
|
||||
"E": "openInVsplit",
|
||||
"t": "openInTab",
|
||||
"<bs>": "gotoParent",
|
||||
|
||||
"y": "copyFilepath",
|
||||
"Y": "copyFilename",
|
||||
"c": "copyFile",
|
||||
"x": "cutFile",
|
||||
"p": "pasteFile",
|
||||
"d": "delete",
|
||||
"D": "deleteForever",
|
||||
|
||||
"a": "addFile",
|
||||
"A": "addDirectory",
|
||||
"r": "rename",
|
||||
|
||||
".": "toggleHidden",
|
||||
"R": "refresh",
|
||||
|
||||
"?": "help",
|
||||
"q": "quit",
|
||||
"X": "systemExecute",
|
||||
"gd": "listDrive",
|
||||
|
||||
"f": "search",
|
||||
"F": "searchRecursive",
|
||||
|
||||
"gf": "gotoSource:file",
|
||||
"gb": "gotoSource:buffer",
|
||||
|
||||
"[[": "sourcePrev",
|
||||
"]]": "sourceNext",
|
||||
|
||||
"[d": "diagnosticPrev",
|
||||
"]d": "diagnosticNext",
|
||||
|
||||
"[c": "gitPrev",
|
||||
"]c": "gitNext",
|
||||
"<<": "gitStage",
|
||||
">>": "gitUnstage"
|
||||
}
|
||||
}
|
||||
132
.config/nvim/init.lua
Normal file
132
.config/nvim/init.lua
Normal file
@@ -0,0 +1,132 @@
|
||||
require 'plugins'
|
||||
|
||||
|
||||
require 'popup'
|
||||
|
||||
|
||||
vim.g.solarized_italic_comments = true
|
||||
vim.g.solarized_italic_keywords = true
|
||||
vim.g.solarized_italic_functions = true
|
||||
vim.g.solarized_italic_variables = false
|
||||
vim.g.solarized_contrast = true
|
||||
vim.g.solarized_borders = false
|
||||
vim.g.solarized_disable_background = false
|
||||
require('solarized').set()
|
||||
|
||||
|
||||
require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { "c", "lua", "rust", "java", "python", "javascript", "typescript" },
|
||||
sync_install = false,
|
||||
ignore_install = { },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
disable = { },
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
require('feline').setup {
|
||||
theme = require('feline.solarized'),
|
||||
force_inactive = {
|
||||
filetypes = {
|
||||
'^neo\\-tree$',
|
||||
'^packer$',
|
||||
'^startify$',
|
||||
'^fugitive$',
|
||||
'^fugitiveblame$',
|
||||
'^qf$',
|
||||
'^help$'
|
||||
},
|
||||
buftypes = {
|
||||
'^terminal$'
|
||||
},
|
||||
bufnames = {
|
||||
'neo\\-.*',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
require('nvim-lsp-installer').setup {}
|
||||
require('lspconfig/settings')
|
||||
|
||||
|
||||
require('window-picker').setup({
|
||||
autoselect_one = false
|
||||
})
|
||||
autoselect_one = true,
|
||||
|
||||
|
||||
vim.cmd([[ let g:neo_tree_remove_legacy_commands = 1 ]])
|
||||
require('neo-tree').setup({
|
||||
window = {
|
||||
width = 30,
|
||||
mappings = {
|
||||
["<cr>"] = "open_with_window_picker",
|
||||
}
|
||||
},
|
||||
filesystem = {
|
||||
filtered_items = {
|
||||
visible = true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
require('smart-splits')
|
||||
vim.keymap.set("n", "<C-Left>", require('smart-splits').move_cursor_left)
|
||||
vim.keymap.set("n", "<C-Down>", require('smart-splits').move_cursor_down)
|
||||
vim.keymap.set("n", "<C-Up>", require('smart-splits').move_cursor_up)
|
||||
vim.keymap.set("n", "<C-Right>", require('smart-splits').move_cursor_right)
|
||||
vim.keymap.set("n", "<C-k>", require('smart-splits').resize_up)
|
||||
vim.keymap.set("n", "<C-j>", require('smart-splits').resize_down)
|
||||
vim.keymap.set("n", "<C-h>", require('smart-splits').resize_left)
|
||||
vim.keymap.set("n", "<C-l>", require('smart-splits').resize_right)
|
||||
|
||||
|
||||
local colors = require('solarized.colors')
|
||||
require('bufferline').setup{
|
||||
options = {
|
||||
offsets = {{filetype = "neo-tree", text = "File Explorer", padding = 1}},
|
||||
enforce_regular_tabs = true,
|
||||
separator_style = 'slant'
|
||||
},
|
||||
highlights = {
|
||||
separator = {
|
||||
guifg = colors.bg_alt
|
||||
},
|
||||
separator_visible = {
|
||||
guifg = colors.bg_alt
|
||||
},
|
||||
separator_selected = {
|
||||
guifg = colors.bg_alt
|
||||
}
|
||||
}
|
||||
}
|
||||
vim.keymap.set("n", "<S-Right>", "<cmd>bnext<CR>", opts)
|
||||
vim.keymap.set("n", "<S-Left>", "<cmd>bprevious<CR>", opts)
|
||||
|
||||
|
||||
require('nvim-autopairs').setup{}
|
||||
|
||||
|
||||
require('gitsigns').setup()
|
||||
|
||||
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
vim.o.expandtab = true
|
||||
vim.o.fileencoding = 'utf-8'
|
||||
vim.o.ignorecase = true
|
||||
vim.o.mouse = 'a'
|
||||
vim.o.showmode = false
|
||||
vim.o.number = true
|
||||
vim.o.shiftwidth = 2
|
||||
vim.o.signcolumn = 'yes'
|
||||
vim.o.smartcase = true
|
||||
vim.o.spelllang = 'en'
|
||||
vim.o.tabstop = 2
|
||||
|
||||
|
||||
require("neo-tree.command")._command(vim.fn.getcwd())
|
||||
@@ -1,151 +0,0 @@
|
||||
tnoremap <Esc> <C-\><C-n>
|
||||
|
||||
set termguicolors
|
||||
"set colorcolumn=88
|
||||
set background=dark
|
||||
set number
|
||||
match Error /\%>88c/
|
||||
|
||||
highlight Pmenu ctermbg=gray guibg=gray
|
||||
|
||||
" if hidden is not set, TextEdit might fail.
|
||||
set hidden
|
||||
|
||||
" Some servers have issues with backup files, see #649
|
||||
set nobackup
|
||||
set nowritebackup
|
||||
|
||||
" Better display for messages
|
||||
set cmdheight=2
|
||||
|
||||
" You will have bad experience for diagnostic messages when it's default 4000.
|
||||
set updatetime=300
|
||||
|
||||
" don't give |ins-completion-menu| messages.
|
||||
set shortmess+=c
|
||||
|
||||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
||||
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.
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
|
||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
||||
" Coc only does snippet and additional edit on confirm.
|
||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
" Or use `complete_info` if your vim support it, like:
|
||||
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Remap keys for gotos
|
||||
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>')
|
||||
else
|
||||
call CocAction('doHover')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Highlight symbol under cursor on CursorHold
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Remap for rename current word
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
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
|
||||
|
||||
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||
|
||||
" Remap for do codeAction of current line
|
||||
nmap <leader>ac <Plug>(coc-codeaction)
|
||||
" Fix autofix problem of current line
|
||||
nmap <leader>qf <Plug>(coc-fix-current)
|
||||
|
||||
" Create mappings for function text object, requires document symbols feature of
|
||||
" languageserver.
|
||||
xmap if <Plug>(coc-funcobj-i)
|
||||
xmap af <Plug>(coc-funcobj-a)
|
||||
omap if <Plug>(coc-funcobj-i)
|
||||
omap af <Plug>(coc-funcobj-a)
|
||||
|
||||
" Use <TAB> for select selections ranges, needs server support, like: coc-tsserver,
|
||||
" coc-python
|
||||
nmap <silent> <TAB> <Plug>(coc-range-select)
|
||||
xmap <silent> <TAB> <Plug>(coc-range-select)
|
||||
|
||||
" Use `:Format` to format current buffer
|
||||
command! -nargs=0 Format :call CocAction('format')
|
||||
|
||||
" Use `:Fold` to fold current buffer
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" use `:OR` for organize import of current buffer
|
||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
" Using CocList
|
||||
" Show all diagnostics
|
||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||
" Manage extensions
|
||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||
" Show commands
|
||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||
" Find symbol of current document
|
||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||
" Search workspace symbols
|
||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||
" Do default action for next item.
|
||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||
" Do default action for previous item.
|
||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||
" Resume latest coc list
|
||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||
|
||||
" coc-explorer
|
||||
nmap <leader>e :CocCommand explorer<CR>
|
||||
|
||||
call plug#begin()
|
||||
Plug 'rbgrouleff/bclose.vim'
|
||||
Plug 'francoiscabrol/ranger.vim'
|
||||
Plug 'neoclide/coc.nvim', {'branch': 'release'}
|
||||
Plug 'lervag/vimtex'
|
||||
Plug 'iCyMind/NeoSolarized'
|
||||
call plug#end()
|
||||
|
||||
colorscheme NeoSolarized
|
||||
|
||||
set clipboard=unnamedplus
|
||||
19
.config/nvim/lua/feline/solarized.lua
Normal file
19
.config/nvim/lua/feline/solarized.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local colors = require('solarized.colors')
|
||||
|
||||
local solarized = {
|
||||
fg = colors.fg,
|
||||
bg = colors.bg_alt,
|
||||
black = colors.black,
|
||||
skyblue = colors.paleblue,
|
||||
cyan = colors.cyan,
|
||||
green = colors.green,
|
||||
oceanblue = colors.blue,
|
||||
magenta = colors.magenta,
|
||||
orange = colors.orange,
|
||||
red = colors.red,
|
||||
violet = colors.purple,
|
||||
white = colors.white,
|
||||
yellow = colors.yellow
|
||||
}
|
||||
|
||||
return solarized
|
||||
46
.config/nvim/lua/lspconfig/settings.lua
Normal file
46
.config/nvim/lua/lspconfig/settings.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
-- Mappings.
|
||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||
local opts = { noremap=true, silent=true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap=true, silent=true, buffer=bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, bufopts)
|
||||
end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { 'pyright', 'sumneko_lua' }
|
||||
for _, lsp in pairs(servers) do
|
||||
require('lspconfig')[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
flags = {
|
||||
-- This will be the default in neovim 0.7+
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
}
|
||||
end
|
||||
37
.config/nvim/lua/plugins.lua
Normal file
37
.config/nvim/lua/plugins.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
return require('packer').startup(function()
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use 'nvim-lua/popup.nvim'
|
||||
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate'
|
||||
}
|
||||
|
||||
use {'feline-nvim/feline.nvim', requires = 'kyazdani42/nvim-web-devicons'}
|
||||
|
||||
use {
|
||||
"williamboman/nvim-lsp-installer",
|
||||
"neovim/nvim-lspconfig",
|
||||
}
|
||||
|
||||
use {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
branch = "v2.x",
|
||||
requires = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"kyazdani42/nvim-web-devicons",
|
||||
"MunifTanjim/nui.nvim",
|
||||
's1n7ax/nvim-window-picker'
|
||||
}
|
||||
}
|
||||
|
||||
use('mrjones2014/smart-splits.nvim')
|
||||
|
||||
use {'akinsho/bufferline.nvim', tag = "v2.*", requires = 'kyazdani42/nvim-web-devicons'}
|
||||
|
||||
use('windwp/nvim-autopairs')
|
||||
|
||||
use('lewis6991/gitsigns.nvim')
|
||||
|
||||
end)
|
||||
1
.config/nvim/solarized.nvim
Submodule
1
.config/nvim/solarized.nvim
Submodule
Submodule .config/nvim/solarized.nvim added at e14555132d
Reference in New Issue
Block a user