예제 #1
0
        /// <summary>
        /// Begin the synchronization of settings for the given IVimBuffer.  It's okay if this method
        /// is called after synchronization is started.  The StartSynchronizing method will ignore
        /// multiple calls and only synchronize once
        /// </summary>
        private void BeginSettingSynchronization(IVimBuffer vimBuffer)
        {
            // Protect against multiple calls
            if (!_toSyncSet.Remove(vimBuffer))
            {
                return;
            }

            // Synchronize any further changes between the buffers
            _editorToSettingSynchronizer.StartSynchronizing(vimBuffer);

            // We have to make a decision on whether Visual Studio or Vim settings win during the startup
            // process.  If there was a Vimrc file then the vim settings win, else the Visual Studio ones
            // win.
            //
            // By the time this function is called both the Vim and Editor settings are at their final
            // values.  We just need to decide on a winner and copy one to the other
            if (_vim.VimRcState.IsLoadSucceeded && !_vim.GlobalSettings.UseEditorDefaults)
            {
                // Vim settings win.
                _editorToSettingSynchronizer.CopyVimToEditorSettings(vimBuffer);
            }
            else
            {
                // Visual Studio settings win.
                _editorToSettingSynchronizer.CopyEditorToVimSettings(vimBuffer);
            }
        }
예제 #2
0
        /// <summary>
        /// Begin the synchronization of settings for the given IVimBuffer.  It's okay if this method
        /// is called after synchronization is started.  The StartSynchronizing method will ignore
        /// multiple calls and only synchronize once
        /// </summary>
        private void BeginSettingSynchronization(IVimBuffer vimBuffer)
        {
            // Protect against multiple calls
            if (!_toSyncSet.Remove(vimBuffer))
            {
                return;
            }

            // There is no UI to adjust the default for relative line numbers so
            // push the current setting.
            vimBuffer.TextView.Options.SetOptionValue(
                LineNumbersMarginOptions.LineNumbersMarginOptionId,
                vimBuffer.LocalSettings.RelativeNumber);

            // Vim doesn't consider folding an undo operation, and neither does VsVim (issue #2184).
            vimBuffer.TextView.Options.SetOptionValue(DefaultTextViewOptions.OutliningUndoOptionId, false);

            // We have to make a decision on whether Visual Studio or Vim settings win during the startup
            // process.  If there was a Vimrc file then the vim settings win, else the Visual Studio ones
            // win.
            //
            // By the time this function is called both the Vim and Editor settings are at their final
            // values.  We just need to decide on a winner and copy one to the other
            var settingSyncSource = _vimApplicationSettings.UseEditorDefaults
                ? SettingSyncSource.Editor
                : SettingSyncSource.Vim;

            // Synchronize any further changes between the buffers
            _editorToSettingSynchronizer.StartSynchronizing(vimBuffer, settingSyncSource);
        }
예제 #3
0
파일: HostFactory.cs 프로젝트: wangzq/VsVim
        /// <summary>
        /// Begin the synchronization of settings for the given IVimBuffer.  It's okay if this method
        /// is called after synchronization is started.  The StartSynchronizing method will ignore
        /// multiple calls and only synchronize once
        /// </summary>
        private void BeginSettingSynchronization(IVimBuffer vimBuffer)
        {
            // Protect against multiple calls
            if (!_toSyncSet.Remove(vimBuffer))
            {
                return;
            }

            // We have to make a decision on whether Visual Studio or Vim settings win during the startup
            // process.  If there was a Vimrc file then the vim settings win, else the Visual Studio ones
            // win.
            //
            // By the time this function is called both the Vim and Editor settings are at their final
            // values.  We just need to decide on a winner and copy one to the other
            var settingSyncSource = _vimApplicationSettings.UseEditorDefaults
                ? SettingSyncSource.Editor
                : SettingSyncSource.Vim;

            // Synchronize any further changes between the buffers
            _editorToSettingSynchronizer.StartSynchronizing(vimBuffer, settingSyncSource);
        }