Compare commits
8 Commits
a3d16cbff2
...
f796d0775e
Author | SHA1 | Date | |
---|---|---|---|
f796d0775e | |||
ffb20ec8a4 | |||
1734908df0 | |||
01d09bc9c0 | |||
4324070cac | |||
ebdb4420b6 | |||
171c63a070 | |||
46a53b7c38 |
@ -38,7 +38,9 @@ local lsp_symbols = {
|
||||
TypeParameter = " (TypeParameter)",
|
||||
}
|
||||
|
||||
local cmp = require'cmp'
|
||||
local status, cmp = pcall(require, "cmp")
|
||||
if (not status) then return end
|
||||
|
||||
cmp.setup{
|
||||
completion = {
|
||||
completeopt = 'menuone,noinsert,noselect',
|
||||
|
@ -1,9 +1,8 @@
|
||||
local autopairs_status_ok, autopairs = pcall(require, "nvim-autopairs")
|
||||
if not autopairs_status_ok then
|
||||
return
|
||||
end
|
||||
local status, autopairs = pcall(require, "nvim-autopairs")
|
||||
if (not status) then return end
|
||||
|
||||
autopairs.setup{
|
||||
ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]],"%s+", ""),
|
||||
disable_filetype = { "TelescopePrompt" , "vim" },
|
||||
ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]],"%s+", ""),
|
||||
}
|
||||
|
||||
|
1
nvim/.config/nvim/lua/config/gitsigns.lua
Normal file
1
nvim/.config/nvim/lua/config/gitsigns.lua
Normal file
@ -0,0 +1 @@
|
||||
require('gitsigns').setup {}
|
@ -1,46 +1,91 @@
|
||||
local status, telescope = pcall(require, "telescope")
|
||||
if (not status) then return end
|
||||
local builtin = require("telescope.builtin")
|
||||
|
||||
local previewers = require('telescope.previewers')
|
||||
local Job = require('plenary.job')
|
||||
local new_maker = function(filepath, bufnr, opts)
|
||||
filepath = vim.fn.expand(filepath)
|
||||
Job:new({
|
||||
command = 'file',
|
||||
args = { '--mime-type', '-b', filepath },
|
||||
on_exit = function(j)
|
||||
local mime_type = vim.split(j:result()[1], '/')[1]
|
||||
if mime_type == "text" then
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
else
|
||||
-- maybe we want to write something to the buffer here
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' })
|
||||
end)
|
||||
end
|
||||
end
|
||||
}):sync()
|
||||
filepath = vim.fn.expand(filepath)
|
||||
Job:new({
|
||||
command = 'file',
|
||||
args = { '--mime-type', '-b', filepath },
|
||||
on_exit = function(j)
|
||||
local mime_type = vim.split(j:result()[1], '/')[1]
|
||||
if mime_type == "text" then
|
||||
previewers.buffer_previewer_maker(filepath, bufnr, opts)
|
||||
else
|
||||
-- maybe we want to write something to the buffer here
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' })
|
||||
end)
|
||||
end
|
||||
end
|
||||
}):sync()
|
||||
end
|
||||
|
||||
require('telescope').setup {
|
||||
defaults = {
|
||||
buffer_previewer_maker = new_maker,
|
||||
file_ignore_patterns = {"**/*.pdf"},
|
||||
},
|
||||
local fb_actions = require "telescope".extensions.file_browser.actions
|
||||
local function telescope_buffer_dir()
|
||||
return vim.fn.expand('%:p:h')
|
||||
end
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
buffer_previewer_maker = new_maker,
|
||||
file_ignore_patterns = { "**/*.pdf" },
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
fuzzy = true, -- false will only do exact matching
|
||||
override_generic_sorter = true, -- override the generic sorter
|
||||
override_file_sorter = true, -- override the file sorter
|
||||
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
|
||||
-- the default case_mode is "smart_case"
|
||||
}
|
||||
}
|
||||
},
|
||||
file_browser = {
|
||||
theme = "dropdown",
|
||||
-- disables netrw and use telescope-file-browser in its place
|
||||
hijack_netrw = true,
|
||||
mappings = {
|
||||
["n"] = {
|
||||
-- your custom normal mode mappings
|
||||
["h"] = fb_actions.goto_parent_dir,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
require('telescope').load_extension('fzf')
|
||||
telescope.load_extension('fzf')
|
||||
telescope.load_extension('file_browser')
|
||||
|
||||
local map = vim.api.nvim_set_keymap
|
||||
-- Find files using Telescope command-line sugar.
|
||||
map('n', '<leader>e', '<cmd>Telescope find_files<cr>', {})
|
||||
map('n', '<leader>g', '<cmd>Telescope live_grep<cr>', {})
|
||||
map('n', '<leader>b', '<cmd>Telescope buffers<cr>', {})
|
||||
map('n', '<leader>h', '<cmd>Telescope help_tags<cr>', {})
|
||||
|
||||
-- keymaps
|
||||
vim.keymap.set('n', '<leader>e',
|
||||
function()
|
||||
builtin.find_files({
|
||||
})
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>g', function()
|
||||
builtin.live_grep()
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>b', function()
|
||||
builtin.buffers()
|
||||
end)
|
||||
vim.keymap.set('n', '<leader>h', function()
|
||||
builtin.resume()
|
||||
end)
|
||||
-- vim.keymap.set('n', '<leader>d', function()
|
||||
-- builtin.diagnostics()
|
||||
-- end)
|
||||
vim.keymap.set("n", "<leader>fb", function()
|
||||
telescope.extensions.file_browser.file_browser({
|
||||
path = "%:p:h",
|
||||
cwd = telescope_buffer_dir(),
|
||||
respect_gitignore = false,
|
||||
hidden = true,
|
||||
grouped = true,
|
||||
previewer = false,
|
||||
initial_mode = "normal",
|
||||
layout_config = { height = 40 }
|
||||
})
|
||||
end)
|
||||
|
@ -1,4 +1,7 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
local status, ts = pcall(require, "nvim-treesitter.configs")
|
||||
if (not status) then return end
|
||||
|
||||
ts.setup {
|
||||
-- One of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
ensure_installed = {"python", "css", "html", "lua", "javascript", "vue", "c", "markdown", "rst"},
|
||||
highlight = {
|
||||
|
@ -45,7 +45,7 @@ local on_attach = function(client, bufnr)
|
||||
buf_set_keymap('n', '<leader>df', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>dp', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
|
||||
-- Get diagnostic on local list
|
||||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts)
|
||||
buf_set_keymap("n", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
@ -56,7 +56,17 @@ end
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { "texlab", "pyright", "vuels", "tsserver", "html" }
|
||||
local servers = {
|
||||
"texlab",
|
||||
"pyright",
|
||||
"vuels",
|
||||
"tsserver",
|
||||
"html",
|
||||
"sumneko_lua",
|
||||
"ansiblels",
|
||||
"arduino_language_server",
|
||||
"clangd",
|
||||
}
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
|
@ -3,16 +3,16 @@ local fn = vim.fn
|
||||
-- Automatically install packer
|
||||
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
PACKER_BOOTSTRAP = fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
}
|
||||
print "Installing packer close and reopen Neovim..."
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
PACKER_BOOTSTRAP = fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--depth",
|
||||
"1",
|
||||
"https://github.com/wbthomason/packer.nvim",
|
||||
install_path,
|
||||
}
|
||||
print "Installing packer close and reopen Neovim..."
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
end
|
||||
|
||||
-- Autocommand that reloads neovim whenever you save the plugins.lua file
|
||||
@ -26,16 +26,16 @@ vim.cmd [[
|
||||
-- Use a protected call so we don't error out on first use
|
||||
local status_ok, packer = pcall(require, "packer")
|
||||
if not status_ok then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
-- Have packer use a popup window
|
||||
packer.init {
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "rounded" }
|
||||
end,
|
||||
},
|
||||
display = {
|
||||
open_fn = function()
|
||||
return require("packer.util").float { border = "rounded" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
return packer.startup(function(use)
|
||||
@ -50,7 +50,11 @@ return packer.startup(function(use)
|
||||
}
|
||||
|
||||
use 'tpope/vim-fugitive'
|
||||
use 'mhinz/vim-signify'
|
||||
-- use 'mhinz/vim-signify'
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
config = [[require('config.gitsigns')]],
|
||||
}
|
||||
|
||||
use 'tpope/vim-surround'
|
||||
use 'tpope/vim-repeat'
|
||||
@ -72,10 +76,10 @@ return packer.startup(function(use)
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
},
|
||||
}
|
||||
use {'hrsh7th/cmp-vsnip', after = 'nvim-cmp'}
|
||||
use {'hrsh7th/cmp-buffer', after = 'nvim-cmp'}
|
||||
use {'hrsh7th/cmp-path', after = 'nvim-cmp'}
|
||||
use {'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp'}
|
||||
use { 'hrsh7th/cmp-vsnip', after = 'nvim-cmp' }
|
||||
use { 'hrsh7th/cmp-buffer', after = 'nvim-cmp' }
|
||||
use { 'hrsh7th/cmp-path', after = 'nvim-cmp' }
|
||||
use { 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' }
|
||||
-- use {'f3fora/cmp-spell', after = 'nvim-cmp'}
|
||||
|
||||
-- for formatters and linters
|
||||
@ -89,17 +93,18 @@ return packer.startup(function(use)
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
config = [[require('config.telescope')]],
|
||||
requires = { 'nvim-lua/plenary.nvim'}
|
||||
requires = { 'nvim-lua/plenary.nvim' }
|
||||
}
|
||||
|
||||
use {'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
|
||||
use { "nvim-telescope/telescope-file-browser.nvim" }
|
||||
|
||||
use {
|
||||
'lervag/vimtex',
|
||||
config = [[require('config.vimtex')]],
|
||||
}
|
||||
|
||||
-- Highlight on Yank
|
||||
-- Highlight on Yank
|
||||
use 'machakann/vim-highlightedyank'
|
||||
-- Autoclose parenthesis
|
||||
-- use 'jiangmiao/auto-pairs'
|
||||
@ -121,7 +126,7 @@ return packer.startup(function(use)
|
||||
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
config=[[require('config.treesitter')]],
|
||||
config = [[require('config.treesitter')]],
|
||||
run = ':TSUpdate',
|
||||
}
|
||||
|
||||
|
@ -64,6 +64,7 @@
|
||||
],
|
||||
"description": "tabular"
|
||||
},
|
||||
|
||||
"minipage": {
|
||||
"prefix": "minipage",
|
||||
"body": [
|
||||
@ -73,6 +74,7 @@
|
||||
],
|
||||
"description": "minipage"
|
||||
},
|
||||
|
||||
"multicols": {
|
||||
"prefix": "multicols",
|
||||
"body": [
|
||||
@ -82,6 +84,16 @@
|
||||
],
|
||||
"description": "multicols"
|
||||
},
|
||||
|
||||
"image": {
|
||||
"prefix": "image",
|
||||
"body": [
|
||||
"\\\\includegraphics[scale=${1:1}]{${2:./fig/}}",
|
||||
"$0"
|
||||
],
|
||||
"description": "exercise xsim"
|
||||
},
|
||||
|
||||
"exercise": {
|
||||
"prefix": "exercise",
|
||||
"body": [
|
||||
@ -90,6 +102,5 @@
|
||||
"\\\\end{exercise}"
|
||||
],
|
||||
"description": "exercise xsim"
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ filetype *.7z
|
||||
fileviewer *.7z 7z l %c
|
||||
|
||||
" Office files
|
||||
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx libreoffice %f &
|
||||
filextype *.odt,*.doc,*.docx,*.xls,*.xlsx,*.odp,*.pptx,*.ods libreoffice %f &
|
||||
fileviewer *.doc catdoc %c
|
||||
fileviewer *.docx docx2txt.pl %f -
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user