Compare commits

...

8 Commits

9 changed files with 146 additions and 70 deletions

View File

@ -38,7 +38,9 @@ local lsp_symbols = {
TypeParameter = "  (TypeParameter)", TypeParameter = "  (TypeParameter)",
} }
local cmp = require'cmp' local status, cmp = pcall(require, "cmp")
if (not status) then return end
cmp.setup{ cmp.setup{
completion = { completion = {
completeopt = 'menuone,noinsert,noselect', completeopt = 'menuone,noinsert,noselect',

View File

@ -1,9 +1,8 @@
local autopairs_status_ok, autopairs = pcall(require, "nvim-autopairs") local status, autopairs = pcall(require, "nvim-autopairs")
if not autopairs_status_ok then if (not status) then return end
return
end
autopairs.setup{ autopairs.setup{
ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]],"%s+", ""), disable_filetype = { "TelescopePrompt" , "vim" },
ignored_next_char = string.gsub([[ [%w%%%'%[%"%.] ]],"%s+", ""),
} }

View File

@ -0,0 +1 @@
require('gitsigns').setup {}

View File

@ -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 previewers = require('telescope.previewers')
local Job = require('plenary.job') local Job = require('plenary.job')
local new_maker = function(filepath, bufnr, opts) local new_maker = function(filepath, bufnr, opts)
filepath = vim.fn.expand(filepath) filepath = vim.fn.expand(filepath)
Job:new({ Job:new({
command = 'file', command = 'file',
args = { '--mime-type', '-b', filepath }, args = { '--mime-type', '-b', filepath },
on_exit = function(j) on_exit = function(j)
local mime_type = vim.split(j:result()[1], '/')[1] local mime_type = vim.split(j:result()[1], '/')[1]
if mime_type == "text" then if mime_type == "text" then
previewers.buffer_previewer_maker(filepath, bufnr, opts) previewers.buffer_previewer_maker(filepath, bufnr, opts)
else else
-- maybe we want to write something to the buffer here -- maybe we want to write something to the buffer here
vim.schedule(function() vim.schedule(function()
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' }) vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, { 'BINARY' })
end) end)
end end
end end
}):sync() }):sync()
end end
require('telescope').setup { local fb_actions = require "telescope".extensions.file_browser.actions
defaults = { local function telescope_buffer_dir()
buffer_previewer_maker = new_maker, return vim.fn.expand('%:p:h')
file_ignore_patterns = {"**/*.pdf"}, end
},
telescope.setup {
defaults = {
buffer_previewer_maker = new_maker,
file_ignore_patterns = { "**/*.pdf" },
},
extensions = { extensions = {
fzf = { fzf = {
fuzzy = true, -- false will only do exact matching fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case" case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_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)

View File

@ -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 -- One of "all", "maintained" (parsers with maintainers), or a list of languages
ensure_installed = {"python", "css", "html", "lua", "javascript", "vue", "c", "markdown", "rst"}, ensure_installed = {"python", "css", "html", "lua", "javascript", "vue", "c", "markdown", "rst"},
highlight = { highlight = {

View File

@ -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>df', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts)
buf_set_keymap('n', '<leader>dp', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', '<leader>dp', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts)
-- Get diagnostic on local list -- 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", "<leader>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<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 -- Use a loop to conveniently call 'setup' on multiple servers and
-- map buffer local keybindings when the language server attaches -- 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 for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup { nvim_lsp[lsp].setup {
on_attach = on_attach, on_attach = on_attach,

View File

@ -3,16 +3,16 @@ local fn = vim.fn
-- Automatically install packer -- Automatically install packer
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
if fn.empty(fn.glob(install_path)) > 0 then if fn.empty(fn.glob(install_path)) > 0 then
PACKER_BOOTSTRAP = fn.system { PACKER_BOOTSTRAP = fn.system {
"git", "git",
"clone", "clone",
"--depth", "--depth",
"1", "1",
"https://github.com/wbthomason/packer.nvim", "https://github.com/wbthomason/packer.nvim",
install_path, install_path,
} }
print "Installing packer close and reopen Neovim..." print "Installing packer close and reopen Neovim..."
vim.cmd [[packadd packer.nvim]] vim.cmd [[packadd packer.nvim]]
end end
-- Autocommand that reloads neovim whenever you save the plugins.lua file -- 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 -- Use a protected call so we don't error out on first use
local status_ok, packer = pcall(require, "packer") local status_ok, packer = pcall(require, "packer")
if not status_ok then if not status_ok then
return return
end end
-- Have packer use a popup window -- Have packer use a popup window
packer.init { packer.init {
display = { display = {
open_fn = function() open_fn = function()
return require("packer.util").float { border = "rounded" } return require("packer.util").float { border = "rounded" }
end, end,
}, },
} }
return packer.startup(function(use) return packer.startup(function(use)
@ -50,7 +50,11 @@ return packer.startup(function(use)
} }
use 'tpope/vim-fugitive' 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-surround'
use 'tpope/vim-repeat' use 'tpope/vim-repeat'
@ -72,10 +76,10 @@ return packer.startup(function(use)
-- 'rafamadriz/friendly-snippets', -- 'rafamadriz/friendly-snippets',
}, },
} }
use {'hrsh7th/cmp-vsnip', after = 'nvim-cmp'} use { 'hrsh7th/cmp-vsnip', after = 'nvim-cmp' }
use {'hrsh7th/cmp-buffer', after = 'nvim-cmp'} use { 'hrsh7th/cmp-buffer', after = 'nvim-cmp' }
use {'hrsh7th/cmp-path', after = 'nvim-cmp'} use { 'hrsh7th/cmp-path', after = 'nvim-cmp' }
use {'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp'} use { 'hrsh7th/cmp-nvim-lsp', after = 'nvim-cmp' }
-- use {'f3fora/cmp-spell', after = 'nvim-cmp'} -- use {'f3fora/cmp-spell', after = 'nvim-cmp'}
-- for formatters and linters -- for formatters and linters
@ -89,17 +93,18 @@ return packer.startup(function(use)
use { use {
'nvim-telescope/telescope.nvim', 'nvim-telescope/telescope.nvim',
config = [[require('config.telescope')]], 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 { use {
'lervag/vimtex', 'lervag/vimtex',
config = [[require('config.vimtex')]], config = [[require('config.vimtex')]],
} }
-- Highlight on Yank -- Highlight on Yank
use 'machakann/vim-highlightedyank' use 'machakann/vim-highlightedyank'
-- Autoclose parenthesis -- Autoclose parenthesis
-- use 'jiangmiao/auto-pairs' -- use 'jiangmiao/auto-pairs'
@ -121,7 +126,7 @@ return packer.startup(function(use)
use { use {
'nvim-treesitter/nvim-treesitter', 'nvim-treesitter/nvim-treesitter',
config=[[require('config.treesitter')]], config = [[require('config.treesitter')]],
run = ':TSUpdate', run = ':TSUpdate',
} }

View File

@ -64,6 +64,7 @@
], ],
"description": "tabular" "description": "tabular"
}, },
"minipage": { "minipage": {
"prefix": "minipage", "prefix": "minipage",
"body": [ "body": [
@ -73,6 +74,7 @@
], ],
"description": "minipage" "description": "minipage"
}, },
"multicols": { "multicols": {
"prefix": "multicols", "prefix": "multicols",
"body": [ "body": [
@ -82,6 +84,16 @@
], ],
"description": "multicols" "description": "multicols"
}, },
"image": {
"prefix": "image",
"body": [
"\\\\includegraphics[scale=${1:1}]{${2:./fig/}}",
"$0"
],
"description": "exercise xsim"
},
"exercise": { "exercise": {
"prefix": "exercise", "prefix": "exercise",
"body": [ "body": [
@ -90,6 +102,5 @@
"\\\\end{exercise}" "\\\\end{exercise}"
], ],
"description": "exercise xsim" "description": "exercise xsim"
} }
} }

View File

@ -332,7 +332,7 @@ filetype *.7z
fileviewer *.7z 7z l %c fileviewer *.7z 7z l %c
" Office files " 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 *.doc catdoc %c
fileviewer *.docx docx2txt.pl %f - fileviewer *.docx docx2txt.pl %f -